/* ════════════ NAVBAR COMPARTIDA ════════════
   Estilos comunes a todas las páginas (portal y simulacro). Estructura canónica:
   <nav class="navbar">
     <div class="nav-inner">
       <div class="nav-logo">
         <div class="nav-logo-pill"><img class="sed-logo" ...></div>
       </div>
       <!-- Contenido específico de cada página (links, acciones contextuales, etc.) -->
       <span class="training-pill">...</span>
       <!-- .a11y-toolbar inyectada por a11y.js -->
       <!-- .nav-hamburger sólo en portal -->
     </div>
     <!-- .nav-mobile-menu sólo en portal -->
   </nav>
   Estilos específicos de cada página viven en portal.css o exam.css. -- */

.navbar {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
  /* Linea sutil de borde inferior dorada para refinar la separación */
  border-bottom: 1px solid rgba(232,160,32,.18);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  /* No wrap: si algo se desborda, el responsive lo colapsa con hamburguesa */
  flex-wrap: nowrap;
}
.nav-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0 }
.nav-logo-pill {
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  height: 40px;
  flex-shrink: 0;
  transition: transform .2s;
}
.nav-logo-pill:hover { transform: translateY(-1px); }
.nav-logo-pill .sed-logo { height: 28px; width: auto; display: block }
.nav-logo a.logo-link { display: flex; align-items: center; text-decoration: none }

/* Espaciador flex para empujar los items secundarios a la derecha */
.nav-spacer { flex: 1 1 auto; min-width: 0; }

/* Bloque agrupador de acciones a la derecha (pill + a11y + perfil + hamburguesa) */
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Toolbar de accesibilidad (botón cíclico A + toggle 🌙/🔆) ── */
.a11y-toolbar {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px; margin-left: 6px;
  background: rgba(255,255,255,0.08); border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18)
}
.a11y-btn {
  background: transparent; border: none; color: rgba(255,255,255,0.85);
  width: 28px; height: 28px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 800; line-height: 1;
  transition: all .18s ease; font-size: 0.875rem; padding: 0
}
.a11y-btn:hover { background: rgba(255,255,255,0.14); color: #fff }
.a11y-btn.is-active { background: var(--accent); color: var(--primary) }
.a11y-font-letter { display: inline-block; line-height: 1 }
.a11y-btn.a11y-font-cycle { flex-direction: column; width: 36px; gap: 2px; padding: 2px 4px; border-radius: 14px }
.a11y-font-cycle .a11y-font-letter { font-size: 0.875rem; font-weight: 900 }
.a11y-font-dots { display: inline-flex; gap: 3px; align-items: center; height: 5px }
.a11y-font-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.35); transition: all .18s ease }
.a11y-font-dot.is-active { width: 6px; height: 6px; background: var(--accent); box-shadow: 0 0 0 1px rgba(255,255,255,.35) }

