/* Infludar — Sidebar Navigation v2 */

/* Layout helpers */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar shell ───────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  z-index: 100;
}
.sidebar.collapsed { width: 60px; }

/* ── Header ──────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 58px;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: -0.3px;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}
.sidebar-bolt {
  display: inline-flex;
  -webkit-text-fill-color: initial;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(124,92,252,0.4));
  flex-shrink: 0;
}
.sidebar-logo-text {
  overflow: hidden;
  transition: opacity .2s, max-width .25s;
  max-width: 140px;
}
.sidebar.collapsed .sidebar-logo-text { opacity: 0; max-width: 0; }

.sidebar-toggle {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  color: var(--text-muted);
  transition: border-color .2s, color .2s, transform .25s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { border-color: var(--border-hover); color: var(--text-sec); }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

/* ── Nav ─────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

/* Item + group head — shared base */
.sn-item, .sn-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-sec);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}
.sn-item:hover, .sn-group-head:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.sn-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: rgba(124,92,252,0.18);
}

.sn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
}
.sn-label {
  overflow: hidden;
  transition: opacity .15s, max-width .25s;
  max-width: 160px;
}
.sidebar.collapsed .sn-label { opacity: 0; max-width: 0; }

/* ── Group head: link area + chevron toggle ─────── */
.sn-head-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}
.sn-chevron {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: transform .2s, background .15s, opacity .2s, max-width .25s;
  color: var(--text-muted);
}
.sn-chevron:hover { background: rgba(255,255,255,0.08); }
.sn-group.open > .sn-group-head .sn-chevron { transform: rotate(180deg); }
.sidebar.collapsed .sn-chevron { opacity: 0; max-width: 0; padding: 0; }

/* ── Platform-colored group heads ─────── */
#grpTwitch > .sn-group-head .sn-icon { color: var(--twitch); }
#grpYoutube > .sn-group-head .sn-icon { color: var(--yt); }

#grpTwitch > .sn-group-head .sn-label { color: var(--text-sec); transition: color .15s; }
#grpYoutube > .sn-group-head .sn-label { color: var(--text-sec); transition: color .15s; }

#grpTwitch > .sn-group-head:hover .sn-label,
#grpTwitch > .sn-group-head.active .sn-label { color: var(--text); }
#grpYoutube > .sn-group-head:hover .sn-label,
#grpYoutube > .sn-group-head.active .sn-label { color: var(--text); }

/* Active group head — platform glow */
#grpTwitch > .sn-group-head.active {
  background: var(--twitch-glow);
  border-color: rgba(145,70,255,0.2);
}
#grpTwitch > .sn-group-head.active .sn-icon {
  filter: drop-shadow(0 0 6px rgba(145,70,255,0.5));
}

#grpYoutube > .sn-group-head.active {
  background: rgba(255,68,68,0.08);
  border-color: rgba(255,68,68,0.18);
}
#grpYoutube > .sn-group-head.active .sn-icon {
  filter: drop-shadow(0 0 6px rgba(255,68,68,0.5));
}

/* Open group — subtle left accent */
#grpTwitch.open { border-left: 2px solid var(--twitch); border-radius: 0 8px 8px 0; margin-left: -2px; }
#grpYoutube.open { border-left: 2px solid var(--yt); border-radius: 0 8px 8px 0; margin-left: -2px; }

/* ── Sub-items ───────────────────────── */
.sn-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 18px;
}
.sn-group.open > .sn-group-body { max-height: 160px; }
.sidebar.collapsed .sn-group-body { padding-left: 4px; }
.sidebar.collapsed .sn-group.open > .sn-group-body { max-height: 160px; }

.sn-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sn-sub:hover {
  color: var(--text-sec);
  background: rgba(255,255,255,0.04);
}
.sn-sub-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity .15s;
}
.sn-sub:hover .sn-sub-icon { opacity: 0.85; }

/* Active sub — Twitch */
.sn-sub.active-tw {
  color: var(--twitch);
  background: linear-gradient(90deg, rgba(145,70,255,0.14), rgba(145,70,255,0.06));
  border-left: 2px solid var(--twitch);
  padding-left: 8px;
}
.sn-sub.active-tw .sn-sub-icon {
  color: var(--twitch);
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(145,70,255,0.4));
}

/* Active sub — YouTube */
.sn-sub.active-yt {
  color: var(--yt);
  background: linear-gradient(90deg, rgba(255,68,68,0.14), rgba(255,68,68,0.06));
  border-left: 2px solid var(--yt);
  padding-left: 8px;
}
.sn-sub.active-yt .sn-sub-icon {
  color: var(--yt);
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255,68,68,0.4));
}

/* Divider */
.sn-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 8px 10px;
  flex-shrink: 0;
}

/* ── Status dots ─────────────────────── */
.sidebar-status {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  overflow: hidden;
}
.sn-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.sn-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-hover); flex-shrink: 0;
  transition: background .4s, box-shadow .4s;
}
.sn-dot.active {
  background: var(--green);
  box-shadow: 0 0 5px rgba(34,197,94,0.5);
  animation: pulse 2s infinite;
}
.sn-dot.error { background: var(--red); }
.sn-status-label { overflow: hidden; transition: opacity .15s, max-width .25s; max-width: 100px; }
.sidebar.collapsed .sn-status-label { opacity: 0; max-width: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Footer ──────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px 8px;
  flex-shrink: 0;
}
.sn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  width: 100%;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  overflow: hidden;
}
.sn-logout:hover {
  border-color: rgba(248,113,113,0.25);
  color: var(--red);
  background: rgba(248,113,113,0.06);
}
.sn-logout-label { overflow: hidden; max-width: 120px; transition: opacity .15s, max-width .25s; }
.sidebar.collapsed .sn-logout-label { opacity: 0; max-width: 0; }

/* ── Mobile ──────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(17,17,25,0.9);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
}
.mobile-menu-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  color: var(--text-sec); transition: all .2s;
}
.mobile-menu-btn:hover { border-color: var(--border-hover); color: var(--text); }
.mobile-logo {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100%;
    transform: translateX(-100%);
    transition: transform .25s ease, width .25s ease;
    width: 220px !important;
    z-index: 100;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .sidebar-toggle { display: none; }
}
