/* style.css - V6.3.8: App Shell & Zero Scroll Layout Final - ajustar camara*/

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #0ea5e9;    /* Cyan Neon */
    --secondary: #d946ef;  /* Magenta Neon */
    --success: #10b981;    /* Verde Hacker */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Dimensiones Fijas del App Shell */
    --header-height: 60px;
    /* Footer total: 70px Publicidad + 60px Menú = 130px */
    --footer-height: 130px; 
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    
    /* ESPACIO PARA LAS BARRAS FIJAS (Evita que el contenido quede tapado) */
    padding-top: calc(var(--header-height) + 10px);
    padding-bottom: calc(var(--footer-height) + 20px);
    
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- FOOTER DE CONFIANZA (Index) --- */
.trust-footer {
    width: 100%;
    text-align: center;       /* Esto centra el texto y el ícono */
    margin-top: 2rem;         /* Espacio arriba para separarlo de los botones */
    margin-bottom: 1rem;      /* Espacio abajo */
    color: var(--text-muted); /* Color grisáceo elegante */
    font-size: 0.9rem;        /* Tamaño discreto */
    
    /* Asegura que el contenedor ocupe el ancho para poder centrar */
    display: flex;
    justify-content: center;
}

/* =========================================
   1. APP SHELL (Header & Footer Fijos)
   ========================================= */

/* Header Superior */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center; /* Logo centrado */
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.logo-link {
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    transition: opacity 0.3s;
}
.brand-text { font-family: 'Orbitron', sans-serif; font-weight: 700; letter-spacing: 2px; }
.neon-pulse { color: var(--primary); animation: pulse 2s infinite; }

/* Footer Inferior (Doble Piso) */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

/* Piso 1: Publicidad (Ajustado: Más alto, letra chica) */
.footer-ad-row {
    height: 70px; /* Aumentado para mejor visibilidad del banner */
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    
    /* Estilos de texto para el anuncio */
    font-size: 0.7rem; 
    color: #64748b;
    line-height: 1.2;
    text-align: center;
}

/* Asegura que el contenido del anuncio no se estire más de 600px */
.footer-ad-row > * {
    max-width: 600px;
    width: 100%;
}

/* Piso 2: Navegación */
.footer-nav-row {
    height: 60px;
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    
    justify-content: center; 
    
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.nav-item {
    flex-grow: 1;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 5px 0;
    transition: all 0.3s;
    height: 100%;
}

.nav-item i { font-size: 1.4rem; margin-bottom: 4px; transition: transform 0.2s; }
.nav-item:hover { color: #fff; }

.nav-item.active {
    color: var(--primary);
    background: linear-gradient(to top, rgba(14, 165, 233, 0.1), transparent);
    border-bottom: 3px solid var(--primary);
}
.nav-item.active i { transform: translateY(-2px); text-shadow: 0 0 10px var(--primary); }

/* =========================================
   2. LAYOUT GENERAL & VISIBILIDAD
   ========================================= */

.app-container, .page-container {
    width: 100%;
    max-width: 600px; /* En PC no se estira infinito */
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    /* Altura mínima para ocupar la pantalla libre */
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 40px);
}

/* Clases de Utilidad para Ocultar/Mostrar */
.hidden-view, .hidden-section, .hidden-input { display: none !important; }

/* IMPORTANTE: Esta clase oculta los paneles. 
   Cuando la quitamos con JS, los paneles toman su display flex natural */
.hidden-ui { display: none !important; }

.active-view { 
    display: flex; 
    flex-direction: column; 
    flex: 1; 
    animation: fadeIn 0.4s ease; 
}

/* Títulos y Textos */
.intro-text { text-align: center; margin-bottom: 1.5rem; }
.intro-text h1 { font-family: 'Orbitron'; font-size: 2rem; line-height: 1.1; margin-bottom: 0.5rem; }
.intro-text p { color: var(--text-muted); }
.highlight { color: var(--primary); text-shadow: 0 0 15px rgba(14, 165, 233, 0.4); }

.neon-title { 
    font-family: 'Orbitron'; 
    color: #fff; 
    text-align: center; 
    /* AJUSTE: Reducimos margen de 1rem a 0.5rem */
    margin: 0.5rem 0; 
    /* AJUSTE: Tamaño un pelín más chico para que no empuje tanto */
    font-size: 1.4rem; 
    text-shadow: 0 0 10px rgba(255,255,255,0.3); 
}

/* =========================================
   3. BOTONES DE ACCIÓN (LADO A LADO)
   ========================================= */

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50% - 50% */
    gap: 1rem;
    margin-top: 1rem;
}

