/* ===== ESTILOS PARA LA PÁGINA DEL EXAMEN ===== */

/* --- Estructura principal --- */
.exam-main {
  padding: 3.50rem 1rem 2rem;
  margin-top: 0;
  min-height: calc(100vh - 70px);
  background-color: var(--background-accent);
}



.exam-container {
  display: grid;
  grid-template-areas: 
    "questions navigation"
    "controls navigation"
    "actions navigation";
  grid-template-columns: 1fr 250px;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

#bloques-examen {
  grid-area: questions;
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius-medium);
  box-shadow: var(--shadow-medium);
}

.exam-controls {
  grid-area: controls;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--white);
  border-radius: var(--border-radius-medium);
  box-shadow: var(--shadow-medium);
}

.exam-actions {
  grid-area: actions;
  text-align: center;
  margin-top: 1rem;
}

.exam-nav-grid {
  grid-area: navigation;
  position: sticky;
  top: 90px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--border-radius-medium);
  box-shadow: var(--shadow-medium);
}

/* --- Estilos de preguntas --- */
.exam-page {
  display: none;
}

.exam-page.active {
  display: block;
  animation: fadeIn 0.3s ease-out forwards;
}

.titulo-bloque {
  font-size: 1.25rem;
  color: var(--dark-text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.exam-question {
  margin-bottom: 2.5rem;
}

.exam-question h4 {
  font-size: 1.2rem;
  color: var(--dark-text);
  margin-bottom: 1rem;
}

.exam-text {
  margin-bottom: 1.5rem;
  color: var(--medium-text);
}

/* --- Opciones de respuesta --- */
.form-opciones {
  margin-bottom: 1.5rem;
}

.form-opciones label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: background-color 0.2s;
}

.form-opciones label:hover {
  background-color: rgba(52, 152, 219, 0.05); /* Usando el valor RGB de --primary */
}

.form-opciones input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 20px;
  height: 20px;
  flex-shrink: 0;      /* nunca se achica */
  border: 2px solid #555;
  border-radius: 3px;
  background-color: #fff;
  display: inline-flex;   /* centra el ✔ siempre igual */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.2s, border-color 0.2s;
}

.form-opciones input[type="radio"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-opciones input[type="radio"]:checked::after {
  content: "✔";
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}




/* --- Botón Marcar --- */
.btn-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--warning);
  color: var(--dark-text);
  border: none;
  border-radius: var(--border-radius-small);
  font-weight: 500;
  transition: var(--transition-medium);
}

.btn-mark:hover {
  background-color: #e0a800; /* Color manual si no hay variable */
}

/* --- Imágenes responsivas --- */
.pregunta-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border-radius: var(--border-radius-small);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Navegación lateral --- */
.nav-grid-title {
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--dark-text);
}

.nav-btn-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.nav-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #475569;
  background-color: var(--white);
  color: #475569;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-medium);
}

.nav-btn:hover {
  background-color: #f1f5f9;
  border-color: #334155;
  color: #334155;
}

/* Pregunta actual: oscuro suave, no negro fuerte */
.nav-btn.active {
  border-color: #64748b;
  background-color: #64748b;
  color: var(--white);
}

/* Respondida: verde */
.nav-btn.answered {
  border-color: #16a34a;
  background-color: #16a34a;
  color: var(--white);
}

/* Si es actual y respondida, se mantiene verde */
.nav-btn.active.answered {
  border-color: #16a34a;
  background-color: #16a34a;
  color: var(--white);
}

.nav-btn.marked {
  position: relative;
  border-color: var(--accent);
}

