/* =========================================
   3. SIDEBAR NAVIGATION (Right-Side Mobile)
   ========================================= */

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border); 
  box-shadow: var(--shadow);
  position: fixed;
  
  /* --- MOBILE SETTINGS (RIGHT SIDE) --- */
  right: -280px; 
  left: auto; 
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem 0; /* Reduced from 1.5rem */
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), right 0.3s ease;
  backdrop-filter: none !important; 
  -webkit-font-smoothing: antialiased;
}

/* State when active (Mobile Slide-in) */
.sidebar.active {
  right: 0; 
  transform: translateX(0);
}

.sidebar-header {
  padding: 0 1.2rem 1rem; /* Reduced bottom padding from 2rem to 1rem */
  padding-top: 30px; /* Reduced from 20px */
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px; /* Reduced from 12px */
  margin-bottom: 0.5rem; /* Reduced from 1rem */
}

.logo-img {
  width: 40px; /* Slightly smaller logo to save space */
  height: 40px;
  object-fit: contain;
}

.logo-text {
  font-weight: 800;
  font-size: 1.7rem; /* Slightly smaller text */
  letter-spacing: 0.5px;
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-top: 0.5rem;
}

.nav-label {
  font-size: 0.7rem; /* Slightly smaller label */
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 0.8rem 1.2rem 0.4rem; /* Tightened padding */
  letter-spacing: 1px;
  opacity: 0.6;
}

.sidebar-link {
  width: 92%; /* Slightly wider for a cleaner look */
  margin: 0 auto 0.2rem; /* Reduced bottom margin from 0.4rem to 0.2rem */
  padding: 0.6rem 1rem; /* Reduced vertical padding from 0.75rem to 0.6rem */
  background: transparent;
  border: none;
  color: var(--text-dim);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px; /* Reduced gap from 12px */
  font-weight: 500;
  font-family: inherit;
  font-size: 0.9rem; /* Slightly smaller font */
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: var(--input-bg);
  color: var(--text-main);
  transform: translateX(-2px); /* Subtle shift */
}

.sidebar-link .icon {
  font-size: 1.1rem; /* Scaled down slightly */
  color: var(--accent);
  width: 20px;
  text-align: center;
}

.user-profile-info {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  padding: 0.4rem 0; /* Tightened */
}

.user-profile-info i {
  font-size: 1.3rem;
  color: var(--accent);
}

#display-username {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 1rem 1.2rem; /* Reduced from 1.5rem */
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px; /* Tighter gap between buttons */
  margin-bottom: 0;
}

.sidebar-footer .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 0px;
  padding: 0.6rem 1rem; /* Ensure buttons are compact too */
}

.sidebar-footer .btn i {
  font-size: 0.85rem;
}

/* --- OVERLAY --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px); 
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- DESKTOP VIEW --- */
@media (min-width: 1024px) {
  #menu-toggle {
    display: none !important;
  }

  .sidebar {
    right: auto !important;
    left: 0 !important;
    border-right: 1px solid var(--border);
    border-left: none;
    transition: none;
  }

  .sidebar-overlay {
    display: none !important;
  }
}