/* ==========================================================================
   SIDEBAR NAVIGATION STYLES - Hover to Open, Below Header
   ========================================================================== */

/* Main Sidebar - Closed by Default */
.main-sidebar {
  position: fixed;
  left: 0;
  top: 80px; /* Below header - adjust based on your header height */
  width: 80px; /* Closed width - just icons */
  height: calc(100vh - 80px);
  background: var(--bg-secondary);
  border-right: 2px solid var(--border-primary);
  border-radius: 0 16px 0 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s ease, border-radius 0.3s ease;
}

.main-sidebar:hover {
  width: 250px; /* Expanded width */
  border-radius: 0 16px 16px 0;
  box-shadow: 4px 0 20px var(--shadow-color);
}

/* Sidebar Header */
.sidebar-header {
  padding: 20px;
  border-bottom: 2px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
  min-height: 60px;
}

.main-sidebar:hover .sidebar-header {
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-heading);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.sidebar-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-logo span {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.main-sidebar:hover .sidebar-logo span {
  opacity: 1;
}

.sidebar-close {
  display: none; /* Hide on desktop */
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

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

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-disabled);
  padding: 0 20px 8px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, height 0.3s ease;
}

.main-sidebar:hover .nav-section-title {
  opacity: 1;
  height: auto;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

.nav-link i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  color: var(--text-secondary);
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.nav-link span {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.main-sidebar:hover .nav-link span {
  opacity: 1;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-heading);
}

.nav-link:hover i {
  color: var(--accent-primary);
}

.nav-item.active .nav-link {
  background: var(--accent-primary-transparent);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-item.active .nav-link i {
  color: var(--accent-primary);
}

.nav-item.active .nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-primary);
  border-radius: 0 4px 4px 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 2px solid var(--border-primary);
  background: var(--bg-secondary);
}

.promo-card {
  background: linear-gradient(135deg, var(--accent-primary), #ff3333);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  color: #fff;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, height 0.3s ease, padding 0.3s ease;
}

.main-sidebar:hover .promo-card {
  opacity: 1;
  height: auto;
  padding: 16px;
}

.promo-card i {
  font-size: 1.8rem;
  margin-bottom: 8px;
  opacity: 0.9;
}

.promo-card h4 {
  font-size: 1rem;
  margin-bottom: 6px;
  font-weight: 700;
}

.promo-card p {
  font-size: 0.85rem;
  margin-bottom: 12px;
  opacity: 0.95;
  line-height: 1.4;
}

.promo-btn {
  display: inline-block;
  background: #fff;
  color: var(--accent-primary);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.promo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Sidebar Overlay - Only for Mobile */
.sidebar-overlay {
  display: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
}

/* Main Content Area with Sidebar */
body {
  padding-left: 80px; /* Space for closed sidebar */
  transition: padding-left 0.3s ease;
}

/* Very Slim Scrollbar for Sidebar */
.main-sidebar::-webkit-scrollbar {
  width: 3px; /* Very slim */
}

.main-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.main-sidebar::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 10px;
  opacity: 0.5;
}

.main-sidebar::-webkit-scrollbar-thumb:hover {
  opacity: 1;
}

/* Firefox slim scrollbar */
.main-sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

/* Responsive Design - Mobile */
@media (max-width: 1024px) {
  body {
    padding-left: 0;
  }

  .main-sidebar {
    top: 80px;
    height: 100vh;
    width: 280px;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .main-sidebar.active {
    transform: translateX(0);
  }

  /* Always show text on mobile */
  .main-sidebar .sidebar-logo span,
  .main-sidebar .nav-link span,
  .main-sidebar .nav-section-title,
  .main-sidebar .promo-card {
    opacity: 1;
    height: auto;
  }

  .sidebar-header {
    justify-content: space-between;
  }

  .sidebar-close {
    display: block;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
  }

  .sidebar-close:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

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

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--accent-glow);
    z-index: 997;
    transition: all 0.3s ease;
  }

  .mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--accent-glow);
  }
}

/* Tablet adjustments */
@media (max-width: 1280px) and (min-width: 1025px) {
  .main-sidebar:hover {
    width: 260px; /* Slightly smaller on tablets */
  }
}

/* Light Mode Adjustments */
body.light-mode .main-sidebar:hover {
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
}

body.light-mode .sidebar-overlay {
  background: rgba(0, 0, 0, 0.3);
}

body.light-mode .mobile-menu-toggle {
  box-shadow: 0 4px 16px rgba(238, 0, 11, 0.3);
}

body.light-mode .mobile-menu-toggle:hover {
  box-shadow: 0 6px 20px rgba(238, 0, 11, 0.4);
}

/* Tooltip on hover for closed state - Optional enhancement */
.nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 70px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 1px solid var(--border-primary);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.main-sidebar:not(:hover) .nav-link:hover::after {
  opacity: 1;
}

.main-sidebar:hover .nav-link::after {
  display: none;
}