.cyber-btn {
    position: relative;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    /* Altura fija para uniformidad */
    min-height: 140px; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.cyber-btn:active { transform: scale(0.96); }

.btn-send { border-bottom: 4px solid var(--primary); }
.btn-receive { border-bottom: 4px solid var(--secondary); }

.btn-content { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; z-index: 2; }
.btn-content i { font-size: 2.2rem; color: #fff; margin-bottom: 0.5rem; }
.btn-content span { font-family: 'Orbitron'; font-size: 1.1rem; color: #fff; font-weight: 700; letter-spacing: 1px; }

/* Botón Tutorial */
.btn-tutorial {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5; padding: 8px 16px; border-radius: 20px;
    text-decoration: none; font-size: 0.85rem; font-weight: bold;
    margin-top: 10px; transition: all 0.3s;
}
.btn-tutorial:hover { background: rgba(239, 68, 68, 0.25); color: #fff; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

/* --- Modificador para Botones de Éxito (Verde Sólido) --- */
.cyber-btn-scan.btn-success {
    background: rgba(16, 185, 129, 0.15); /* Fondo verde suave */
    border: 1px solid var(--success);      /* Borde sólido, no punteado */
    color: var(--success);                 /* Texto verde */
    margin-top: 15px;                      /* Espacio superior estándar */
}

.cyber-btn-scan.btn-success:hover {
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);           /* Pequeño efecto de elevación */
}

/* =========================================
   4. UI ENVIAR (ZERO SCROLL)
   ========================================= */

#sender-ui {
    /* Flexibilidad en lugar de altura fija */
    flex: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Empieza arriba para no ser tapado */
    width: 100%;
    /* Quitamos overflow:hidden para que no recorte en pantallas bajas */
    overflow-y: auto; 
}

/* Zona de Archivo */
.file-drop-zone {
    margin-top: 2vh; 
    margin-bottom: 2vh;
    padding: 1.5rem;
    width: 100%;
    border: 2px dashed var(--primary);
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.05);
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}
.file-drop-zone:active { background: rgba(14, 165, 233, 0.15); }
.file-drop-zone i { font-size: 2rem; display: block; margin-bottom: 0.5rem; color: var(--primary); }
.file-drop-zone span { font-family: 'Orbitron'; font-size: 0.9rem; }

/* Sección QR Flexible */
#codeSection {
    flex: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    width: 100%;
    min-height: 0; 
}

.qr-box {
    background: white;
    padding: 10px;
    border-radius: 12px;
    height: 25vh; 
    width: 25vh; 
    max-width: 200px; max-height: 200px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

#qr { width: 100%; height: 100%; } 

.code-display {
    font-family: 'Orbitron';
    font-size: 2.2rem;
    color: var(--primary);
    margin: 1.5vh 0;
    text-shadow: 0 0 15px rgba(14, 165, 233, 0.5);
    line-height: 1;
}

.instruction { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* =========================================
   5. UI RECIBIR (COMPACTA)
   ========================================= */

#receiver-ui {
    flex: 1;
    display: flex;
    flex-direction: column;
    
    /* CAMBIO CLAVE: Alineamos al inicio (arriba) en lugar del centro */
    justify-content: flex-start; 
    
    /* CAMBIO CLAVE: Le damos "aire" arriba usando % de pantalla */
    /* Esto separa el formulario del título de forma elegante */
    padding-top: 5vh; 
    
    /* Espaciado entre elementos */
    gap: 1.5vh;
    
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
    
    /* Permitir scroll si la pantalla es muy chica */
    overflow-y: auto; 
}

/* Truco: Si sobra espacio abajo, empujamos el contenido al centro */
#receiver-ui > *:first-child {
    /* margin-top: auto; */
}
#receiver-ui > *:last-child {
    margin-bottom: auto;
}
/* Pero si estamos conectados (barra progreso visible), quitamos el centrado forzado 
   para que la barra no se vaya arriba de todo fuera de pantalla */
