/* -- Site Navbar --------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: #fff;
  border-bottom: 1px solid var(--t-line, #e8ddd5);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

.nav-right {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  min-width: 0;
}

.nav-cuenta {
  font-size: .85rem;
  font-weight: 600;
  color: var(--t-text, #2d2d2d);
  text-decoration: none;
  padding: .4rem .6rem;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-cuenta:hover { color: var(--t-accent, #3aada8); background: #e6f0fa; }

/* Logo */
.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--t-text, #2d2d2d);
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--t-accent, #3aada8); }
.nav-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

/* Desktop links */
.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  justify-content: center;
}

.nav-links a {
  position: relative;
  padding: .5rem .9rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--t-text, #2d2d2d);
  text-decoration: none;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 2px; left: .9rem; right: .9rem;
  height: 2px;
  background: var(--t-accent, #3aada8);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform .2s ease;
  transform-origin: center;
}
.nav-links a:hover { color: var(--t-accent, #3aada8); background: #e6f0fa; }
.nav-links a:hover::after { transform: scaleX(1); }

/* Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.nav-btn {
  padding: .45rem 1rem;
  border-radius: 7px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  background: none;
  color: var(--t-text, #2d2d2d);
}
.nav-btn--ghost { border: 1.5px solid var(--t-line, #e8ddd5); }
.nav-btn--ghost:hover { background: var(--t-bg, #fdf6f0); border-color: var(--t-accent, #3aada8); color: var(--t-accent, #3aada8); }

/* Estado abierto/cerrado — solo en escritorio/tablet (en móvil vive en el
   nav azul, ver infobar.css). */
.nav-estado-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700;
  padding: .25rem .6rem;
  border-radius: 20px;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.nav-estado-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav-estado-badge--open { background: #d4f5e2; color: #1a7a40; }
.nav-estado-badge--open .nav-estado-dot { background: #22c55e; animation: nav-pulse 2s infinite; }
.nav-estado-badge--closed { background: #fde8e8; color: #b33; }
.nav-estado-badge--closed .nav-estado-dot { background: #ef4444; }
@keyframes nav-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* Dropdown submenu */
.nav-item--has-sub { position: relative; }
.nav-sub {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--t-line, #e8ddd5);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  min-width: 160px;
  overflow: hidden;
  z-index: 100;
}
.nav-item--has-sub:hover .nav-sub { display: block; }
.nav-sub a {
  display: block;
  padding: .65rem 1.1rem;
  font-size: .85rem;
  color: var(--t-text, #2d2d2d);
  text-decoration: none;
  transition: background .15s;
}
.nav-sub a:hover { background: var(--t-bg, #fdf6f0); color: var(--t-accent, #3aada8); }
.nav-sub a:not(:last-child) { border-bottom: 1px solid var(--t-line, #e8ddd5); }

/* Menú de cuenta (dropdown en nav-right): igual que .nav-sub pero alineado
   a la derecha (si se centrara bajo el trigger, en el borde derecho de la
   barra se saldría de la pantalla). */
.nav-cuenta-menu { position: relative; }
.nav-cuenta--toggle { cursor: pointer; }
.nav-sub--cuenta {
  left: auto;
  right: 0;
  transform: none;
  min-width: 180px;
}

/* Responsive — un único criterio: ancho de pantalla.
   - Escritorio/tablet (>768px): logo a la izquierda, enlaces en medio,
     cartel abierto/cerrado a la derecha (todo como estaba originalmente).
   - Móvil estrecho (≤768px): sin enlaces ni cartel aquí (el cartel vive en
     el nav azul de arriba) — solo el logo + nombre, centrado ocupando
     todo el ancho de la barra. */
/* Botón hamburguesa: abre el sidebar (toggleNSB). Oculto en escritorio,
   que ya muestra los enlaces completos; solo aparece en móvil, donde
   .nav-links y .nav-right se ocultan. */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  color: var(--t-primary, #2b7a78);
  line-height: 0;
  border-radius: 8px;
}
.nav-hamburger:hover { background: #e6f0fa; }

@media (max-width: 768px) {
  .nav-links, .nav-actions, .nav-right { display: none; }
  .nav-hamburger { display: inline-flex; }

  .nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: auto;
    padding: .85rem 1rem;
  }
  .nav-brand { max-width: 100%; }
  /* El nombre completo en una sola línea, nunca partido en varias — si no
     cabe, se recorta con "…" en vez de saltar de línea. */
  .nav-brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .nav-brand span { font-size: .82rem; }
}
