/* ═══════════════════════════════════════════════
   الشريط الجانبي المتقدم - Premium Sidebar (Ultra Contrast)
   ═══════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  max-width: 85vw;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: transform var(--transition-base), background var(--transition-base);
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .sidebar {
  background: #0a1020;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

/* ─── Logo / Brand ─── */
.sidebar-brand {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  flex-shrink: 0;
}

[data-theme="dark"] .sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #d4af37 0%, #b88e14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(184, 142, 20, 0.3);
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-text h2 {
  font-size: 1.1rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.3;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .brand-text h2 {
  color: #ffffff;
  background: linear-gradient(135deg, #f0d060, #d4af37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text span {
  font-size: 0.74rem;
  color: #64748b;
  display: block;
  margin-top: 2px;
  font-weight: 700;
}

[data-theme="dark"] .brand-text span {
  color: #94a3b8;
}

/* ─── Theme Switcher (Dark / Light) ─── */
.theme-switch-wrapper {
  display: flex;
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-top: var(--space-md);
  position: relative;
  gap: 2px;
}

[data-theme="dark"] .theme-switch-wrapper {
  background: #101828;
  border-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Cairo', sans-serif;
}

[data-theme="dark"] .theme-toggle-btn {
  color: #94a3b8;
}

.theme-toggle-btn:hover {
  color: #0f172a;
}

[data-theme="dark"] .theme-toggle-btn:hover {
  color: #ffffff;
}

.theme-toggle-btn.active {
  background: #ffffff;
  color: #8c6807;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  font-weight: 800;
}

[data-theme="dark"] .theme-toggle-btn.active {
  background: linear-gradient(135deg, #d4af37 0%, #b8941e 100%);
  color: #04080f;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
  font-weight: 800;
}

/* ─── Navigation ─── */
.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  overflow-y: auto;
}

.nav-section-title {
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: var(--space-xs);
}

[data-theme="dark"] .nav-section-title {
  color: #94a3b8;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 11px var(--space-md);
  margin: 3px 0;
  border-radius: var(--radius-md);
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
}

[data-theme="dark"] .nav-item {
  color: #cbd5e1;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(184, 142, 20, 0.1);
  color: #8c6807;
  border-color: rgba(184, 142, 20, 0.25);
  font-weight: 800;
}

[data-theme="dark"] .nav-item.active {
  background: rgba(212, 175, 55, 0.12);
  color: #f0d060;
  border-color: rgba(212, 175, 55, 0.25);
}

/* Active indicator bar on the right edge */
.nav-item.active::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, #d4af37, #b88e14);
  border-radius: 2px;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
  font-size: 1.15rem;
  transition: opacity var(--transition-fast);
  position: relative;
  z-index: 1;
}

.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; color: #8c6807; }
[data-theme="dark"] .nav-item.active .nav-icon { color: #f0d060; }

.nav-item .nav-text {
  flex: 1;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

/* Notification Badge on nav items */
.nav-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  position: relative;
  z-index: 1;
}

/* ─── User Profile Section (High Contrast & Super Clear) ─── */
.sidebar-user {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #f1f5f9;
  position: relative;
  flex-shrink: 0;
}

[data-theme="dark"] .sidebar-user {
  background: #060b18;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-user .user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #d4af37, #1d72d6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-user .user-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

[data-theme="dark"] .sidebar-user .user-avatar::after {
  border-color: #0a1020;
}

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

.sidebar-user .user-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .sidebar-user .user-name {
  color: #ffffff;
}

.sidebar-user .user-role {
  font-size: 0.8rem;
  color: #8c6807;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-top: 1px;
}

[data-theme="dark"] .sidebar-user .user-role {
  color: #e4c24a;
}

/* ─── Mobile Toggle ─── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  color: #8c6807;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 1060;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .sidebar-toggle {
  background: #0a1020;
  border-color: rgba(255, 255, 255, 0.15);
  color: #d4af37;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ─── Mobile Overlay (Crisp & Clean - No Blurring) ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1040;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Responsive (768px & Below) ─── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    width: 290px;
    max-width: 85vw;
    box-shadow: -8px 0 36px rgba(0, 0, 0, 0.25);
    background: #ffffff !important;
  }

  [data-theme="dark"] .sidebar {
    background: #0a1020 !important;
    box-shadow: -8px 0 36px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay {
    display: block;
  }
}