/* ── Modo oscuro ── */
[data-theme="dark"] .navbar { background: #0c1424; border-bottom: 1px solid var(--border) }
[data-theme="dark"] .a11y-toolbar { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12) }
[data-theme="dark"] .a11y-btn.is-active { background: var(--accent); color: #0f172a }

/* ════════════ RESPONSIVE PROGRESIVO ════════════
   Estrategia: en lugar de un solo salto desktop→móvil, vamos colapsando los
   elementos secundarios en cascada para que el navbar nunca se vea apretado:

   ≥ 1024 px   layout completo, espaciados generosos
   < 900 px    nav-links se colapsan al menú hamburguesa (portal.css)
               nav-feedback-btn oculta (entra al hamburguesa)
   < 760 px    nav-profile-btn solo icono
   < 560 px    logo y a11y se compactan, paddings mínimos
*/
@media (max-width: 1023px) {
  .nav-inner { padding: 10px 16px; gap: 8px }
}

@media (max-width: 759px) {
  .nav-inner { padding: 9px 14px; gap: 7px }
  .a11y-toolbar { gap: 2px; padding: 3px 4px; margin-left: 2px }
  .a11y-btn { width: 26px; height: 26px; font-size: 0.8125rem }
  .a11y-btn.a11y-font-cycle { width: 32px; height: 26px }
  .a11y-font-cycle .a11y-font-letter { font-size: 0.8125rem }
}

@media (max-width: 559px) {
  .nav-inner { padding: 8px 12px; gap: 6px }
  .nav-logo-pill { padding: 3px 7px; height: 32px; border-radius: 7px }
  .nav-logo-pill .sed-logo { height: 22px }
}

@media (max-width: 419px) {
  .nav-inner { padding: 7px 10px; gap: 4px }
  .nav-logo-pill { padding: 2px 6px; height: 28px; border-radius: 6px }
  .nav-logo-pill .sed-logo { height: 19px }
  .a11y-toolbar { gap: 1px; padding: 2px 3px; margin-left: 0; border-radius: 12px }
  .a11y-btn { width: 24px; height: 24px; font-size: 0.75rem }
  .a11y-btn.a11y-font-cycle { width: 30px; height: 24px; padding: 1px 3px }
  .a11y-font-cycle .a11y-font-letter { font-size: 0.75rem }
  .a11y-font-dot { width: 3px; height: 3px }
  .a11y-font-dot.is-active { width: 5px; height: 5px }
}

/* ════════════ BANNER DE ACTUALIZACIÓN DEL SERVICE WORKER ════════════
   Aparece sticky en la parte inferior cuando shared/js/sw-update.js detecta un
   nuevo SW en estado "installed" con uno previo controlando. Click "Recargar"
   dispara skipWaiting + recarga automática. Visible sobre cualquier pantalla
   (portal o simulacro) excepto durante un intento activo (s-question), gateado
   en exam.js. */
.update-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: 2px solid #b45309;
  border-radius: 14px;
  color: #451a03;
  font-family: 'Nunito', sans-serif;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 10px 32px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.4) inset;
  animation: update-banner-slide-up .35s ease-out;
}
@keyframes update-banner-slide-up {
  from { opacity: 0; transform: translate(-50%, 20px) }
  to   { opacity: 1; transform: translate(-50%, 0)    }
}
.update-banner-icon { font-size: 1.25rem; flex-shrink: 0 }
.update-banner-text { color: #451a03; flex: 1; min-width: 160px }
.update-banner-text strong { color: #451a03 }
.update-banner-btn {
  background: #1a3a5c;
  color: #fde68a;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8125rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.update-banner-btn:hover { background: #254f7a; transform: translateY(-1px) }
.update-banner-btn:disabled { opacity: .7; cursor: not-allowed; transform: none }
.update-banner-dismiss {
  width: 26px;
  height: 26px;
  background: rgba(255,255,255,.55);
  border: none;
  border-radius: 50%;
  color: #451a03;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.update-banner-dismiss:hover { background: #fff }

[data-theme="dark"] .update-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #fde68a;
  color: #1c1917;
  box-shadow: 0 10px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(253,230,138,.5) inset;
}
[data-theme="dark"] .update-banner-text,
[data-theme="dark"] .update-banner-text strong { color: #1c1917 }

@media (max-width: 560px) {
  .update-banner {
    left: 12px; right: 12px;
    max-width: none;
    transform: none;
    bottom: 12px;
    padding: 10px 12px;
    font-size: 0.8125rem;
    flex-wrap: wrap;
  }
  @keyframes update-banner-slide-up {
    from { opacity: 0; transform: translateY(20px) }
    to   { opacity: 1; transform: translateY(0)    }
  }
  .update-banner-text { width: 100%; flex-basis: 100% }
  .update-banner-btn { flex: 1; justify-content: center; text-align: center; padding: 9px 14px }
}


/* ════════════════════════════════════════════════════════════════════
   Botón "Sugerencias" del navbar (desde 0.11.0). Compartido entre
   portal e simulacro. La regla que lo oculta en mobile en favor del
   menú hamburguesa vive en portal.css (es específica de la SPA portal);
   en simulacro el botón se ve siempre, encogiéndose a icono en pantallas
   estrechas.
   ═════════════════════════════════════════════════════════════════════ */
.nav-feedback-btn {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   background: rgba(255,255,255,.08);
   border: 1.5px solid rgba(255,255,255,.2);
   color: #fff;
   border-radius: 999px;
   padding: 6px 14px;
   font-family: 'Nunito', sans-serif;
   font-size: 0.8125rem;
   font-weight: 700;
   cursor: pointer;
   transition: all .18s;
   white-space: nowrap;
   text-decoration: none;
   position: relative;
}
.nav-feedback-btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4) }
.nav-feedback-btn svg { flex-shrink: 0 }

.nav-badge {
   position: absolute;
   top: -4px; right: -6px;
   min-width: 18px; height: 18px;
   padding: 0 5px;
   border-radius: 9px;
   background: #dc2626;
   color: #fff;
   font-size: 11px;
   font-weight: 700;
   line-height: 18px;
   text-align: center;
}
.nav-dot {
   display: inline-block;
   width: 8px; height: 8px;
   border-radius: 50%;
   background: #dc2626;
   margin-left: 6px;
   vertical-align: middle;
}

/* En simulacro y otras pantallas estrechas, ocultar la etiqueta — quedando
   solo el icono + badge. En portal usa otra estrategia (hamburguesa). */
@media (max-width: 559px) {
  .nav-feedback-btn .nav-feedback-btn-label { display: none }
  .nav-feedback-btn { padding: 6px 10px }
}
