/* ═══════════════════════════════════════════════════════════════
   SIMULADOR ACADÉMICO — Examen Único de Residencias Médicas
   style.css  |  Paleta institucional, tipografía serif académica
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300&family=Source+Sans+3:wght@400;500;600&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --navy:           #1B2B4B;
  --navy-dark:      #0F1C33;
  --navy-mid:       #243560;
  --slate:          #3D5278;
  --sky:            #3D7EBF;
  --sky-light:      #EBF3FB;
  --sky-border:     #B8D6EF;
  --teal:           #1A7A6E;
  --teal-light:     #E5F3F1;
  --teal-border:    #9DCFC9;

  --bg:             #ECEEF2;
  --surface:        #FFFFFF;
  --surface-alt:    #F6F7F9;
  --border:         #D1D7E0;
  --border-strong:  #B0BAC9;

  --text-primary:   #1B2B4B;
  --text-secondary: #445069;
  --text-muted:     #7E8FA8;
  --text-inverse:   #FFFFFF;

  --correct:        #1A7A6E;
  --correct-bg:     #E5F3F1;
  --correct-border: #9DCFC9;
  --wrong:          #9E2020;
  --wrong-bg:       #FAEAEA;
  --wrong-border:   #E5AAAA;

  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-sans:  'Source Sans 3', system-ui, sans-serif;

  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  22px;

  --shadow-sm: 0 1px 3px rgba(15,28,51,.07), 0 1px 2px rgba(15,28,51,.05);
  --shadow-md: 0 2px 8px rgba(15,28,51,.08), 0 1px 3px rgba(15,28,51,.06);
  --shadow-lg: 0 4px 20px rgba(15,28,51,.10), 0 2px 6px rgba(15,28,51,.06);

  --ease: cubic-bezier(.4,0,.2,1);
  --trans: 160ms var(--ease);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header institucional ───────────────────────────────────── */
.site-header {
  background: var(--navy-dark);
  border-bottom: 3px solid var(--sky);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Cruz médica SVG */
.brand-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--sky);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-icon svg { width: 18px; height: 18px; fill: #fff; }

.brand-text {}
.brand-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  line-height: 1.2;
}
.brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}
.timer-icon {
  width: 15px; height: 15px;
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.timer-icon::after {
  content: '';
  position: absolute;
  top: 2px; left: 6px;
  width: 1.5px; height: 5px;
  background: rgba(255,255,255,.6);
  transform-origin: bottom;
}

.counter-wrap {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
}
.counter-wrap strong {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

/* ── Barra de progreso (debajo del header) ──────────────────── */
.progress-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,.12);
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sky) 0%, #62B8F0 100%);
  transition: width .6s var(--ease);
  border-radius: 0 2px 2px 0;
  width: 0%;
}

/* ── Layout principal ───────────────────────────────────────── */
main {
  flex: 1;
  padding: 32px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Card del examen ────────────────────────────────────────── */
.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 820px;
  overflow: hidden;
  animation: cardIn .3s var(--ease) both;
}

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

/* Franja azul superior de la card */
.card-stripe {
  background: var(--navy);
  padding: 18px 32px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-tag {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.1);
}
.meta-tag.materia {
  background: var(--sky);
  border-color: var(--sky);
  color: #fff;
}
.meta-tag.dificultad-básico      { background: rgba(26,122,110,.6); border-color: var(--teal-border); }
.meta-tag.dificultad-intermedio  { background: rgba(61,126,191,.5); border-color: var(--sky-border); }
.meta-tag.dificultad-avanzado    { background: rgba(158,32,32,.5);  border-color: var(--wrong-border); }