#receiver-ui.connected {
    justify-content: flex-start;
}
#receiver-ui.connected > * {
    margin-top: 0;
    margin-bottom: 0;
}

.input-group { width: 100%; }
.input-label { display: block; color: var(--primary); font-size: 0.8rem; font-weight: bold; margin-bottom: 5px; text-transform: uppercase; }

.cyber-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid #334155;
    color: #fff;
    /* AJUSTE: Menos padding (Antes 1rem) */
    padding: 0.7rem; 
    /* AJUSTE: Letra un poco más chica (Antes 2rem) */
    font-size: 1.8rem; 
    text-align: center;
    border-radius: 8px;
    font-family: 'Orbitron';
    letter-spacing: 4px;
}
.cyber-input:focus { border-color: var(--secondary); box-shadow: 0 0 10px rgba(217, 70, 239, 0.3); }

/* Captcha */
.captcha-box {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(30, 41, 59, 0.5); padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid #334155;
}
#captcha-question { font-family: 'Orbitron'; font-size: 1.2rem; color: #fff; }
#captcha-input { 
    background: transparent; border: none; border-bottom: 2px solid var(--secondary);
    color: var(--secondary); width: 60px; text-align: center; font-size: 1.5rem; font-weight: bold;
}

/* Botón Conectar */
.btn-connect {
    width: 100%; background: var(--secondary); color: #fff; border: none; padding: 1rem;
    font-size: 1rem; font-weight: bold; border-radius: 8px; opacity: 0.5; pointer-events: none; transition: 0.3s;
    font-family: 'Orbitron'; margin-top: 1rem;
}
.btn-connect.ready { opacity: 1; pointer-events: auto; box-shadow: 0 0 20px rgba(217, 70, 239, 0.4); }

/* Corrección para el Visor de Cámara */
#reader {
    width: 100%;
    /* Forzamos altura mínima para que no colapse */
    min-height: 300px; 
    background-color: #000; /* Fondo negro por si tarda en cargar */
    display: none;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--secondary);
    position: relative;
}

/* Ajuste para el video interno que genera la librería */
#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* =========================================
   6. COMPONENTES COMUNES
   ========================================= */

/* Botón Volver */
.btn-back {
    align-self: flex-start;
    background: transparent; border: 1px solid var(--secondary); color: var(--secondary);
    padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; gap: 6px; margin-bottom: 1rem;
}
.btn-back:hover { background: var(--secondary); color: #fff; }

/* Barra de Progreso */
.progress-container { width: 100%; margin: 1vh 0; }
.progress-bar { height: 16px; background: #0f172a; border-radius: 8px; overflow: hidden; border: 1px solid #334155; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); width: 0%; transition: width 0.3s; }
.status-text { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 5px; min-height: 1.2em; }

/* Tarjeta Archivo */
.compact-file-card {
    background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); border-radius: 12px;
    padding: 1rem; display: none; animation: slideUp 0.3s ease; width: 100%;
}
.file-info-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.file-icon-small { font-size: 2.2rem; color: var(--success); }
.file-details { flex: 1; overflow: hidden; }
.file-details h3 { font-size: 1rem; color: #fff; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-details p { font-size: 0.8rem; color: var(--success); font-weight: bold; margin: 0; }

.btn-download-compact {
    width: 100%; background: var(--success); color: #000; border: none; padding: 0.8rem;
    border-radius: 6px; font-weight: bold; cursor: pointer; display: flex; justify-content: center; gap: 8px;
}
.btn-download-compact:hover { background: #34d399; }

/* Utilidades */
.cyber-overlay { position: fixed; top:0; left:0; width:100%; height:100%; pointer-events: none; z-index: 1; background: radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.05) 0%, transparent 60%); }

/* Animaciones */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Media Queries (Ajustes PC) */
@media (min-width: 768px) {
    .action-grid { gap: 2rem; }
    .cyber-btn { min-height: 180px; }
    #sender-ui, #receiver-ui { max-width: 500px; margin: 0 auto; }
}
/* --- AJUSTE NETBOOK / PANTALLAS BAJAS --- */
@media (min-width: 768px) and (max-height: 800px) {
    
    /* 1. Achicar márgenes del Título Neon */
    .neon-title {
        margin-top: 0;
        margin-bottom: 0.5rem; /* Menos espacio abajo del título */
        font-size: 1.2rem;     /* Un poquito más chico */
    }

    /* 2. Pegar el formulario más arriba */
    #receiver-ui {
        padding-top: 0 !important; /* Forzamos que suba */
        justify-content: center;   /* Intentamos centrar de nuevo */
        gap: 0.5rem;               /* Menos espacio entre inputs */
    }

    /* 3. Inputs un poco más compactos */
    .cyber-input {
        padding: 0.5rem;       /* Menos relleno */
        font-size: 1.5rem;     /* Números un poco más chicos */
        margin-bottom: 0;
    }

    .input-label {
        margin-bottom: 2px;    /* Etiqueta pegada al input */
    }

    /* 4. Botón Conectar más compacto */
    .btn-connect {
        margin-top: 0.5rem;
        padding: 0.8rem;
    }
}

