/*! =============================================================================
 *  © 2026 Renzo Núñez · RonBStudio — "Perú Elige 2026 · Segunda Vuelta".
 *  Todos los derechos reservados. Código propietario.
 *  https://www.ronbstudio.com
 * ============================================================================= */
/* =============================================================================
 *  Archivo: dash-nav.css
 *  Menú de navegación de secciones (cuadros) del dashboard.
 *  PC: barra sticky de pills con scroll-spy (resalta la sección activa).
 *  Móvil: FAB "Secciones" → hoja inferior (bottom sheet) con la lista.
 *  + badge "NUEVO" y toast de promoción de features. Cero impacto en el worker.
 * ===========================================================================*/

/* Offset para que los anclajes caigan bajo el header sticky + la barra. Lo
   computa dash-nav.js (--dnav-top, --dnav-scrollpad) según el alto real. */
html { scroll-padding-top: var(--dnav-scrollpad, 72px); }

/* ============================ PC: barra de pills =========================== */
.dnav {
  position: sticky;
  top: var(--dnav-top, 56px);
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-mv-card-border, #e2e8f0);
}
.dnav__inner {
  max-width: var(--container-max, 1100px);
  margin: 0 auto;
  padding: 0.4rem var(--container-padding, 1rem);
}
.dnav__pills {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}
.dnav__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-mv-ink-muted, #64748b);
  text-decoration: none;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dnav__pill:hover {
  color: var(--c-mv-card-title, #2c5599);
  background: rgba(44, 85, 153, 0.08);
}
.dnav__pill.is-active {
  color: #ffffff;
  background: var(--c-mv-card-title, #2c5599);
  border-color: var(--c-mv-card-title, #2c5599);
}

/* Badge "NUEVO" */
.dnav__badge {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  background: #e8590c;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
  line-height: 1.5;
}
.dnav__pill.is-active .dnav__badge { background: #ffffff; color: var(--c-mv-card-title, #2c5599); }

/* FAB + sheet ocultos en PC */
.dnav__fab,
.dnav__backdrop,
.dnav__sheet { display: none; }

/* ============================ Móvil: FAB + sheet ========================== */
@media (max-width: 759px) {
  .dnav { display: none; }

  /* Hamburguesa: botón circular abajo-IZQUIERDA (icono solo). */
  .dnav__fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    width: 50px;
    height: 50px;
    color: #ffffff;
    background: var(--c-mv-card-title, #2c5599);
    border: none;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.32);
    cursor: pointer;
  }
  .dnav__fab:active { transform: scale(0.94); }
  .dnav__fab-ic { font-size: 1.55rem; line-height: 1; }

  .dnav__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .dnav__backdrop.is-open { opacity: 1; pointer-events: auto; }

  .dnav__sheet {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 80;
    background: var(--c-mv-bg-card, #ffffff);
    border-radius: 18px 18px 0 0;
    padding: 0.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.25);
    transform: translateY(101%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    max-height: 72vh;
    overflow-y: auto;
  }
  .dnav__sheet.is-open { transform: translateY(0); }

  .dnav__sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.4rem 0.3rem;
  }
  .dnav__sheet-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 800; font-size: 0.95rem;
    color: var(--c-mv-card-title, #2c5599);
  }
  .dnav__sheet-close {
    background: none; border: none; font-size: 1.15rem;
    color: var(--c-mv-ink-muted, #64748b); cursor: pointer; padding: 0.2rem 0.45rem;
  }
  .dnav__sheet-list { display: flex; flex-direction: column; }
  .dnav__sheet-item {
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%; text-align: left;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.98rem; font-weight: 600;
    color: var(--c-mv-ink, #1e293b);
    background: none; border: none;
    border-top: 1px solid var(--c-mv-card-border, #e2e8f0);
    padding: 0.85rem 0.5rem; cursor: pointer;
  }
  .dnav__sheet-item:first-child { border-top: none; }
  .dnav__sheet-item.is-active { color: var(--c-mv-card-title, #2c5599); font-weight: 800; }
  .dnav__sheet-item:active { background: rgba(44, 85, 153, 0.08); }
}

/* ================================ Toast =================================== */
.dnav-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 160%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(92vw, 440px);
  background: var(--c-mv-card-title, #2c5599);
  color: #ffffff;
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  box-shadow: 0 10px 34px rgba(15, 23, 42, 0.35);
  font-family: 'Inter', system-ui, sans-serif;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.dnav-toast.is-in { transform: translate(-50%, 0); }
.dnav-toast__ic { font-size: 1.3rem; line-height: 1; }
.dnav-toast__txt { display: flex; flex-direction: column; line-height: 1.22; }
.dnav-toast__txt strong { font-size: 0.92rem; }
.dnav-toast__sub { font-size: 0.74rem; opacity: 0.85; }
.dnav-toast__cta {
  flex: 0 0 auto;
  background: #ffffff;
  color: var(--c-mv-card-title, #2c5599);
  border: none; border-radius: 999px;
  font-weight: 800; font-size: 0.82rem;
  padding: 0.4rem 0.9rem; cursor: pointer;
}
.dnav-toast__x {
  flex: 0 0 auto; background: none; border: none;
  color: rgba(255, 255, 255, 0.8); font-size: 1rem; cursor: pointer; padding: 0.2rem;
}
@media (max-width: 759px) {
  .dnav-toast { bottom: 78px; }   /* por encima del FAB */
}

@media (prefers-reduced-motion: reduce) {
  .dnav__sheet, .dnav__backdrop, .dnav-toast, .dnav__pill { transition: none; }
}
