/* ============================================================
   nibar-nav.css — Sidebar de navegación global
   ============================================================ */

/* ── Layout base ────────────────────────────────────────────── */
body.nibar-layout {
  display: flex !important;
  flex-direction: row !important;
  height: 100vh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

#nibar-sidebar {
  width: 220px;
  min-width: 220px;
  background: #1A2B0C; /* Greenery, identidad de Niba (28-sep-2026) */
  color: #F5F0E8;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width 0.25s ease, min-width 0.25s ease;
  flex-shrink: 0;
  z-index: 100;
}

#nibar-sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

#nibar-page {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header del sidebar ─────────────────────────────────────── */
.nav-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #717A67; /* Balm */
  border-radius: 2px;
  transition: opacity 0.2s;
}

.hamburger:hover span { background: #F5F0E8; }

.nav-brand {
  font-size: 14px;
  font-weight: 700;
  color: #F5F0E8;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.2s;
}

#nibar-sidebar.collapsed .nav-brand { opacity: 0; width: 0; }

/* ── Items de navegación ────────────────────────────────────── */
.nav-items {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  /* Crema atenuada, no Balm: a 13.5px normal, Balm sobre Greenery da 3,36:1
     de contraste (pasa el mínimo de 3:1 para gráficos, no el 4,5:1 que pide
     texto de este tamaño). La crema atenuada mantiene la jerarquía "reposo
     vs activo" sin sacrificar legibilidad — es el mismo color de acento,
     no uno nuevo. */
  color: rgba(245,240,232,0.6);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,105,39,0.12); /* Warm, tenue */
  color: #F5F0E8;
}

.nav-item.active {
  background: rgba(255,105,39,0.16); /* Warm, tenue */
  color: #F5F0E8;
  border-left-color: #FF6927; /* Warm */
  font-weight: 600;
}

.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.nav-label {
  flex: 1;
  opacity: 1;
  transition: opacity 0.2s;
  overflow: hidden;
}

#nibar-sidebar.collapsed .nav-label { opacity: 0; width: 0; }

/* ── Badge ──────────────────────────────────────────────────── */
.nav-badge {
  background: #C0392B;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

#nibar-sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  padding: 1px 4px;
  opacity: 1;
}

/* ── Separador ──────────────────────────────────────────────── */
.nav-sep {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 6px 14px;
}

/* ── Config colapsable ──────────────────────────────────────── */
.nav-config-toggle { user-select: none; }

.config-arrow {
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.6;
}

#nibar-sidebar.collapsed .config-arrow { display: none; }

.nav-config-sub {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,0.2);
}

.nav-config-sub.open { display: flex; }
#nibar-sidebar.collapsed .nav-config-sub { display: none !important; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 42px;
  color: rgba(245,240,232,0.6); /* crema atenuada, mismo motivo que .nav-item */
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.nav-sub-item:hover {
  background: rgba(255,255,255,0.06);
  color: #F5F0E8;
}

.nav-sub-danger { color: #e88; }
.nav-sub-danger:hover { color: #faa; }

/* ── Footer ─────────────────────────────────────────────────── */
.nav-footer {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 8px 0 6px;
  flex-shrink: 0;
}

/* Usuario activo */
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  overflow: hidden;
}

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.nav-user-info {
  flex: 1;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.2s;
}
#nibar-sidebar.collapsed .nav-user-info { opacity: 0; width: 0; }

.nav-user-nombre {
  font-size: 12px;
  font-weight: 600;
  color: #F5F0E8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-rol {
  font-size: 10px;
  color: rgba(245,240,232,0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-logout {
  background: none;
  border: none;
  color: rgba(245,240,232,0.6);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  opacity: 1;
  transition: opacity 0.2s;
}
.nav-logout:hover { color: #F5F0E8; background: rgba(255,105,39,0.14); }
#nibar-sidebar.collapsed .nav-logout { opacity: 0; pointer-events: none; }

/* ── Tooltip en modo colapsado ──────────────────────────────── */
#nibar-sidebar.collapsed .nav-item:hover::after {
  content: attr(title);
  position: absolute;
  left: 60px;
  background: #1A2B0C; /* Greenery, igual que el sidebar */
  color: #F5F0E8;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
