/* ── Variables ──────────────────────────────────────────────── */
:root {
  --nl-bnav-acento:  #5b2a86;
  --nl-bnav-acento2: #7e3fb5;
  --nl-bnav-dark:    #1a1a2e;
  --nl-bnav-text:    #2d1a45;
  --nl-bnav-bg:      #ffffff;
  --nl-bnav-pastel:  #fdf9ff;
  --nl-bnav-border:  #ead9f7;
  --nl-bnav-h:       64px;
}

/* ── Solo en mobile/tablet (≤1024px) ─────────────────────── */
@media (min-width: 1025px) {
  .nl-bnav,
  .nl-bnav-sheet,
  .nl-bnav-backdrop { display: none !important; }
}

/* ── Espacio inferior del body ───────────────────────────── */
@media (max-width: 1024px) {
  body {
    padding-bottom: calc(var(--nl-bnav-h) + env(safe-area-inset-bottom)) !important;
  }
}

/* ── Barra ───────────────────────────────────────────────── */
.nl-bnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nl-bnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nl-bnav-bg);
  border-top: 1.5px solid var(--nl-bnav-border);
  display: flex;
  align-items: stretch;
  z-index: 10000;
  overflow: visible;
  box-shadow: 0 -2px 16px rgba(91, 42, 134, 0.09);
  transition: transform 220ms ease-in-out;
}

/* ── Compensar barra en overlays del sitio ───────────────── */
@media (max-width: 1024px) {
  /* Sidebar lateral (menú mobile) */
  .nl-sidebar__panel {
    padding-bottom: calc(var(--nl-bnav-h) + env(safe-area-inset-bottom) + 8px) !important;
  }
  /* Panel de resumen IA */
  .nl-resumen-modal__caja {
    padding-bottom: calc(var(--nl-bnav-h) + env(safe-area-inset-bottom) + 8px) !important;
  }
}

/* Reset agresivo — el tema puede meter estilos raros en a y button */
#nl-bottom-nav .nl-bnav-item,
#nl-bottom-nav .nl-bnav-item:link,
#nl-bottom-nav .nl-bnav-item:visited,
#nl-bottom-nav .nl-bnav-item:hover,
#nl-bottom-nav .nl-bnav-item:focus,
#nl-bottom-nav .nl-bnav-item:active {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  color: #999 !important;
  text-decoration: none !important;
}

/* Estado activo en púrpura */
#nl-bottom-nav .nl-bnav-item--active,
#nl-bottom-nav .nl-bnav-item--active:link,
#nl-bottom-nav .nl-bnav-item--active:visited,
#nl-bottom-nav .nl-bnav-item--active:hover,
#nl-bottom-nav .nl-bnav-item--active:focus {
  color: var(--nl-bnav-acento) !important;
}

/* Fondo suave en el ítem activo (excepto el central) */
#nl-bottom-nav .nl-bnav-item--active:not(.nl-bnav-item--center) {
  background: rgba(91, 42, 134, 0.09) !important;
}

/* Línea indicadora superior centrada */
#nl-bottom-nav .nl-bnav-item--active:not(.nl-bnav-item--center)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--nl-bnav-acento);
  border-radius: 0 0 4px 4px;
}

/* ── Items de la barra ───────────────────────────────────── */
.nl-bnav-item {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 2px;
  margin: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  text-decoration: none;
  color: #999;
  font-family: inherit;
  font-size: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  outline: none;
}

#nl-bottom-nav .nl-bnav-item:active {
  background: rgba(91, 42, 134, 0.07) !important;
  border-radius: 10px;
}

.nl-bnav-item .ti {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.nl-bnav-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
}

/* Estado activo */
.nl-bnav-item--active {
  color: var(--nl-bnav-acento) !important;
}
.nl-bnav-item--active .ti    { color: var(--nl-bnav-acento); }
.nl-bnav-item--active .nl-bnav-label { font-weight: 700; }

/* Focus visible accesible */
.nl-bnav-item:focus-visible {
  outline: 2px solid var(--nl-bnav-acento);
  outline-offset: -2px;
  border-radius: 8px;
}

/* ── Botón central ───────────────────────────────────────── */
.nl-bnav-item--center {
  flex: 1.1;
  overflow: visible;
  align-self: stretch;
  padding-bottom: 2px;
  color: var(--nl-bnav-dark);
}

.nl-bnav-center-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--nl-bnav-acento);
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(91, 42, 134, 0.38);
  margin-top: -16px;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.nl-bnav-item--center:hover .nl-bnav-center-icon,
