/* ============================================================ */
/* SIDEBAR & UNIFIED NAVIGATION FOR HABIT TRACKER PRO */
/* ============================================================ */

/* Sidebar Container (Visible on Desktop, Tablet & Smartphone) */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  height: 100%;
  max-height: 100%;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  background-color: rgb(var(--color-slate-950) / 0.95);
  border-right: 1px solid rgb(var(--color-slate-700) / 0.6);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Collapsed Mode (Icon Rail - 64px) */
.app-sidebar.collapsed {
  width: 64px !important;
  min-width: 64px !important;
}

.app-sidebar.collapsed .sidebar-text,
.app-sidebar.collapsed .sidebar-badge,
.app-sidebar.collapsed .sidebar-brand-title {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-nav-btn {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.app-sidebar.collapsed .sidebar-nav-btn span.text-xl {
  margin: 0 auto;
}

/* Nav Item styling */
.sidebar-nav-btn {
  position: relative;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 1rem;
}

.sidebar-nav-btn:hover {
  background: rgb(var(--color-slate-800) / 0.6);
  color: rgb(var(--color-slate-50));
}

.sidebar-nav-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(79, 70, 229, 0.15) 100%);
  color: rgb(var(--color-slate-50));
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.3);
}

.sidebar-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: #6366f1;
}

.app-sidebar.collapsed .sidebar-nav-btn.active::before {
  left: 2px;
  width: 4px;
}

/* Backdrop for Mobile Drawer */
#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(var(--color-slate-950) / 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 35;
  transition: opacity 0.25s ease;
}

/* Mobile & Tablet Responsive Behavior */
@media (max-width: 768px) {
  /* On mobile, default to collapsed 64px icon rail */
  .app-sidebar {
    width: 64px;
    min-width: 64px;
    height: 100%;
    max-height: 100%;
  }
  
  /* When expanded on mobile, slide out as full drawer overlay */
  .app-sidebar:not(.collapsed) {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    max-height: 100%;
    width: 250px !important;
    min-width: 250px !important;
    z-index: 50;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  }

  .main-content-wrapper {
    padding-bottom: 2rem !important; /* No bottom dock padding needed! */
  }
}
