/* ══════════════════════════════════════════════════════════
   SIDEBAR  —  Stitch Design System
   #0b1c30 bg · #25D366 WhatsApp Green · Plus Jakarta Sans
══════════════════════════════════════════════════════════ */

#sidebar {
  width: 240px;
  min-width: 240px;
  background: #0b1c30;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: width .22s cubic-bezier(.4,0,.2,1), min-width .22s;
  border-right: 1px solid rgba(37,211,102,.08);
}

/* ── Collapsed state (icon-only) ─────────────────────── */
#sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}
#sidebar.collapsed .sidebar-brand-text,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-section-label,
#sidebar.collapsed .sidebar-profile-info,
#sidebar.collapsed .sidebar-footer-label {
  display: none;
}
#sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 0 16px;
}
/* Collapse button: hidden when collapsed — click logo to expand */
#sidebar.collapsed .sidebar-collapse-btn {
  display: none;
}
#sidebar.collapsed .sidebar-logo:hover {
  box-shadow: 0 4px 18px rgba(37,211,102,.6);
  transform: scale(1.08);
  transition: box-shadow .15s, transform .15s;
}
#sidebar.collapsed .sidebar-nav-item {
  justify-content: center;
  padding: 10px 0;
  width: 64px;
}
#sidebar.collapsed .sidebar-nav-item .nav-icon { width: auto; }
#sidebar.collapsed .sidebar-footer-item {
  justify-content: center;
  padding: 10px 0;
  width: 64px;
}
#sidebar.collapsed .sidebar-profile-row {
  justify-content: center;
  padding: 10px 0;
  width: 64px;
}
#sidebar.collapsed .sidebar-chevron { display: none; }
#sidebar.collapsed .sidebar-section-label { height: 0; margin: 0; padding: 0; overflow: hidden; }
#sidebar.collapsed .sidebar-section { gap: 0; }
#sidebar.collapsed .sidebar-dropdown { left: 72px; }
#sidebar.collapsed .theme-toggle-btn { justify-content: center; padding: 10px 0; width: 64px; }

/* ── Brand ───────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  position: relative;
}

.sidebar-logo {
  width: 34px; height: 34px;
  background: #25D366;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37,211,102,.4);
}

.sidebar-brand-text { flex: 1; min-width: 0; }

.sidebar-brand-name {
  font-size: 14.5px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #ffffff;
  letter-spacing: -.2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-tagline {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(255,255,255,.28);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-top: 1px;
  white-space: nowrap;
}

.sidebar-collapse-btn {
  width: 24px; height: 24px;
  background: rgba(255,255,255,.06);
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,.35);
  flex-shrink: 0;
  transition: background .15s, color .15s;
  padding: 0;
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
}

/* ── Nav ─────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 6px 8px 4px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

/* ── Section group ───────────────────────────────────── */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 6px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 3px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .15s;
}

/* ── Nav item ────────────────────────────────────────── */
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  width: 100%;
  color: rgba(255,255,255,.42);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  transition: background .13s, color .13s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  font-family: 'Inter', sans-serif;
}

.sidebar-nav-item .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-nav-item .nav-label {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
  letter-spacing: -.1px;
  white-space: nowrap;
}

.sidebar-nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}

/* Active = WhatsApp green left-accent (Stitch: border-l-4 border-primary-container) */
.sidebar-nav-item.active {
  background: rgba(37,211,102,.10);
  color: #25D366;
  border-left: 4px solid #25D366;
  padding-left: 7px;
}
.sidebar-nav-item.active .nav-label { font-weight: 600; }
.sidebar-nav-item.active:hover { background: rgba(37,211,102,.15); }

/* ── Footer ──────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.sidebar-footer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  width: 100%;
  color: rgba(255,255,255,.38);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  outline: none;
}
.sidebar-footer-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.75); }

/* ── Profile row ─────────────────────────────────────── */
.sidebar-profile-wrap { position: relative; }

.sidebar-profile-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.sidebar-profile-row:focus-visible { outline: 2px solid rgba(37,211,102,.5); }
.sidebar-profile-row:hover { background: rgba(255,255,255,.06); }

.sidebar-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-profile-info { flex: 1; min-width: 0; text-align: left; overflow: hidden; }

.sidebar-profile-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
}

.sidebar-profile-role {
  font-size: 10px;
  color: rgba(255,255,255,.32);
  text-transform: capitalize;
  margin-top: 1px;
  font-family: 'Inter', sans-serif;
}

.sidebar-chevron {
  flex-shrink: 0;
  color: rgba(255,255,255,.28);
  transition: transform .2s;
}

/* ── Dropdown ────────────────────────────────────────── */
.sidebar-dropdown {
  display: none;
  position: fixed;
  bottom: 72px;
  left: 248px; /* expanded: 240px sidebar + 8px gap */
  width: 224px;
  background: #152236;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  z-index: 400;
  overflow: hidden;
}
.sidebar-dropdown.open { display: block; }

.sidebar-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-dd-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-dd-name {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
}

.sidebar-dd-email {
  font-size: 11px;
  color: rgba(255,255,255,.38);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 148px;
  font-family: 'Inter', sans-serif;
}

.sidebar-dropdown-divider { height: 1px; background: rgba(255,255,255,.07); }

.sidebar-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.68);
  text-align: left;
  transition: background .12s;
  font-family: 'Inter', sans-serif;
}
.sidebar-dd-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.sidebar-dd-item svg { color: rgba(255,255,255,.3); flex-shrink: 0; }

.sidebar-dd-logout { color: #fca5a5; }
.sidebar-dd-logout:hover { background: rgba(239,68,68,.12); color: #f87171; }
.sidebar-dd-logout svg { color: #f87171; }

/* ── Agent Status ─────────────────────────────────────── */
.sidebar-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0b1c30;
  display: none;
}
.sidebar-status-dot.online { background: #22c55e; display: block; }
.sidebar-status-dot.away   { background: #f59e0b; display: block; }
.sidebar-status-dot.busy   { background: #ef4444; display: block; }

.sidebar-dd-status-wrap {
  padding: 10px 14px 8px;
}
.sidebar-dd-status-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: 7px;
}
.sidebar-dd-status-btns {
  display: flex;
  gap: 6px;
}
.status-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 4px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.6);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.status-btn:hover { background: rgba(255,255,255,.09); color: #fff; border-color: rgba(255,255,255,.2); }
.status-btn.active { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: #22c55e; }
.status-dot.away   { background: #f59e0b; }
.status-dot.busy   { background: #ef4444; }

/* ══════════════════════════════════════════════════════════
   MOBILE
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar { display: none; }
}
