/**
 * Cascade Nexus — Sidebar
 * Premium animated sidebar with collapsible sections.
 */

/* ─── Sidebar Container ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 2px;
}

/* ─── Sidebar Header ─────────────────────────────────────────────────── */
.sidebar-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--forest-green), var(--aurora-cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--glow-cyan);
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.logo-text span {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

/* ─── Sidebar Navigation ────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1px;
}

/* Section Header */
.nav-section-header {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  user-select: none;
  position: relative;
}

.nav-section-header:hover {
  color: var(--text-secondary);
}

.nav-section-header .toggle-icon {
  margin-left: auto;
  font-size: 12px;
  font-weight: 300;
  color: var(--text-quaternary);
}

/* Section Items Container */
.nav-items {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
}

.nav-items.open {
  max-height: 450px;
  opacity: 1;
}

/* Individual Nav Item */
.nav-item {
  display: flex;
  align-items: center;
  padding: 6px 20px 6px 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  border-left: 2px solid transparent;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
  border-left-color: var(--aurora-cyan);
}

.nav-item.active {
  color: var(--aurora-cyan);
  border-left-color: var(--aurora-cyan);
  background: var(--active-bg);
}

.nav-item .nav-icon {
  width: 18px;
  margin-right: 10px;
  text-align: center;
  font-size: 13px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Sub-header labels */
.nav-item.nav-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-quaternary);
  cursor: default;
  border-left: none;
  padding-left: 28px;
  margin-top: 4px;
}

.nav-item.nav-label:hover {
  background: none;
  color: var(--text-quaternary);
}

/* ─── Sidebar Footer ─────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.sidebar-footer .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
}

/* ─── Collapsed State (desktop toggle via Cmd+B) ────────────────────── */
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  padding: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
}

/* ─── Mobile Hamburger ───────────────────────────────────────────────── */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    height: 100vh;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }

  .mobile-toggle {
    display: flex;
  }
}
