* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: #2c3e50;
    height: 100vh;
    overflow: auto;
}

.exam-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: white;
    max-width: 100%;
    position: relative;
}

/* Barra superior */
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background-color: #f5f5ff; border-bottom: 1px solid #ddd; min-height: 70px; flex-wrap: wrap; gap: 10px; }
.top-bar-left-group { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; flex-grow: 1; min-width: 0; }
.nav-buttons { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.action-buttons { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.top-bar-logo { height: 45px; width: auto; }
.top-bar-title { font-size: 20px; font-weight: 600; color: #2c3e50; text-align: left; min-width: 0; word-wrap: break-word; }
.nav-btn { display: flex; align-items: center; gap: 6px; background-color: transparent; border: 1px solid #ddd; border-radius: 4px; padding: 8px 12px; font-size: 14px; cursor: pointer; color: #555; transition: all 0.2s; white-space: nowrap; }
.nav-btn:hover { background-color: #e9e9e9; }
.nav-btn.active { background-color: #4a90e2; color: white; border-color: #4a90e2; }
.btn-action { display: flex; align-items: center; gap: 6px; background-color: #4a90e2; color: white; border: none; border-radius: 4px; padding: 8px 12px; font-size: 14px; cursor: pointer; transition: background-color 0.2s; white-space: nowrap; }
.btn-action:hover { background-color: #3a7bc8; }
.btn-action.logout { background-color: #e74c3c; }
.btn-action.logout:hover { background-color: #c0392b; }
.btn-login-nav { background-color: #27ae60; }
.btn-login-nav:hover { background-color: #229954; }
.btn-register-nav { background-color: #f39c12; }
.btn-register-nav:hover { background-color: #e67e22; }
.btn-recover-nav { background-color: #e74c3c; }
.btn-recover-nav:hover { background-color: #c0392b; }
.navbar-login { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-button-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-form-control { width: 150px; padding: 8px 10px; font-size: 14px; border: 1px solid #ddd; border-radius: 4px; transition: border-color 0.2s; -webkit-appearance: none; }
.nav-form-control:focus { outline: none; border-color: #4a90e2; }
.btn-action-secondary { background: none; border: none; color: #4a90e2; font-size: 14px; font-weight: 500; cursor: pointer; padding: 8px 4px; white-space: nowrap; }
.btn-action-secondary:hover { text-decoration: underline; }

/* Área de contenido */
.content-area { flex: 1; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 20px; min-height: calc(100vh - 140px); }

/* Estilos de Formulario Genéricos */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.form-control { width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 4px; font-size: 15px; transition: border-color 0.2s; -webkit-appearance: none; }
.form-control:focus { outline: none; border-color: #4a90e2; }

/* ===== NUEVO: Estilo para campos condicionales ===== */
.form-group-conditional {
    display: none; /* Oculto por defecto */
    padding-left: 20px;
    border-left: 3px solid #f0f0f0;
    margin-left: 5px;
    margin-bottom: 18px; 
    /* Usar una animación diferente para la aparición */
    animation: conditionalFadeIn 0.3s ease-out;
}
.form-group-conditional .form-group {
    margin-bottom: 0; /* Quitar margen doble */
}
/* Animación solo para el grupo condicional */
@keyframes conditionalFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


.flatpickr-input { font-size: 15px !important; }
.btn-login { width: 100%; padding: 14px; background-color: #4a90e2; color: white; border: none; border-radius: 4px; font-size: 16px; font-weight: 500; cursor: pointer; transition: background-color 0.2s; min-height: 50px; }
.btn-login:hover { background-color: #3a7bc8; }
.btn-login:disabled { background-color: #95a5a6; cursor: not-allowed; }
.btn-action.btn-secondary { background-color: #7f8c8d; }
.btn-action.btn-secondary:hover { background-color: #6c7a7b; }
.form-navigation { display: flex; justify-content: space-between; align-items: center; margin-top: 25px; border-top: 1px solid #eee; padding-top: 20px; }
.btn-submit-form { display: none; }
@keyframes stepFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.form-step { display: none; animation: stepFadeIn 0.3s ease-out; }
.form-step.active { display: block; }
.form-info { background: #f8f9fa; padding: 14px; border-radius: 4px; margin-bottom: 18px; border-left: 4px solid #4a90e2; }
.form-info p { margin: 0; color: #555; font-size: 14px; line-height: 1.4; }

/* Barra de Pasos (Stepper) */
.form-stepper { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 0; width: 100%; max-width: 450px; margin-top: 30px; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; min-width: 60px; }
.step-icon { width: 32px; height: 32px; border-radius: 50%; background-color: #bdc3c7; color: white; font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s; margin-bottom: 6px; }
.step-title { font-size: 12px; color: #7f8c8d; font-weight: 500; }
.step.active .step-icon { background-color: #4a90e2; }
.step.active .step-title { color: #4a90e2; font-weight: 600; }
.step.completed .step-icon { background-color: #27ae60; }
.step.completed .step-title { color: #27ae60; }
.step-conditional { display: none; }

/* Contenedor de Revisión */
#step-review-content { max-height: 400px; overflow-y: auto; border: 1px solid #eee; border-radius: 4px; padding: 15px; background: #fdfdfd; }
.review-section { margin-bottom: 15px; }
.review-section:last-child { margin-bottom: 0; }
.review-title { font-size: 16px; font-weight: 600; color: #2c3e50; padding-bottom: 8px; border-bottom: 2px solid #4a90e2; margin-bottom: 10px; }
.review-item { font-size: 14px; color: #555; margin-bottom: 6px; display: flex; justify-content: space-between; flex-wrap: wrap; }
.review-label { font-weight: 600; color: #333; padding-right: 10px; flex-shrink: 0; }
.review-value { text-align: right; word-break: break-word; flex-grow: 1; }

/* Links y resultados */
.register-info { text-align: center; font-size: 14px; color: #666; line-height: 1.4; }
.register-link { color: #4a90e2; text-decoration: none; font-weight: 500; }
.register-link:hover { text-decoration: underline; }
.top-prompt {
    width: 100%;
    max-width: 600px; 
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    text-align: center;
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, margin 0.3s, padding 0.3s;
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
}
.top-prompt.hidden {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    border: none;
    overflow: hidden;
}

#password-result, #recovery-result { display: none; margin-top: 20px; padding: 15px; background-color: #e8f5e8; border-radius: 4px; border: 1px solid #c8e6c9; }
#password-result p, #recovery-result p { margin: 0; font-weight: 500; color: #2c3e50; font-size: 15px; line-height: 1.4; }
#password-result .info-text { margin: 10px 0 0 0; font-size: 13px; color: #555; text-align: center; }
#generated-username, #generated-password, .recovered-credential { font-size: 16px; letter-spacing: 1px; word-break: break-all; padding: 4px 8px; background-color: rgba(255,255,255,0.7); border-radius: 3px; display: inline-block; }
.recovery-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.credential-container { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.credential-container:last-of-type { margin-bottom: 0; }
.credential-container p { margin: 0; text-align: left; flex-grow: 1; word-break: break-all; }
.btn-copy { background-color: #f0f0f0; border: 1px solid #ddd; color: #555; border-radius: 4px; padding: 6px 10px; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.btn-copy:hover { background-color: #e0e0e0; border-color: #ccc; }
.btn-copy:disabled { background-color: #4CAF50; color: white; border-color: #4CAF50; }
.btn-copy i { font-size: 14px; pointer-events: none; }

/* Modales */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.modal-content { background-color: white; padding: 30px 40px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); text-align: center; position: relative; max-width: 500px; width: 100%; animation: fadeIn 0.3s ease-out; }
.modal-close { position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; color: #aaa; background: none; border: none; cursor: pointer; line-height: 1; z-index: 10; }
.modal-close:hover { color: #333; }
.modal-logo { max-width: 150px; height: auto; margin-bottom: 20px; }
.modal-content h2 { font-size: 22px; color: #2c3e50; margin-bottom: 15px; font-weight: 600; }
.modal-description { font-size: 16px; color: #555; line-height: 1.5; margin-bottom: 25px; }
.modal-version { font-size: 14px; color: #999; margin-top: 20px; }
.help-content-scroll { max-height: 60vh; overflow-y: auto; text-align: left; padding: 15px; margin-top: 15px; border-top: 1px solid #eee; background-color: #fcfcfc; border-radius: 4px; }
.help-content-scroll h3 { font-size: 18px; color: #333; margin-top: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.help-content-scroll h3:first-child { margin-top: 0; }
.help-content-scroll p { font-size: 15px; line-height: 1.6; margin-bottom: 15px; color: #555; padding-left: 26px; }
.help-content-scroll p strong { color: #000; font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }


/* Estilos Pantallas Setup */
.setup-screen { position: relative; width: 100%; max-width: 1300px; height: auto; margin: 20px 0; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); overflow: hidden; background-color: #f8f9fa; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; animation: fadeIn 0.3s ease-out; }
.setup-screen .modal-close { position: absolute; top: 15px; right: 25px; z-index: 10; color: #555; }
.setup-screen .modal-close:hover { color: #000; }
.setup-panel { display: flex; padding: 40px; position: relative; height: 80vh; max-height: 750px; min-height: 600px; }

/* Panel Izquierdo */
.setup-panel-left {
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    padding-bottom: 60px;
}
.setup-panel-left .logo-container { text-align: center; margin-bottom: 30px; }
.setup-logo { max-width: 300px; width: 100%; height: auto; transition: all 0.3s ease-in-out; }

/* Título */
.setup-title { font-size: 26px; font-weight: 600; color: #2c3e50; text-align: center; margin-bottom: 0; width: 100%; }

/* Panel Derecho */
.setup-panel-right {
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    flex-direction: column;
    align-items: center; 
    padding: 40px; 
    overflow-y: auto;
}
.setup-panel-right #register-form,
.setup-panel-right #reset-form { width: 100%; max-width: 600px; margin: 0 auto; }

/* Media Query Móvil */
@media (max-width: 900px) {
    .setup-screen { grid-template-columns: 1fr; margin: 10px 0; }
    .setup-panel-left { display: none; } 
    .setup-panel { height: auto; max-height: none; min-height: 0; padding: 20px; }
    .setup-panel-right { box-shadow: none; padding: 30px 20px; overflow-y: visible; }
    .setup-screen .modal-close { top: 10px; right: 15px; color: #333; }

    .setup-panel-right::before { 
        content: attr(data-title);
        display: block;
        font-size: 24px;
        font-weight: 600;
        color: #2c3e50;
        text-align: center;
        margin-bottom: 20px;
        order: -3; 
    }
     
     .setup-panel-right #register-form {
         display: flex;
         flex-direction: column;
     }
     #register-screen .form-stepper {
         display: flex; 
         order: -2; 
         margin-top: 0;
         margin-bottom: 25px;
         padding-bottom: 15px;
         border-bottom: 1px solid #eee;
         max-width: none;
     }
     .setup-panel-right .top-prompt {
        order: -1; 
     }
}
/* Ocultar en desktop */
@media (min-width: 901px) {
    .setup-panel-right::before { content: none; display: none; }
    .setup-panel-right .form-stepper { display: none; } 
}

/* Media Queries Responsividad General */
@media (max-width: 768px) { .top-bar { flex-direction: column; gap: 12px; padding: 10px 15px; min-height: auto; } .top-bar-left-group { width: 100%; justify-content: center; order: -1; gap: 10px; } .top-bar-title { font-size: 18px; text-align: center; } .action-buttons { width: 100%; justify-content: center; gap: 10px; } .nav-button-group { justify-content: center; width: 100%; } .navbar-login { flex-direction: column; width: 100%; max-width: 300px; margin: 0 auto; } .nav-form-control { width: 100%; } .navbar-login .btn-action { width: 100%; justify-content: center; } .btn-action-secondary { text-align: center; width: 100%; padding: 10px 0; margin-left: 0; } .content-area { padding: 15px; align-items: flex-start; } }
@media (max-width: 480px) { #password-result, #recovery-result { padding: 12px; } #generated-username, #generated-password, .recovered-credential { font-size: 14px; } }

/* --- NUEVOS ESTILOS PARA PROMEDIO --- */
.promedio-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.promedio-dot {
    font-size: 24px;
    font-weight: 600;
    color: #555;
    padding: 0 4px;
}

.promedio-select-entero {
    flex-basis: 60%;
}
.promedio-select-decimal {
    flex-basis: 40%;
}
/* --- FIN ESTILOS PROMEDIO --- */


/* ===== NUEVO: Animación para resaltar campos de login ===== */

/* Define la animación de "pulso" (grande y chico) y el contorno rojo */
@keyframes pulse-red-highlight {
    0% {
        /* Estado inicial: normal */
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); /* Sombra roja (contorno) */
        border-color: #e74c3c; /* Borde rojo */
    }
    50% {
        /* Mitad de la animación: más grande */
        transform: scale(1.05); /* Ligeramente más grande */
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); /* El "contorno" se desvanece */
    }
    100% {
        /* Estado final: vuelve a la normalidad */
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
        border-color: #e74c3c;
    }
}

/* La clase que aplicaremos con JavaScript */
.highlight-login-field {
    /* Usamos !important para sobreescribir cualquier otro estilo de borde/foco temporalmente */
    border-color: #e74c3c !important; 
    
    /* Aplica la animación:
      - pulse-red-highlight: nombre de la animación
      - 1.2s: duración de un ciclo
      - ease-in-out: tipo de transición
      - 2: número de repeticiones (para que pulse dos veces)
    */
    animation: pulse-red-highlight 1.2s ease-in-out 2;
}