.nl-bnav-item--center:focus-visible .nl-bnav-center-icon {
  transform: scale(1.07);
  box-shadow: 0 6px 20px rgba(91, 42, 134, 0.5);
}

.nl-bnav-item--center.nl-bnav-item--active .nl-bnav-center-icon {
  box-shadow: 0 0 0 3px rgba(91, 42, 134, 0.22), 0 4px 14px rgba(91, 42, 134, 0.38);
}

/* Favicon en el botón central */
.nl-bnav-center-icon--favicon {
  background: #fff;
  overflow: hidden;
  padding: 0;
}
.nl-bnav-center-icon--favicon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* ── Backdrop ────────────────────────────────────────────── */
.nl-bnav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 10, 46, 0.38);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.nl-bnav-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sheets (drawers) ────────────────────────────────────── */
.nl-bnav-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nl-bnav-bg);
  border-radius: 16px 16px 0 0;
  border-top: 2.5px solid var(--nl-bnav-acento);
  z-index: 10002;
  transform: translateY(100%);
  pointer-events: none;
  visibility: hidden;
  transition: transform 250ms ease-out, visibility 0s 250ms;
  /* deja espacio para la barra inferior */
  padding-bottom: calc(var(--nl-bnav-h) + env(safe-area-inset-bottom) + 8px);
}

.nl-bnav-sheet.is-open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: transform 250ms ease-out, visibility 0s 0s;
}

.nl-bnav-sheet-inner { padding: 14px 20px 20px; }

.nl-bnav-sheet-topbar {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  margin-bottom: 16px;
}

.nl-bnav-sheet-title {
  grid-column: 2;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin: 0;
  text-align: center;
}

/* Reset botón cerrar */
.nl-bnav-sheet button.nl-bnav-sheet-close,
.nl-bnav-sheet button.nl-bnav-sheet-close:hover,
.nl-bnav-sheet button.nl-bnav-sheet-close:focus,
.nl-bnav-sheet button.nl-bnav-sheet-close:active {
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
}

.nl-bnav-sheet-close {
  grid-column: 3;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none !important;
  background: var(--nl-bnav-border) !important;
  border-radius: 50% !important;
  cursor: pointer;
  color: var(--nl-bnav-dark) !important;
  padding: 0 !important;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nl-bnav-sheet-close:hover,
.nl-bnav-sheet-close:focus-visible {
  background: var(--nl-bnav-acento) !important;
  color: #fff !important;
}
.nl-bnav-sheet-close svg { display: block; stroke: currentColor; flex-shrink: 0; }

/* ── Grid de opciones del sheet ──────────────────────────── */
.nl-bnav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.nl-bnav-grid-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 8px;
  background: var(--nl-bnav-pastel);
  border-radius: 12px;
  border: 1.5px solid var(--nl-bnav-border);
  text-decoration: none;
  color: var(--nl-bnav-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.nl-bnav-grid-item .ti {
  font-size: 24px;
  color: var(--nl-bnav-acento);
  display: block;
}

.nl-bnav-grid-item:link,
.nl-bnav-grid-item:visited {
  color: var(--nl-bnav-text);
  text-decoration: none;
}
.nl-bnav-grid-item:hover,
.nl-bnav-grid-item:active {
  background: #ede0ff;
  border-color: var(--nl-bnav-acento);
  text-decoration: none !important;
  color: var(--nl-bnav-dark) !important;
}

.nl-bnav-grid-item:focus-visible {
  outline: 2px solid var(--nl-bnav-acento);
  outline-offset: 2px;
}

/* ── Sheet vacío ─────────────────────────────────────────── */
.nl-bnav-grid-empty {
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: #aaa;
  line-height: 1.5;
}
.nl-bnav-grid-empty strong { color: #777; }

/* ── Badge de noticias nuevas ───────────────────────────── */
.nl-bnav-item[data-new-posts]::after {
  content: '';
  position: absolute;
  top: 10px;
  left: calc(50% + 6px);
  width: 8px;
  height: 8px;
  background: #e63946;
  border-radius: 50%;
  border: 2px solid var(--nl-bnav-bg);
  pointer-events: none;
  z-index: 1;
  animation: nl-bnav-pulse 2s ease-in-out infinite;
}

@keyframes nl-bnav-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%       { transform: scale(1.3); opacity: 0.75; }
}

/* ── Badge ───────────────────────────────────────────────── */
.nl-bnav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--nl-bnav-acento);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 5px;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
