/* ─── Sidebar ─── */
.sidebar {
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
/* Desktop: inline collapse */
@media (min-width: 1024px) {
  .sidebar { width: 260px; min-width: 260px; position: relative; }
  .sidebar.collapsed { width: 0; min-width: 0; }
}
/* Tablet & Mobile: fixed drawer */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; z-index: 50;
    transform: translateX(-280px);
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
}
@media (max-width: 639px) {
  .sidebar { width: 260px; transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); }
}

.sidebar-brand { padding: 22px 20px 18px; display: flex; align-items: center; gap: 10; }
@media (max-width: 639px) { .sidebar-brand { padding: 18px 16px 14px; } }
.sidebar-logo {
  width: 32px; height: 32px; border-radius: 8px; background: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  visibility: hidden; /* Hide default icon, will be replaced by JS */
}
.sidebar-title { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.sidebar-subtitle { font-size: 11px; color: var(--text-dim); display: block; margin-top: -1px; }
.sidebar-close { background: none; border: none; color: var(--text-secondary); padding: 4px; display: none; }
@media (max-width: 1023px) { .sidebar-close { display: flex; } }

.sidebar-nav { flex: 1; overflow: auto; padding: 0 10px; }
.sidebar-hr { height: 1px; background: var(--border); margin: 8px 10px 10px; }
.sidebar-label {
  padding: 2px 10px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim);
}

.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; background: none; border: none;
  color: var(--text-secondary); font-size: 13px; font-weight: 400;
  border-radius: 6px; text-align: left; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.nav-item.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.nav-item:hover:not(.active) { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .nav-item:hover:not(.active) { background: rgba(255,255,255,0.03); }
@media (max-width: 639px) { .nav-item { padding: 10px; font-size: 14px; } }
.nav-icon { width: 20px; display: flex; justify-content: center; flex-shrink: 0; }
.nav-count {
  font-size: 11px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.nav-subitem { padding-left: 28px; font-size: 12px; }

/* ─── Collection expand/collapse ─── */
.nav-collection-wrap { display: flex; align-items: center; border-radius: 6px; transition: background 0.15s; }
.nav-collection-wrap .nav-item { flex: 1; min-width: 0; }
.nav-collection-wrap .nav-item.active { background: none; }
.nav-collection-wrap .nav-item:hover:not(.active) { background: none; }
.nav-collection-wrap:not(:has(.nav-item.active)):hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .nav-collection-wrap:not(:has(.nav-item.active)):hover { background: rgba(255,255,255,0.03); }
.nav-collection-wrap:has(.nav-item.active) { background: var(--bg-hover); }
.nav-chevron {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 32px; background: none; border: none;
  color: var(--text-dim); padding: 0; cursor: pointer;
  transition: color 0.15s;
}
.nav-chevron:hover { color: var(--text-secondary); }
.nav-chevron svg { transform: rotate(0deg); }
.nav-chevron.expanded svg { animation: chevron-expand 0.2s ease forwards; }
@keyframes chevron-expand { from { transform: rotate(0deg); } to { transform: rotate(90deg); } }

.tags-wrap { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 8px 20px; }
.tag-btn {
  font-size: 11px; padding: 4px 10px; border-radius: 20px; border: none;
  font-weight: 500; font-family: 'DM Sans', sans-serif;
  background: var(--tag-bg); color: var(--tag-text); transition: all 0.15s;
}
.tag-btn.active { background: var(--text); color: var(--bg); }
@media (max-width: 639px) { .tag-btn { font-size: 12px; padding: 6px 12px; } }
