/* --- styles.css (VERSIÓN LIMPIA Y SIN DUPLICADOS) --- */

/* 1. FUENTES Y BASES */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');
/* RESET MÁGICO PARA EVITAR DESBORDAMIENTOS */
*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    font-family: 'Inter', sans-serif; 
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%); 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    align-items: center; 
    min-height: 100vh; 
    margin: 0; 
    color: #334e68;
    box-sizing: border-box; 
    padding: 30px 0; 
}

/* 2. CONTENEDORES (Login y Bienvenida) */
.contenedor-login { 
    background-color: #ffffff; 
    padding: 40px 50px; 
    border-radius: 16px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); 
    
    /* 👇 Aquí está la magia responsiva 👇 */
    width: 90%; 
    max-width: 420px; 
    
    text-align: center; 
    border: 1px solid #e2e8f0;
    transition: all 0.5s ease; 
}

#panel-bienvenida {
    width: 90%;
    max-width: 900px; 
}

/* 3. ELEMENTOS DE FORMULARIO */
h2 { margin-top: 0; color: #102a43; font-size: 1.5rem; }
p { color: #627d98; font-size: 0.95rem; margin-bottom: 25px; line-height: 1.5; }

input { 
    width: 100%; padding: 12px 15px; margin: 10px 0 20px 0; 
    border: 2px solid #e2e8f0; border-radius: 8px; 
    box-sizing: border-box; font-size: 1rem; transition: border-color 0.3s ease; 
}
input:focus { border-color: #4285f4; outline: none; }

button { 
    width: 100%; padding: 12px; background-color: #4285f4; color: white; 
    border: none; border-radius: 8px; cursor: pointer; font-weight: 600; 
    font-size: 1rem; transition: background-color 0.3s ease, transform 0.1s ease; 
}
button:hover { background-color: #3367d6; }
button:active { transform: scale(0.98); }

.mensaje { margin-top: 15px; font-size: 0.9em; font-weight: 600; }

/* 4. MARCA Y LOGOS (Actualizado para alineación perfecta) */
.header-marca {
    width: 95%; /* Mismo ancho que el panel principal */
    max-width: 1500px; /* Mismo tope que el panel principal */
    margin: 0 auto; /* Centrado automático */
    display: flex; 
    align-items: center; 
    padding: 20px 0; /* Quitamos márgenes extra */
    margin-bottom: 20px; 
}
.logo-icono { font-size: 2.2rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
.nombre-app {
    font-size: 2rem; font-weight: 800; color: #102a43; letter-spacing: -1.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #102a43, #4285f4);
    background-clip: text; /* Propiedad estándar */
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
}

.footer-logos {
    width: 95%;
    max-width: 1500px;
    margin: 40px auto 0 auto; /* Centrado alineado con el resto de la web */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 12px;
    padding-bottom: 20px;
    position: relative !important; 
    flex-shrink: 0; 
}
.texto-apoyo {
    font-size: 0.75rem; color: #829ab1; text-transform: uppercase; 
    letter-spacing: 1.5px; font-weight: 700;
}
.contenedor-imagenes { display: flex; align-items: center; gap: 40px; }
.logo-institucion {
    height: 45px; opacity: 0.5; filter: grayscale(100%); 
    transition: all 0.4s ease; cursor: pointer;
}
.logo-institucion:hover { opacity: 1; filter: grayscale(0%); transform: scale(1.05); }

/* 5. SPINNER DE CARGA */
#estado-carga { text-align: center; margin-top: 20px; }
.spinner {
    border: 4px solid #f3f3f3; 
    border-top: 4px solid #3498db; 
    border-radius: 50%; 
    width: 40px;
    height: 40px;
    animation: girar 1s linear infinite; 
    margin: 0 auto; 
}
@keyframes girar { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================
   6. DISEÑO PREMIUM DE RESULTADOS IA Y PDF
   ========================================== */

/* Contenedor general transparente y flexible */
.caja-respuesta {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: transparent;
    box-shadow: none;
    padding: 10px;
    margin-top: 25px;
    text-align: left;
}

/* --- TARJETA 1: RESUMEN EJECUTIVO (La de la Nota) --- */
.tarjeta-resumen {
    background: linear-gradient(135deg, #102a43 0%, #243b53 100%) !important;
    color: #ffffff !important;
    text-align: center !important;
    border: none !important;
    border-radius: 16px;
    padding: 35px 30px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* ⚠️ REGLA DE ORO PARA PDF */
    page-break-inside: avoid;
}

.tarjeta-resumen h2, 
.tarjeta-resumen h3, 
.tarjeta-resumen p, 
.tarjeta-resumen div,
.tarjeta-resumen span {
    color: #ffffff !important;
    text-align: center !important;
    width: 100%;
}

.tarjeta-resumen h2 {
    font-size: 2.2rem !important;
    margin-bottom: 15px !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
    padding-bottom: 15px !important;
}

/* --- TARJETAS DE DETALLE (Blancas con borde superior de color) --- */
.tarjeta {
    padding: 24px 30px;
    border-radius: 16px;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f4f8;
    margin-bottom: 15px;
    
    /* ⚠️ REGLA DE ORO PARA PDF: Evita que la tarjeta se corte entre dos páginas */
    page-break-inside: avoid; 
}

.tarjeta h3 {
    color: #102a43;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

/* Colores de acento para las tarjetas (Borde superior grueso) */
.tarjeta.verde { border-top: 5px solid #00bfa5; }
.tarjeta.amarilla { border-top: 5px solid #fbbc04; }
.tarjeta.azul { border-top: 5px solid #2962ff; }
.tarjeta.analisis { border-top: 5px solid #8e44ad; }

.tarjeta ul {
    margin: 0;
    padding-left: 20px;
}

.tarjeta li {
    margin-bottom: 12px;
    color: #334e68;
    line-height: 1.6;
}

/* --- AJUSTES EXCLUSIVOS PARA LA EXPORTACIÓN DEL PDF --- */
@media print {
    body {
        background: white !important; /* Quitamos el fondo gris del PDF */
    }
    .tarjeta {
        box-shadow: none !important; /* Las sombras de pantalla se ven mal en papel/PDF */
        border: 1px solid #e2e8f0;
        page-break-inside: avoid;
    }
}
/* ==========================================
   7. ZONA DRAG & DROP (Subida de Video)
   ========================================== */
.drop-zone {
    max-width: 100%;
    height: 150px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: inherit;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    color: #102a43;
    background-color: #ffffff;
    border: 2px dashed #4285f4; /* Azul acorde a tus botones principales */
    border-radius: 8px;
    transition: background-color 0.3s, border-color 0.3s;
    box-sizing: border-box;
    margin-bottom: 15px;
}

/* Efecto visual cuando pasamos el ratón o arrastramos un archivo encima */
.drop-zone:hover, .drop-zone--over {
    border-style: solid;
    background-color: #e8f0fe; /* Un azul muy clarito para dar feedback visual */
}

/* Magia: Ocultamos el botón clásico y feo del navegador */
.drop-zone__input {
    display: none;
}
/* ==========================================
   8. BOTONES DE ACCIÓN (Header) - Diseño Premium
   ========================================== */

/* 1. Botón de la Luna */
.btn-icono-header {
    background-color: transparent !important; 
    border: none; 
    color: #627d98;
    width: 44px !important; /* Forzamos su tamaño pequeño */
    height: 44px;
    border-radius: 50%; 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.btn-icono-header:hover {
    background-color: #e2e8f0 !important;
    color: #102a43;
}

/* 2. Botón Cerrar Sesión (Ghost Button) */
.btn-fantasma-peligro {
    background-color: transparent !important; /* Forzamos a que no sea rojo por defecto */
    border: none;
    color: #627d98 !important; 
    width: auto !important; /* Forzamos a que NO ocupe el 100% */
    margin: 0 !important; /* Quitamos márgenes antiguos */
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px; 
    transition: all 0.2s ease;
}

.btn-fantasma-peligro:hover {
    background-color: #fee2e2 !important; 
    color: #e74c3c !important; 
}
/* ==========================================
   9. MODO OSCURO (Dark Mode)
   ========================================== */

/* Cuando el <body> tenga la clase "dark-mode", todo esto se activará */
body.dark-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    color: #cbd5e1 !important;
}

/* Cambiamos el fondo de las cajas blancas a un gris azulado oscuro */
body.dark-mode .contenedor-login,
body.dark-mode aside,
body.dark-mode main,
body.dark-mode .drop-zone {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* Textos principales en blanco/gris claro para que se lean bien */
body.dark-mode h2, 
body.dark-mode h3, 
body.dark-mode p,
body.dark-mode span,
body.dark-mode strong,
body.dark-mode summary,
body.dark-mode li {
    color: #f1f5f9 !important;
}

/* Ajustamos el color de los iconos de la cabecera para que destaquen */
body.dark-mode .btn-icono-header,
body.dark-mode .logo-icono {
    color: #94a3b8 !important;
}

/* Le damos un toque de neón al título principal en la cabecera */
body.dark-mode .nombre-app {
    background: linear-gradient(90deg, #60a5fa, #a78bfa) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

/* El fondo de la zona de subida de archivos en oscuro */
body.dark-mode .drop-zone {
    background-color: #0f172a !important;
}

/* Detalles grises como el cuadro de créditos */
body.dark-mode #contenedor-creditos,
body.dark-mode details {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

/* Invertimos el color de los logos de la UPV del pie de página para que se vean */
body.dark-mode .logo-institucion {
    filter: grayscale(100%) invert(100%) opacity(0.6) !important;
}
/* --- FIX MODO OSCURO: Tarjetas de IA, Historial y Desplegables --- */

/* 1. Fondo oscuro para las tarjetas de resultados */
body.dark-mode .tarjeta {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

/* 2. Fondo oscuro para CUALQUIER elemento base del historial (div, button, a) */
body.dark-mode #lista-informes > * {
    background-color: #334155 !important; 
    border: 1px solid #475569 !important;
}

/* 3. Forzar que TODO el texto e iconos dentro del historial sea claro */
body.dark-mode #lista-informes * {
    color: #f1f5f9 !important;
}

/* 4. Ajuste para el menú desplegable (select) del perfil */
body.dark-mode select#userRole {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

/* --- 10. PRIVACIDAD MINIMALISTA Y MODAL --- */
.privacy-mini-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    padding: 5px;
}

.privacy-mini-container input[type="checkbox"] {
    margin-top: 4px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.privacy-mini-container label {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #475569;
    cursor: pointer;
}

.privacy-mini-container a {
    color: #102a43;
    font-weight: 700;
    text-decoration: underline;
}

.detail-text {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.btn-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b;
}

.modal-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #334155;
    max-height: 400px;
    overflow-y: auto;
}

.btn-primary-modal {
    background: #102a43;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin-top: 15px;
}

/* Modo Oscuro para el Modal */
body.dark-mode .modal-content { background: #1e293b; color: #f1f5f9; }
body.dark-mode .modal-body { color: #cbd5e1; }
body.dark-mode .privacy-mini-container label { color: #cbd5e1; }
body.dark-mode .privacy-mini-container a { color: #60a5fa; }

/* ==========================================
   11. FIX: BOTÓN PRINCIPAL EN MODO OSCURO (REVISADO)
   ========================================== */

/* 1. Estado Normal */
body.dark-mode #btn-analizar-cv {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4) !important;
    border: 1px solid #3b82f6 !important;
    opacity: 1 !important; 
    transition: all 0.3s ease !important;
}

/* 2. Estado Hover */
body.dark-mode #btn-analizar-cv:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6) !important;
    transform: translateY(-2px) !important;
}

/* 3. ESTADO DURANTE EL PROCESAMIENTO (Carga - Optimizado) */
body.dark-mode #btn-analizar-cv:disabled:not([data-empty="true"]) {
    background-color: #334155 !important; /* Gris azulado más claro para dar volumen */
    color: #f1f5f9 !important;           /* Blanco roto para máxima legibilidad */
    border: 1px solid #475569 !important; /* Borde que define el contorno */
    opacity: 1 !important;                /* Nitidez total */
    cursor: wait !important;
    letter-spacing: 0.5px;                /* Un toque de aire al texto */
}

/* 4. Estado Desactivado Inicial (Caja vacía / Sin check) */
body.dark-mode #btn-analizar-cv:disabled {
    background: #0f172a !important; 
    color: #475569 !important; 
    box-shadow: none !important;
    border: 1px solid #334155 !important;
    transform: none !important;
    opacity: 0.7 !important;       /* Aquí sí dejamos un poco de transparencia */
}