/* ==========================================================
   Sidebar Navigation
   ========================================================== */

/* --- Sidebar container --- */
.sidebar {
  width: 248px;
  min-width: 248px;
  height: calc(100vh - 48px);
  position: sticky;
  top: 48px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  z-index: 1020;
  background:
    linear-gradient(180deg, rgba(var(--bs-primary-rgb), 0.02) 0%, rgba(var(--bs-primary-rgb), 0.05) 100%),
    #ffffff;
  border-right: 1px solid rgba(var(--bs-primary-rgb), 0.08);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(var(--bs-primary-rgb), 0.1);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--bs-primary-rgb), 0.2);
}

/* --- Group section --- */
.sidebar__group {
  margin-bottom: 0.25rem;
}

.sidebar__group-header {
  padding: 1.25rem 1.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bs-secondary-color);
  user-select: none;
}

/* --- Individual nav item (link) --- */
.sidebar__item {
  margin: 1px 0.75rem;
  padding: 0.5rem 0.625rem;
  color: var(--bs-body-color);
  font-size: 0.8125rem;
  font-weight: 450;
  border-radius: 6px;
  transition: all 0.15s ease;
  letter-spacing: 0.005em;
}

.sidebar__item:hover {
  background: rgba(var(--bs-primary-rgb), 0.05);
  color: var(--bs-body-emphasis-color);
}

/* Active state */
.sidebar__item--active {
  background: rgba(var(--bs-primary-rgb), 0.08);
  color: var(--bs-body-emphasis-color);
  font-weight: 600;
  box-shadow: inset 3px 0 0 0 var(--bs-primary);
}

.sidebar__item--active:hover {
  background: rgba(var(--bs-primary-rgb), 0.1);
}

/* --- Item icon --- */
.sidebar__item-icon {
  width: 1.125rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  opacity: 0.7;
}

.sidebar__item--active .sidebar__item-icon {
  opacity: 1;
}

/* --- Item label --- */
.sidebar__item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Content area --- */
.sidebar__content {
  min-width: 0;
}

/* ==========================================================
   Collapsed state — icon-only mini sidebar
   Toggled by the hamburger menu in the top bar
   ========================================================== */

.sidebar--collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar--collapsed .sidebar__group-header {
  display: none;
}

.sidebar--collapsed .sidebar__item {
  justify-content: center;
  padding: 0.5rem;
  margin: 1px 0.5rem;
}

.sidebar--collapsed .sidebar__item > :not(.sidebar__item-icon) {
  display: none;
}

.sidebar--collapsed .sidebar__item--active {
  box-shadow: inset 3px 0 0 0 var(--bs-primary);
}

.sidebar--collapsed .sidebar__item-icon {
  font-size: 1.05rem;
}

/* ==========================================================
   Compact sidebar on notebook screens (md → xxl)
   Keeps labels visible but uses less horizontal space.
   ========================================================== */

@media (min-width: 768px) and (max-width: 1399.98px) {
  .sidebar:not(.sidebar--collapsed) {
    width: 192px;
    min-width: 192px;
  }

  .sidebar:not(.sidebar--collapsed) .sidebar__group-header {
    padding: 1rem 0.75rem 0.35rem;
    font-size: 0.6rem;
  }

  .sidebar:not(.sidebar--collapsed) .sidebar__item {
    margin: 1px 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }

}
