/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */

#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform var(--t-slow) var(--ease);
}

.sidebar-search {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 12px;
  transition: border-color var(--t-fast);
}
.sidebar-search input:focus { outline: none; border-color: var(--accent-purple); }
.sidebar-search input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) 0;
}

.sidebar-section { margin-bottom: var(--sp-2); }

.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3) 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-group-label .group-icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.algo-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px var(--sp-3);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  color: var(--text-secondary);
  font-size: 12.5px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  border-radius: 0;
  user-select: none;
}

.algo-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.algo-item.active {
  background: var(--accent-purple-dim);
  color: var(--text-accent);
}

.algo-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 18px;
  width: 2.5px;
  background: var(--accent-purple);
  border-radius: 0 2px 2px 0;
}

.algo-item.hidden { display: none; }

.algo-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.algo-item.active .algo-dot { background: var(--accent-purple); }

.algo-name { flex: 1; }

.complexity-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--bg-active);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.algo-item.active .complexity-pill {
  background: var(--accent-purple-dim);
  color: var(--text-accent);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-3);
  flex-shrink: 0;
}

.kbd-shortcuts { display: flex; flex-direction: column; gap: 4px; }
.kbd-row { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.kbd-row kbd { margin-right: 2px; }

/* ── Sidebar Overlay (mobile backdrop) ── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 149;
  backdrop-filter: blur(2px);
}
#sidebar-overlay.visible { display: block; }
