/* ============================================================
   OKBEA — SIDEBAR v4 (Clean Minimal)
   Inspired by Notion/Linear design system
   ============================================================ */

/* ── SHELL ──────────────────────────────────────────────────── */
.dash-sidebar {
  width: 240px;
  min-width: 240px;
  background: #0c1220;
  border-right: 1px solid rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  flex-shrink: 0;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  z-index: 100;
}
.dash-sidebar.collapsed {
  width: 62px;
  min-width: 62px;
}

/* Hide labels when collapsed */
.dash-sidebar.collapsed .sb-label,
.dash-sidebar.collapsed .sb-sec-label,
.dash-sidebar.collapsed .sb-chevron,
.dash-sidebar.collapsed .sb-badge,
.dash-sidebar.collapsed .sb-sec-body,
.dash-sidebar.collapsed .sb-user-info,
.dash-sidebar.collapsed .sb-upgrade-btn,
.dash-sidebar.collapsed .sb-user-email { display: none !important; }

.dash-sidebar.collapsed .sb-logo-text { display: none; }
.dash-sidebar.collapsed .sb-logo-mark { margin: 0 auto; }
.dash-sidebar.collapsed .dsb-logo { justify-content: center; padding: .9rem .5rem; }
.dash-sidebar.collapsed .dsb-item,
.dash-sidebar.collapsed .sb-sec-hdr { justify-content: center; padding: .55rem; gap: 0; }
.dash-sidebar.collapsed .sb-user-card { padding: .75rem .5rem; justify-content: center; }
.dash-sidebar.collapsed .sb-user-av { margin: 0; }
.dash-sidebar.collapsed .sb-sec-divider { display: none; }
.dash-sidebar.collapsed .sb-collapse-btn svg { transform: rotate(180deg); }

/* Tooltip on collapsed items */
.dash-sidebar.collapsed .dsb-item { position: relative; }
.dash-sidebar.collapsed .dsb-item:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: .75rem;
  font-weight: 500;
  padding: .35rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  pointer-events: none;
  z-index: 999;
  border: 1px solid rgba(255,255,255,.08);
}

/* Collapsed sidebar: show admin link as icon only */
.dash-sidebar.collapsed .dsb-bottom a[href="admin.html"] span:not(:first-child) { display: none; }

