.sidebar {
  position: sticky;
  top: 0;
  width: var(--size-sidebar-opened);
  height: 100vh;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border-hr);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--size-sidebar-closed);
}

/* Sidebar Header */
.sidebar .sidebar-header {
  padding: 20px 16px;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.sidebar.collapsed .sidebar-header {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: auto;
}

.sidebar-header .header-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sidebar-header .header-logo {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.sidebar.collapsed .header-logo {
  width: 30px;
  height: 30px;
}

.sidebar-header .sidebar-toggle {
  height: 34px;
  width: 34px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--color-text-placeholder);
  background: transparent;
  transition: all 0.2s ease;
}

.sidebar.collapsed .sidebar-header .sidebar-toggle {
  margin: 0 auto;
}

.sidebar-header .sidebar-toggle:hover {
  color: var(--color-text-primary);
}

.sidebar-header .sidebar-toggle span {
  font-size: 22px;
  transition: transform 0.4s ease;
}

.sidebar.collapsed .sidebar-toggle span {
  transform: rotate(180deg);
}

/* Sidebar Content */
.sidebar .sidebar-content {
  flex: 1;
  padding: 16px 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-content {
  padding: 16px 0;
}

/* Search Form (Hidden in collapsed) */
.sidebar-content .search-form {
  border-radius: 8px;
  min-height: 44px;
  margin-bottom: 20px;
  align-items: center;
  display: flex;
  padding: 0 12px;
  background: var(--color-bg-secondary);
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .search-form {
  display: none;
}

.search-form input {
  background: none;
  outline: none;
  border: none;
  width: 100%;
  margin-left: 10px;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

/* Menu List — Nansen style */
.sidebar-content .menu-list {
  display: flex;
  gap: 2px;
  list-style: none;
  flex-direction: column;
}

.menu-list .menu-link {
  display: flex;
  height: 42px;
  padding: 0 18px;
  align-items: center;
  text-decoration: none;
  color: var(--color-text-placeholder);
  border-radius: 0;
  transition: color 0.15s ease;
  position: relative;
  white-space: nowrap;
}

.menu-list .menu-link .material-symbols-rounded,
.menu-list .menu-link .material-symbols-outlined {
  font-size: 22px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-list .menu-link .menu-label {
  margin-left: 14px;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: opacity 0.3s ease;
}

/* Active & Hover States */
.menu-list .menu-link:hover {
  color: var(--color-text-primary);
}

.menu-list .menu-link.active {
  color: var(--color-text-primary);
}

/* Collapsed */
.sidebar.collapsed .menu-link {
  justify-content: center;
  padding: 0;
  height: 48px;
}

.sidebar.collapsed .menu-link .material-symbols-rounded,
.sidebar.collapsed .menu-link .material-symbols-outlined {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.sidebar.collapsed .menu-link:hover .material-symbols-rounded,
.sidebar.collapsed .menu-link:hover .material-symbols-outlined {
  color: var(--color-text-primary);
}

.sidebar.collapsed .menu-link.active .material-symbols-rounded,
.sidebar.collapsed .menu-link.active .material-symbols-outlined {
  color: var(--color-text-primary);
}

.sidebar.collapsed .menu-link .menu-label {
  display: none;
}

/* Sidebar Footer */
.sidebar .sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border-hr);
}

.sidebar.collapsed .sidebar-footer {
  padding: 12px 0;
  display: flex;
  justify-content: center;
}

.sidebar-footer .theme-toggle {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border: none;
  padding: 0 10px;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  transition: all 0.3s ease;
  gap: 6px;
}

.sidebar.collapsed .theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  background: var(--color-bg-secondary);
}

.theme-toggle .theme-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle .theme-icon {
  font-size: 18px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle .theme-text {
  font-size: 0.8rem;
  font-weight: 500;
}

.theme-toggle .theme-toggle-track {
  height: 22px;
  width: 42px;
  border-radius: 999px;
  margin-left: auto;
  background: #c3d1ec;
  position: relative;
  transition: background-color 0.3s ease;
}

.sidebar.collapsed :where(.theme-text, .theme-toggle-track) {
  display: none;
}

body.dark-theme .theme-toggle-track {
  background: var(--color-hover-primary);
}

.theme-toggle-track .theme-toggle-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #fff;
  transition: transform 0.3s ease;
}

body.dark-theme .theme-toggle-indicator {
  transform: translateX(20px);
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    z-index: 100;
    width: 260px;
    transform: translateX(0);
    transition: transform 0.4s ease;
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
}
