/* ==============================================
   sidebar.css - Sidebar, Nav, Brand
   ============================================== */

/* Sidebar */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--card);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Firefox Scrollbar */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) var(--card);
}

.brand {
  margin-bottom: 2rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.brand-logo-light {
  display: block;
  filter: brightness(0.2) saturate(100%);
  opacity: 0.75;
}

.brand-logo-dark {
  display: none;
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
  opacity: 0.8;
  filter: brightness(0.92);
}

.brand-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.brand-divider {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 2px;
}

:root[data-theme="dark"] .brand-divider {
  background: linear-gradient(90deg, #60a5fa, #22d3ee);
}

.brand-tagline {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  line-height: 1.4;
}

.nav-section {
  flex: 1;
  overflow-y: auto;
}

.nav-section h6 {
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-size: .7rem;
  margin-bottom: .4rem;
  margin-top: 1rem;
}

.nav-section h6:first-child {
  margin-top: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 10px;
  transition: all .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--stroke);
  background: radial-gradient(circle at 0 0, rgba(79, 70, 229, 0.08), rgba(34, 211, 238, 0.08));
  color: var(--text);
}

/* Navigation Group (for nested items) */
.nav-group {
  margin-bottom: 0.25rem;
}

.nav-submenu {
  margin-top: 0.25rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--stroke);
  margin-left: 0.85rem;
}

.nav-link-sub {
  font-size: 0.85rem;
  padding: 0.4rem 0.65rem;
}

.nav-link-sub:hover,
.nav-link-sub.active {
  background: rgba(79, 70, 229, 0.05);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Action Buttons Row */
.sidebar-actions-row {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.25rem;
}

.sidebar-action-icon {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-action-icon:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.3);
  color: #6366f1;
  transform: translateY(-1px);
}

.sidebar-action-icon:active {
  transform: translateY(0);
}

/* Logout button special styling */
.sidebar-action-logout:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #ef4444 !important;
}

/* User Profile Card */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(34, 211, 238, 0.05));
  border: 1px solid var(--stroke);
  transition: all 0.2s ease;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.sidebar-user-details {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-user-role {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-weight: 500;
}

/* Dark theme adjustments */
:root[data-theme="dark"] .sidebar-action-icon {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .sidebar-action-icon:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

:root[data-theme="dark"] .sidebar-user-card {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(34, 211, 238, 0.12));
  border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .sidebar-user-avatar {
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

:root[data-theme="dark"] .sidebar-action-logout:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}