/* ── LOGO ─────────────────────────────────────────────────── */
.dsb-logo {
  padding: .9rem 1rem .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.sb-logo-inner {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sb-logo-mark {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sb-logo-mark svg { width: 20px; height: 20px; stroke: none; }
.sb-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: .96rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.sb-logo-text em { font-style: normal; color: #818cf8; }
.sb-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #475569;
  padding: .3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.sb-collapse-btn:hover { color: #94a3b8; background: rgba(255,255,255,.05); }
.sb-collapse-btn svg { width: 16px; height: 16px; transition: transform .22s; }

/* ── SCROLLABLE NAV BODY ─────────────────────────────────── */
.dsb-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .5rem .75rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dsb-nav::-webkit-scrollbar { width: 3px; }
.dsb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

/* ── NAV ITEM (top-level flat link) ─────────────────────── */
.dsb-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .52rem .7rem;
  border-radius: 9px;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: .83rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
  width: 100%;
  text-align: left;
  position: relative;
}
.dsb-item:hover {
  background: rgba(255,255,255,.05);
  color: #cbd5e1;
}
.dsb-item.active {
  background: rgba(99,102,241,.12);
  color: #a5b4fc;
  font-weight: 600;
}
.dsb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: #6366f1;
  border-radius: 0 3px 3px 0;
}
.dsb-item .sb-label { flex: 1; }
.dsb-item .sb-svg-ic { flex-shrink: 0; opacity: .6; }
.dsb-item.active .sb-svg-ic { opacity: 1; }
.dsb-item:hover .sb-svg-ic { opacity: .85; }

/* ── SECTION DIVIDER ─────────────────────────────────────── */
.sb-sec-divider {
  height: 1px;
  background: rgba(255,255,255,.05);
  margin: .5rem 0;
}

/* ── COLLAPSIBLE SECTION ─────────────────────────────────── */
.sb-section { }

.sb-sec-hdr {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .48rem .7rem;
  border-radius: 9px;
  cursor: pointer;
  color: #64748b;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color .12s, background .12s;
  user-select: none;
}
.sb-sec-hdr:hover { color: #94a3b8; background: rgba(255,255,255,.03); }
.sb-sec-hdr.open { color: #94a3b8; }

.sb-sec-icon { flex-shrink: 0; opacity: .5; }
.sb-sec-hdr.open .sb-sec-icon { opacity: .7; }
.sb-sec-label { flex: 1; }

.sb-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform .2s cubic-bezier(.4,0,.2,1);
  opacity: .5;
}
.sb-sec-hdr.open .sb-chevron { transform: rotate(90deg); opacity: .7; }

/* Smooth slide open/close */
.sb-sec-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s cubic-bezier(.4,0,.2,1);
}
.sb-sec-body.open { max-height: 400px; }

/* ── SUB-ITEM ────────────────────────────────────────────── */
.sb-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .7rem .45rem 2.2rem;
  border-radius: 9px;
  background: none;
  border: none;
  color: #64748b;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
  width: 100%;
  text-align: left;
  position: relative;
}
.sb-item:hover { background: rgba(255,255,255,.04); color: #94a3b8; }
.sb-item.active {
  background: rgba(99,102,241,.10);
  color: #a5b4fc;
  font-weight: 600;
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 2px;
  background: #6366f1;
  border-radius: 0 2px 2px 0;
}

/* ── BADGES ──────────────────────────────────────────────── */
.sb-badge {
  margin-left: auto;
  background: #6366f1;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .38rem;
  border-radius: 20px;
  line-height: 1.4;
  flex-shrink: 0;
}
.sb-badge.green { background: #22c55e; }
.sb-badge.amber { background: #f59e0b; color: #000; }

/* ── SVG ICON ────────────────────────────────────────────── */
.sb-svg-ic {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

/* ── USER CARD (bottom) ──────────────────────────────────── */
.dsb-bottom {
  padding: .6rem .75rem .75rem;
  border-top: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}
.sb-user-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .6rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s;
}
.sb-user-card:hover { background: rgba(255,255,255,.05); }
.sb-user-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .03em;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name {
  font-size: .81rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-email {
  font-size: .7rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-plan-pill {
  font-size: .6rem;
  font-weight: 700;
  padding: .12rem .45rem;
  border-radius: 20px;
  background: rgba(99,102,241,.15);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,.2);
  white-space: nowrap;
  flex-shrink: 0;
}
.sb-plan-pill.free { background: rgba(100,116,139,.12); color: #64748b; border-color: rgba(100,116,139,.2); }
.sb-plan-pill.starter { background: rgba(99,102,241,.12); color: #818cf8; border-color: rgba(99,102,241,.2); }
.sb-plan-pill.pro { background: rgba(139,92,246,.12); color: #a78bfa; border-color: rgba(139,92,246,.2); }
.sb-plan-pill.agency { background: rgba(245,158,11,.1); color: #fbbf24; border-color: rgba(245,158,11,.2); }

.sb-upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: .52rem;
  margin-top: .4rem;
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 9px;
  color: #818cf8;
  font-size: .77rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.sb-upgrade-btn:hover { background: rgba(99,102,241,.2); color: #a5b4fc; }
.sb-upgrade-btn.hidden { display: none; }

/* ── MOBILE OVERLAY ──────────────────────────────────────── */
@media (max-width: 768px) {
  .dash-sidebar {
    position: fixed;
    left: -260px;
    z-index: 200;
    transition: left .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .dash-sidebar.mobile-open {
    left: 0;
    box-shadow: 4px 0 32px rgba(0,0,0,.5);
  }
}
