/**
 * Estilos para el Escáner Full-Screen y PWA de Acreditación
 * Archivo: addons/miembros/assets/css/scanner-fullscreen.css
 */

:root {
    --rm-fs-bg: #070d18;
    --rm-fs-card-bg: rgba(15, 23, 42, 0.92);
    --rm-fs-accent: #2ab7b7;
    --rm-fs-accent-glow: rgba(42, 183, 183, 0.4);
    --rm-fs-success: #10b981;
    --rm-fs-error: #ef4444;
    --rm-fs-warning: #f59e0b;
    --rm-fs-text: #ffffff;
    --rm-fs-subtext: #94a3b8;
    --rm-fs-font: 'Montserrat', system-ui, -apple-system, sans-serif;
    --rm-sat: env(safe-area-inset-top, 0px);
    --rm-sab: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--rm-fs-bg);
    color: var(--rm-fs-text);
    font-family: var(--rm-fs-font);
    position: fixed;
    inset: 0;
}

/* =========================================================================
   PANTALLA DE BLOQUEO POR PIN
   ========================================================================= */
.rm-lock-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: radial-gradient(circle at center top, #13243d 0%, #070d18 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.rm-lock-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 36px 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.rm-lock-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.rm-lock-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
}

.rm-lock-subtitle {
    font-size: 14px;
    color: var(--rm-fs-subtext);
    margin-bottom: 24px;
    line-height: 1.4;
}

.rm-pin-input-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.rm-pin-digit {
    width: 52px;
    height: 56px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    outline: none;
    transition: all 0.2s ease;
}

.rm-pin-digit:focus {
    border-color: var(--rm-fs-accent);
    box-shadow: 0 0 16px var(--rm-fs-accent-glow);
    background: rgba(0, 0, 0, 0.5);
}

.rm-lock-error {
    color: var(--rm-fs-error);
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
    margin-bottom: 12px;
}

.rm-lock-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    transition: transform 0.15s ease, opacity 0.2s;
}

.rm-lock-submit-btn:active {
    transform: scale(0.98);
}

/* =========================================================================
   VIEWPORT CÁMARA FULL SCREEN
   ========================================================================= */
.rm-fs-camera-viewport {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background: #000000;
    overflow: hidden;
}

.rm-fs-camera-viewport video {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: cover !important;
}

/* =========================================================================
   HUD FLOTANTE (HEADS-UP DISPLAY)
   ========================================================================= */
.rm-fs-hud {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.rm-fs-hud * {
    pointer-events: auto;
}

/* Barra Superior con protección de desbordamiento en pantallas móviles */
.rm-fs-topbar {
    padding-top: calc(var(--rm-sat) + 10px);
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(7, 13, 24, 0.85) 0%, rgba(7, 13, 24, 0) 100%);
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
}

@media (max-width: 420px) {
    .rm-fs-topbar {
        padding-left: 8px;
        padding-right: 8px;
    }
    .rm-fs-tag {
        display: none !important; /* Ocultar etiqueta redundante de congreso en pantallas ultra-estrechas */
    }
    .rm-fs-usb-pill span:not(.rm-usb-dot) {
        display: none; /* Mantener solo el punto verde indicador en móvil compacto */
    }
    .rm-fs-usb-pill {
        padding: 6px 8px !important;
    }
    .rm-fs-stats-pill {
        font-size: 11px !important;
        padding: 5px 8px !important;
    }
}

