/* ============================================
   Sidebar — Dark Theme
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--duration-base) var(--ease-out);
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar__brand {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar__logo {
  width: 34px;
  height: 34px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar__brand-name {
  color: var(--color-sidebar-text-active);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar__brand-label {
  color: var(--color-sidebar-text);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

/* Organization Selector */
.sidebar__workspace {
  margin: var(--space-sm) var(--space-md) var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-sidebar-hover);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  text-align: left;
  width: calc(100% - var(--space-md) * 2);
}

.sidebar__workspace:hover {
  background: var(--color-sidebar-active);
}

.sidebar__workspace-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #81B29A, #7BA7C9);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar__workspace-info { flex: 1; min-width: 0; }

.sidebar__workspace-name {
  color: var(--color-sidebar-text-active);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__workspace-plan {
  color: var(--color-sidebar-text);
  font-size: 0.65rem;
  font-weight: 400;
}

.sidebar__workspace-chevron {
  color: var(--color-sidebar-text);
  flex-shrink: 0;
}

/* Sidebar Navigation */
.sidebar__nav {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
}

.sidebar__section-label {
  color: var(--color-sidebar-text);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  font-size: 0.85rem;
  font-weight: 400;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 2px;
  position: relative;
  text-decoration: none;
}

.sidebar__link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-sidebar-text-active);
  text-decoration: none;
}

.sidebar__link.active {
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-text-active);
  font-weight: 500;
}

.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar__link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

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

/* Sidebar Projects Submenu */
.sidebar__submenu {
  display: none;
  padding: 2px 0 4px var(--space-xl);
}

.sidebar__submenu.visible { display: block; }

.sidebar__submenu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-sidebar-text);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}

.sidebar__submenu-item:hover {
  color: var(--color-sidebar-text-active);
  background: var(--color-sidebar-hover);
  text-decoration: none;
}

.sidebar__submenu-item.active {
  color: var(--color-sidebar-text-active);
}

.sidebar__project-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Sidebar Bottom / Workspace Selector */
.sidebar__bottom {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__ws-dropdown {
  position: relative;
  margin-bottom: 2px;
}

.sidebar__ws-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-sidebar-text);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar__ws-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-active);
}

.sidebar__ws-trigger-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar__ws-trigger-name {
  flex: 1;
  text-align: left;
}

.sidebar__ws-trigger-chevron {
  color: var(--color-sidebar-text);
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.sidebar__ws-dropdown.open .sidebar__ws-trigger-chevron {
  transform: rotate(180deg);
}

.sidebar__ws-dropdown.open .sidebar__ws-trigger {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-active);
}

.sidebar__ws-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-sidebar-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10;
  animation: wsMenuIn 0.15s ease;
}

@keyframes wsMenuIn {
  from { opacity: 0; transform: translateY(4px); }
}

.sidebar__ws-dropdown.open .sidebar__ws-menu {
  display: block;
}

.sidebar__ws-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-sidebar-text);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.sidebar__ws-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-active);
}

.sidebar__ws-option.active {
  color: var(--color-sidebar-text-active);
  font-weight: 500;
}

.sidebar__ws-option-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar__ws-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

.sidebar__ws-edit-link {
  color: var(--color-sidebar-text);
  opacity: 0.7;
}

.sidebar__ws-edit-link:hover {
  opacity: 1;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}
