/* =========================================================
   NexaAI — Sidebar
   ========================================================= */

.nexa-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: width var(--dur-base) var(--ease-standard),
    transform var(--dur-base) var(--ease-standard);
}

.nexa-sidebar.collapsed { width: var(--sidebar-width-collapsed); }

.nexa-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nexa-sidebar-brand .brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.nexa-sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
}
.nexa-sidebar.collapsed .brand-name,
.nexa-sidebar.collapsed .nav-label,
.nexa-sidebar.collapsed .nav-section-title {
  display: none;
}

.nexa-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 16px 12px 8px;
}
.nav-section-title:first-child { padding-top: 4px; }

.nav-item-nexa {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
}
.nav-item-nexa:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-item-nexa.active {
  background: var(--primary-soft);
  color: var(--primary-soft-ink);
}
.nav-item-nexa i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item-nexa .nav-badge { margin-left: auto; }

.nexa-sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
}

.nexa-app-shell {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--dur-base) var(--ease-standard);
  min-height: 100vh;
  background: var(--bg);
}
.nexa-app-shell.sidebar-collapsed { margin-left: var(--sidebar-width-collapsed); }

@media (max-width: 992px) {
  .nexa-sidebar {
    transform: translateX(-100%);
  }
  .nexa-sidebar.mobile-open { transform: translateX(0); }
  .nexa-app-shell,
  .nexa-app-shell.sidebar-collapsed {
    margin-left: 0;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1020;
  }
  .sidebar-backdrop.show { display: block; }
}

/* RTL */
[dir="rtl"] .nexa-sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .nexa-app-shell { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .nexa-app-shell.sidebar-collapsed { margin-right: var(--sidebar-width-collapsed); margin-left: 0; }
[dir="rtl"] .sidebar-collapse-btn { margin-left: 0; margin-right: auto; }