.rm-fs-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rm-fs-tag {
    background: rgba(255, 122, 61, 0.25);
    color: #ff9d66;
    border: 1px solid rgba(255, 122, 61, 0.4);
    font-size: 11px;
    font-weight: 800;
    padding: 5px 9px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.rm-fs-stats-pill {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rm-fs-stats-pill strong {
    color: var(--rm-fs-accent);
}

/* Píldora de estado de Lector USB */
.rm-fs-usb-pill {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #34d399;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
}

.rm-fs-usb-pill .rm-usb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
    display: inline-block;
    animation: rmUsbPulse 2s infinite ease-in-out;
}

@keyframes rmUsbPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

.rm-fs-usb-pill.is-scanning {
    background: rgba(42, 183, 183, 0.4);
    border-color: #2ab7b7;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(42, 183, 183, 0.6);
}

.rm-fs-camera-viewport.is-usb-only {
    background: radial-gradient(circle at center, #0f1f38 0%, #070d18 100%);
}

.rm-fs-camera-viewport.is-usb-only video {
    display: none;
}

.rm-fs-hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rm-hud-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.rm-hud-btn:active {
    transform: scale(0.92);
}

.rm-hud-btn.is-active {
    background: var(--rm-fs-accent);
    color: #070d18;
    border-color: #ffffff;
    box-shadow: 0 0 16px var(--rm-fs-accent-glow);
}

/* =========================================================================
   RETÍCULA DE ESCANEO CENTRAL Y LÁSER
   ========================================================================= */
.rm-fs-viewfinder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 270px;
    height: 270px;
    pointer-events: none;
}

/* Esquinas de mira futurista */
.rm-viewfinder-corners {
    position: absolute;
    inset: 0;
}

.rm-corner {
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: var(--rm-fs-accent);
    border-style: solid;
    filter: drop-shadow(0 0 8px var(--rm-fs-accent));
}

.rm-corner-tl { top: 0; left: 0; border-width: 4px 0 0 4px; border-top-left-radius: 12px; }
.rm-corner-tr { top: 0; right: 0; border-width: 4px 4px 0 0; border-top-right-radius: 12px; }
.rm-corner-bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-bottom-left-radius: 12px; }
.rm-corner-br { bottom: 0; right: 0; border-width: 0 4px 4px 0; border-bottom-right-radius: 12px; }

/* Línea Láser Animada */
.rm-laser-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--rm-fs-accent), #ffffff, var(--rm-fs-accent), transparent);
    box-shadow: 0 0 14px var(--rm-fs-accent), 0 0 4px #ffffff;
    border-radius: 2px;
    animation: rmLaserSweep 2.2s ease-in-out infinite alternate;
}

@keyframes rmLaserSweep {
    0% { top: 8px; opacity: 0.4; }
    50% { opacity: 1; }
    100% { top: calc(100% - 11px); opacity: 0.4; }
}