.card-num {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 300;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-num strong { color: #fff; font-weight: 400; }

/* ── Cuerpo de la card ──────────────────────────────────────── */
.card-body {
  padding: 32px 36px 28px;
}

/* Enunciado */
.enunciado {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 28px;
}

/* Separador */
.card-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 24px;
}

/* ── Opciones ───────────────────────────────────────────────── */
.opciones {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opcion {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  transition:
    border-color var(--trans),
    background var(--trans),
    box-shadow var(--trans),
    transform var(--trans);
  position: relative;
}

.opcion:hover {
  border-color: var(--sky);
  background: var(--sky-light);
  box-shadow: inset 3px 0 0 var(--sky), var(--shadow-sm);
  transform: translateX(2px);
}

.opcion:focus-visible {
  outline: 2.5px solid var(--sky);
  outline-offset: 2px;
}

.opcion:active { transform: translateX(1px) scale(.995); }

/* Círculo con la letra */
.opcion-letra {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  letter-spacing: 0;
  transition: all var(--trans);
  margin-top: 1px;
}

.opcion:hover .opcion-letra {
  border-color: var(--sky);
  color: var(--sky);
}

.opcion-texto { flex: 1; }

/* Estado seleccionada (antes de confirmar) */
.opcion.seleccionada {
  border-color: var(--sky);
  background: var(--sky-light);
  box-shadow: inset 3px 0 0 var(--sky);
  transform: none;
}
.opcion.seleccionada .opcion-letra {
  background: var(--sky);
  border-color: var(--sky);
  color: #fff;
}

/* Estado correcta */
.opcion.correcta {
  border-color: var(--correct);
  background: var(--correct-bg);
  box-shadow: inset 3px 0 0 var(--correct);
  transform: none;
}
.opcion.correcta .opcion-letra {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}
.opcion.correcta .opcion-texto::after {
  content: ' ✓';
  font-weight: 600;
  color: var(--correct);
}

/* Estado incorrecta */
.opcion.incorrecta {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  box-shadow: inset 3px 0 0 var(--wrong);
  transform: none;
}
.opcion.incorrecta .opcion-letra {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
}
.opcion.incorrecta .opcion-texto::after {
  content: ' ✗';
  font-weight: 600;
  color: var(--wrong);
}

/* Bloquear después de responder */
.opciones.respondido .opcion {
  cursor: default;
  pointer-events: none;
}
.opciones.respondido .opcion:not(.correcta):not(.incorrecta):not(.seleccionada) {
  opacity: .45;
}

/* ── Justificación ──────────────────────────────────────────── */
.justificacion {
  display: none;
  margin-top: 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--sky-border);
  background: var(--sky-light);
  overflow: hidden;
  animation: fadeUp .28s var(--ease) both;
}
.justificacion.visible { display: block; }

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

.just-header {
  background: var(--navy);
  padding: 8px 18px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 7px;
}
.just-header::before {
  content: '';
  display: inline-block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--sky);
}

.just-body {
  padding: 16px 18px 14px;
}
.just-texto {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.just-fuente {
  margin-top: 10px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--sky-border);
}

/* ── Footer de la card ──────────────────────────────────────── */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 36px 28px;
  border-top: 1px solid var(--border);
}

.btn-omitir {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  transition: color var(--trans);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: color var(--trans), text-decoration-color var(--trans);
}
.btn-omitir:hover {
  color: var(--text-secondary);
  text-decoration-color: var(--border-strong);
}

.btn-siguiente {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: var(--r-md);
  padding: 13px 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans), opacity var(--trans);

  /* Deshabilitado por defecto: se activa al seleccionar opción */
  opacity: .4;
  pointer-events: none;
}

.btn-siguiente.activo {
  opacity: 1;
  pointer-events: auto;
}

.btn-siguiente.activo:hover {
  background: var(--sky);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(61,126,191,.4);
}

.btn-siguiente.activo:active { transform: translateY(0); box-shadow: none; }

.btn-siguiente:focus-visible {
  outline: 2.5px solid var(--sky);
  outline-offset: 3px;
}

.btn-arrow {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--trans);
}
.btn-siguiente.activo:hover .btn-arrow { transform: translateX(3px); }

/* ── Dots de progreso ───────────────────────────────────────── */
.progress-dots-wrap {
  max-width: 820px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}

.dots-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.dots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  transition: background var(--trans), transform var(--trans), border-color var(--trans);
}
.dot.actual   { background: var(--sky);     border-color: var(--sky);     transform: scale(1.4); }
.dot.ok       { background: var(--correct); border-color: var(--correct); }
.dot.mal      { background: var(--wrong);   border-color: var(--wrong); }
.dot.omitida  { background: var(--text-muted); border-color: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .card-stripe  { padding: 14px 20px; }
  .card-body    { padding: 24px 20px 20px; }
  .card-footer  { padding: 16px 20px 22px; flex-direction: column; align-items: stretch; }
  .btn-siguiente { justify-content: center; }
  .btn-omitir   { text-align: center; }
  .enunciado    { font-size: 16px; }
  .opcion       { font-size: 14px; padding: 13px 14px; }
  .header-inner { height: 52px; }
  .brand-subtitle { display: none; }
}

@media (max-width: 400px) {
  .header-meta  { gap: 12px; }
  .counter-wrap { display: none; }
}
