/* ===============================
   Off-Canvas Sidebar Navigation
   =============================== */

/* Sidebar container */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px; /* Hidden by default */
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, var(--color-deep-black) 0%, var(--color-charcoal) 100%);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
  transition: left 0.3s ease;
  z-index: 1100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Active state - slides in */
.sidebar.active {
  left: 0;
}

/* Sidebar header */
.sidebar-header {
  padding: var(--space-xl) var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: var(--font-xl);
  font-weight: var(--font-bold);
  color: var(--color-solar-gold);
  text-decoration: none;
}

.sidebar-close {
  background: transparent;
  border: none;
  color: var(--color-pure-white);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Sidebar navigation */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: var(--space-lg) 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: var(--color-solar-gold);
  transition: height var(--transition-fast);
}

.sidebar-link:hover,
.sidebar-link.active {
  color: var(--color-solar-gold);
  background: rgba(253, 183, 20, 0.1);
}

.sidebar-link:hover::before,
.sidebar-link.active::before {
  height: 100%;
}

/* Icon placeholder (if you add icons later) */
.sidebar-link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar footer (optional - for logout) */
.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-footer .logout-form {
  margin: 0;
  padding: 0;
}

.sidebar-footer .sidebar-link {
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-footer .sidebar-link:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

/* Overlay backdrop */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1090;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Hamburger toggle button (for sidebar) */
.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--color-deep-black);
  cursor: pointer;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.sidebar-toggle .bar {
  width: 24px;
  height: 3px;
  background: var(--color-deep-black);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Body shift when sidebar is open (optional) */
body.sidebar-open {
  overflow: hidden;
}

/* Desktop - push content instead of overlay */
@media (min-width: 1024px) {
  .sidebar {
    left: -280px;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  /* Optional: Auto-show sidebar on large screens */
  .sidebar.always-visible {
    left: 0;
  }
  
  body.sidebar-always-visible {
    padding-left: 280px;
  }
  
  body.sidebar-always-visible .navbar {
    margin-left: 280px;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .sidebar {
    width: 260px;
    left: -260px;
  }
  
  .sidebar-header {
    padding: var(--space-lg) var(--space-md);
  }
  
  .sidebar-link {
    padding: var(--space-md);
  }
}

/* Hide sidebar toggle on pages without sidebar */
.no-sidebar .sidebar-toggle {
  display: none;
}

/* Smooth scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(253, 183, 20, 0.3);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(253, 183, 20, 0.5);
}