/* --- CRÉDITOS DEL AUTOR (Footer Index) --- */

/* Ajustamos el contenedor padre para que acepte columna */
.trust-footer {
    display: flex;
    flex-direction: column; /* Uno debajo del otro */
    align-items: center;
    gap: 0.5rem; /* Espacio entre "Seguridad" y "Autor" */
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.author-credits {
    font-size: 0.75rem; /* Letra pequeña y discreta */
    color: #475569;     /* Gris oscuro para no distraer */
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
}

.author-credits a {
    color: #64748b;     /* Gris un poco más claro para los links */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.author-credits a:hover {
    color: var(--primary); /* Se iluminan en Cyan al pasar el mouse */
    text-shadow: 0 0 8px rgba(14, 165, 233, 0.5);
}

.separator {
    margin: 0 5px;
    color: #334155;
}

/* --- BOTÓN DE ESCANEO QR --- */
.cyber-btn-scan {
    width: 100%;
    background: rgba(217, 70, 239, 0.1); /* Magenta muy suave */
    border: 1px dashed var(--secondary);
    color: var(--secondary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Orbitron';
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cyber-btn-scan:hover {
    background: rgba(217, 70, 239, 0.2);
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.2);
}

.cyber-btn-scan.scanning {
    background: #ef4444; /* Rojo para indicar "Detener" */
    border-color: #ef4444;
    color: white;
}

/* Estilo específico para el botón de éxito */
#sender-success .cyber-btn-scan {
    border-style: solid;
    background: rgba(16, 185, 129, 0.1); /* Fondo verde suave */
    border-color: var(--success);
    color: var(--success);
}
#sender-success .cyber-btn-scan:hover {
    background: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* style.css - Addons v8.5 */

/* Caja de Estadísticas */
.stats-box {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #fff;
    font-weight: bold;
}

/* Sección Compartir */
.share-promo {
    margin: 25px 0;
    padding-top: 20px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.share-promo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}

/* Centrado vertical y despeje del Footer */
#sender-success, #receiver-success {
    /* Ocupar buena parte de la pantalla verticalmente */
    min-height: 60vh; 
    
    /* Centrar contenido */
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    
    /* CRÍTICO: Empujar contenido hacia arriba para que no lo tape el footer */
    padding-bottom: 160px; 
}

/* Asegurar que las estadísticas se vean grandes y claras */
.stats-box {
    /* Dimensiones */
    width: 100%;
    max-width: 300px;
    
    /* Diseño Interno */
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    
    /* Estética */
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    z-index: 10;

    /* --- LA CLAVE DEL CENTRADO --- */
    margin: 20px auto; /* 20px vertical, AUTO horizontal */
}