.rm-viewfinder-hint {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Estado de Detección Inmediata (Verde Chime) */
.rm-fs-viewfinder.is-detected .rm-corner {
    border-color: var(--rm-fs-success) !important;
    filter: drop-shadow(0 0 16px var(--rm-fs-success)) !important;
    transition: all 0.15s ease-out;
}

.rm-fs-viewfinder.is-detected .rm-laser-line {
    background: linear-gradient(90deg, transparent, var(--rm-fs-success), #ffffff, var(--rm-fs-success), transparent) !important;
    box-shadow: 0 0 22px var(--rm-fs-success), 0 0 6px #ffffff !important;
}

/* =========================================================================
   BARRA INFERIOR DE ACCIONES
   ========================================================================= */
.rm-fs-bottombar {
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: calc(var(--rm-sab) + 18px);
    display: flex;
    gap: 12px;
    background: linear-gradient(to top, rgba(7, 13, 24, 0.9) 0%, rgba(7, 13, 24, 0) 100%);
}

.rm-bottom-btn {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.rm-bottom-btn:active {
    transform: scale(0.97);
}

.rm-btn-search {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
}

.rm-btn-mode {
    background: rgba(42, 183, 183, 0.2);
    border: 1px solid rgba(42, 183, 183, 0.4);
    color: #5eead4;
}

.rm-btn-mode.is-manual {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
}

/* =========================================================================
   BOTTOM SHEET / FICHA DEL ASISTENTE DETECTADO
   ========================================================================= */
.rm-fs-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.rm-fs-sheet-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.rm-fs-sheet {
    background: var(--rm-fs-card-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px 28px 0 0;
    padding: 24px 22px calc(var(--rm-sab) + 24px) 22px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    position: relative;
}

.rm-fs-sheet-overlay.is-visible .rm-fs-sheet {
    transform: translateY(0);
}

/* Barra de progreso de auto-cierre */
.rm-sheet-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--rm-fs-accent);
    width: 100%;
    transform-origin: left;
    transition: width linear;
}

.rm-sheet-header-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-weight: 800;
    font-size: 16px;
}

.rm-banner-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.rm-banner-duplicate {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.rm-banner-notfound {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.rm-sheet-name {
    font-size: 26px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.rm-sheet-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.rm-sheet-role-pill {
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.rm-role-asistente { background: rgba(59, 130, 246, 0.25); color: #60a5fa; }
.rm-role-profesor { background: rgba(147, 51, 234, 0.25); color: #c084fc; }
.rm-role-organizador { background: rgba(249, 115, 22, 0.25); color: #fb923c; }
.rm-role-expositor { background: rgba(16, 185, 129, 0.25); color: #34d399; }

.rm-sheet-code {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 6px;
}

.rm-sheet-inst {
    font-size: 14px;
    color: var(--rm-fs-subtext);
    margin-bottom: 16px;
}

/* Casillero / Ubicación de Credencial Física en Caja */
.rm-sheet-box-badge {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.22) 0%, rgba(14, 165, 233, 0.12) 100%);
    border: 1.5px solid rgba(56, 189, 248, 0.55);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.2);
}

.rm-box-label-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rm-box-icon {
    font-size: 22px;
    line-height: 1;
}

.rm-box-title {
    font-size: 11px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.rm-box-value {
    font-family: 'Montserrat', monospace, sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #38bdf8;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 6px 14px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
    white-space: nowrap;
}

.rm-sheet-instruction-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    padding: 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rm-sheet-next-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rm-sheet-next-btn:active {
    transform: scale(0.98);
}

/* =========================================================================
   MODAL DE BÚSQUEDA MANUAL
   ========================================================================= */
.rm-fs-modal {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    padding: calc(var(--rm-sat) + 16px) 16px calc(var(--rm-sab) + 16px) 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.rm-fs-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.rm-fs-modal-card {
    background: var(--rm-fs-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    max-height: 100%;
    overflow: hidden;
}

.rm-fs-modal-header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rm-fs-modal-title {
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
}

.rm-fs-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    box-sizing: border-box;
}

.rm-fs-modal-body {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
}

.rm-search-input-wrap {
    margin-bottom: 16px;
}

.rm-search-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    outline: none;
    font-family: inherit;
}

.rm-search-input:focus {
    border-color: var(--rm-fs-accent);
}

.rm-search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rm-search-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rm-search-item-info {
    flex: 1;
    padding-right: 12px;
}

.rm-search-item-name {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.rm-search-item-sub {
    font-size: 12px;
    color: var(--rm-fs-subtext);
    margin-top: 3px;
}

.rm-search-acreditar-btn {
    padding: 10px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--rm-fs-accent);
    color: #070d18;
    font-size: 13px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
}

.rm-search-acreditar-btn.is-checked {
    background: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    cursor: default;
}

/* =========================================================================
   BANNER INSTALACIÓN PWA
   ========================================================================= */
.rm-pwa-install-banner {
    position: fixed;
    bottom: calc(var(--rm-sab) + 76px);
    left: 16px;
    right: 16px;
    z-index: 50;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(42, 183, 183, 0.4);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: rmSlideUp 0.3s ease-out;
}

@keyframes rmSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.rm-pwa-install-text {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.rm-pwa-install-btn {
    background: var(--rm-fs-accent);
    color: #070d18;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.rm-pwa-dismiss {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    margin-left: 8px;
    cursor: pointer;
}