.nav-btn.marked::after {
  content: '!';
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  background: var(--accent);
  color: var(--white);
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Botones de control --- */
.btn-prev, .btn-next, .btn-submit {
  padding: 0.625rem 1.5rem;
  border-radius: var(--border-radius-small);
  font-weight: 600;
  transition: var(--transition-medium);
  border: none;
  cursor: pointer;
}

.btn-prev {
  background-color: var(--light-text);
  color: var(--white);
}

.btn-next {
  background-color: var(--primary);
  color: var(--white);
}

.btn-prev:hover {
  background-color: #5a6268;
}

.btn-next:hover {
  background-color: var(--primary-hover);
}

.btn-prev:disabled, .btn-next:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.question-counter {
  font-weight: 600;
  color: var(--medium-text);
}

.btn-submit {
  background-color: var(--danger);
  color: var(--white);
  font-size: 1rem;
  padding: 0.75rem 2rem;
}

.btn-submit:hover {
  background-color: #c82333;
}

/* --- Bloques de lectura --- */
.bloque-lectura {
  background-color: var(--background-accent);
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: var(--border-radius-small);
  margin-bottom: 1.5rem;
}

.lectura-titulo {
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: 0.75rem;
}

.lectura-texto {
  color: var(--medium-text);
  margin-bottom: 1rem;
}

/* --- Grupos de preguntas --- */
.exam-question[data-group] {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin-left: -1rem;
}

/* --- Cronómetro --- */
.exam-timer {
  position: sticky;
  top: 105px;
  z-index: 50;
  display: inline-block;
  margin: -0.25rem auto 0.75rem;
  padding: .45rem 1rem;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: 999px;
  box-shadow: var(--shadow-medium);
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  color: var(--dark-text);
  text-align: center;
  user-select: none;
  transition: all 0.3s ease;
}

.exam-timer::after {
  content: "";
  display: block;
  height: 4px;
  margin-top: 6px;
  width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary));
  opacity: .18;
  border-radius: 999px;
  transition: all 0.3s ease;
}

.exam-timer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.1);
}

/* Estados del cronómetro */
.exam-timer.timer-normal {
  background: var(--white);
  border-color: var(--primary);
  color: var(--dark-text);
}

.exam-timer.timer-normal::after {
  background: linear-gradient(90deg, var(--primary), var(--primary));
  opacity: .18;
}

.exam-timer.timer-warning {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #f59e0b;
  color: #92400e;
  animation: pulse-warning 2s ease-in-out infinite;
}

.exam-timer.timer-warning::after {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  opacity: .4;
}

.exam-timer.timer-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
  color: #991b1b;
  animation: pulse-danger 1s ease-in-out infinite;
}

.exam-timer.timer-danger::after {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  opacity: .5;
}

@keyframes pulse-warning {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  }
}

@keyframes pulse-danger {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.6);
  }
}


.pregunta-num {
  display: inline-flex;            /* centra el número */
  align-items: center;
  justify-content: center;
  background: #e0e0e0;             /* gris más suave */
  color: #333;                     /* texto más oscuro */
  width: 32px;                     /* cuadradito uniforme */
  height: 32px;
  border-radius: 4px;              /* menos redondeado, más estilo examen */
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 8px;              /* separación con el enunciado */
  box-shadow: inset 0 1px 1px #fff, 0 1px 2px rgba(0,0,0,.1);
}


/* --- Responsive --- */
@media (max-width: 992px) {
  .exam-container {
    grid-template-areas: 
      "navigation"
      "questions"
      "controls"
      "actions";
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .exam-nav-grid {
    position: static;
    height: auto;
    order: 1;
  }
  
  .nav-btn-container {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  }
  
  .exam-controls {
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-bottom: 0;
  }

  .exam-main {
    padding: 2.5rem 1rem 1.5rem;
  }
}

@media (max-width: 576px) {
  .exam-main {
    padding: 1.75rem 0 1rem;
  }
  
  #bloques-examen {
    padding: 1.5rem;
  }
  
  .nav-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  .btn-prev, .btn-next {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .question-counter {
    font-size: 0.875rem;
  }

  #barra-info-simulacro,
  #barra-info-examen {
    margin: 0 auto 0.95rem;
  }

}


/* --- Barra info simulacro --- */
#barra-info-simulacro,
#barra-info-examen {
  position: relative; /* ← cambia sticky por relative */
  top: auto;          /* ← quita el top */
  z-index: 49;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 6px 16px;
  margin: 0 auto 1.1rem;
  width: fit-content;
  max-width: 90%;
  font-size: 13px;
  color: #0c4a6e;
}

.info-sim-titulo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-sim-codigo {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

@media (max-width: 576px) {
  #barra-info-simulacro {
    border-radius: 8px;
    padding: 6px 12px;
    max-width: 100%;
    font-size: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .info-sim-titulo {
    max-width: 100%;
  }
}

/* ==============================
   MODAL RESULTADOS EXAMEN
============================== */
.resultado-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.resultado-modal.is-open {
  display: flex;
}

.resultado-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
}

.resultado-modal-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  padding: 28px;
  z-index: 1;
}

.resultado-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.25s ease;
}

.resultado-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.resultado-modal-header {
  padding-right: 40px;
  margin-bottom: 22px;
}

.resultado-modal-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.resultado-modal-header h3 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  color: #0f172a;
  line-height: 1.2;
}

.resultado-modal-resumen {
  margin: 0;
  color: #475569;
  font-size: 0.98rem;
  line-height: 1.6;
}

.resultado-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.resultado-kpi {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
}

.resultado-kpi-label {
  display: block;
  font-size: 0.86rem;
  color: #64748b;
  margin-bottom: 8px;
}

.resultado-kpi strong {
  font-size: 1.45rem;
  color: #0f172a;
  font-weight: 800;
}

.resultado-barra {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}

.resultado-barra-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb 0%, #16a34a 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.resultado-mensaje {
  border-radius: 14px;
  padding: 16px 18px;
  line-height: 1.65;
  font-size: 0.95rem;
}

.resultado-mensaje + .resultado-mensaje {
  margin-top: 12px;
}

.resultado-mensaje-top {
  background: #f8fafc;
  border: 1px solid #dbeafe;
  color: #1e293b;
  margin-bottom: 12px;
}

.resultado-mensaje-meta {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #334155;
}

.resultado-cta-box {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
}

.resultado-cta-box p {
  margin: 0;
  color: #1e3a8a;
  line-height: 1.65;
  font-weight: 500;
}

.resultado-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.resultado-btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.25s ease;
}

.resultado-btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.resultado-btn-primary:hover {
  background: #1d4ed8;
}

.resultado-btn-secondary {
  background: #0f172a;
  color: #ffffff;
}

.resultado-btn-secondary:hover {
  background: #1e293b;
}

.resultado-btn-light {
  background: #f1f5f9;
  color: #334155;
}

.resultado-btn-light:hover {
  background: #e2e8f0;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .resultado-modal {
    padding: 12px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .resultado-modal-dialog {
    width: 100%;
    margin: 0;
    max-height: none;
    min-height: auto;
    border-radius: 16px;
    padding: 20px 16px;
    overflow: visible;
  }

  .resultado-modal-body {
    overflow: visible;
  }

  .resultado-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .resultado-modal-header h3 {
    font-size: 1.35rem;
  }

  .resultado-kpi strong {
    font-size: 1.2rem;
  }

  .resultado-modal-footer {
    flex-direction: column;
  }

  .resultado-btn {
    width: 100%;
  }
}


.resultado-kpi strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1.35rem;
  color: #0f172a;
  font-weight: 800;
  line-height: 1.2;
}

.resultado-kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.resultado-kpi-icon-success {
  background: #dcfce7;
  color: #15803d;
}

.resultado-kpi-icon-danger {
  background: #fee2e2;
  color: #dc2626;
}

.resultado-kpi-icon-muted {
  background: #e5e7eb;
  color: #6b7280;
}

.resultado-kpi-icon-primary {
  background: #dbeafe;
  color: #2563eb;
}

.resultado-kpi-value {
  display: inline-block;
}