/* ============================================================
   Sidebar Tree Navigation
   Left-side collapsible tree with +/− toggles at every level.
   ============================================================ */

/* ── Layout wrapper ────────────────────────────────────────── */
#app-layout {
    display: flex;
    height: calc(100vh - 48px);
    overflow: hidden;
}

#main-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#main-content .tab-content {
    height: 100%;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #0d1117;
    border-right: 1px solid #1e293b;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #1e293b transparent;
}

#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }

/* ── Hamburger toggle (mobile only) ────────────────────────── */
#sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

#sidebar-toggle:hover {
    color: #f1f5f9;
}

/* ── Tree: Category level (AI & LLM, Net & Security, DevOps) ── */
.tree-cat {
    border-bottom: 1px solid #1e293b;
}

.tree-cat-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}

.tree-cat-toggle:hover {
    background: rgba(30, 41, 59, 0.5);
    color: #f1f5f9;
}

.tree-cat.active > .tree-cat-toggle {
    color: #f1f5f9;
}

.tree-cat-toggle .tree-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: rgba(51, 65, 85, 0.5);
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    font-family: monospace;
}

.tree-cat.expanded > .tree-cat-toggle .tree-icon {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.tree-cat-toggle .tree-emoji {
    font-size: 14px;
    flex-shrink: 0;
}

/* ── Tree: Category children (hidden by default) ────────────── */
.tree-cat > .tree-children {
    display: none;
    padding-left: 6px;
}

.tree-cat.expanded > .tree-children {
    display: block;
}

/* ── Tree: Section level (Claude Code, Network Fundamentals, etc.) ── */
.tree-sec {
    /* No border — clean nesting */
}

.tree-sec-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px 10px 6px 16px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 7px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}

.tree-sec-toggle:hover {
    background: rgba(30, 41, 59, 0.4);
    color: #e2e8f0;
}

.tree-sec-toggle .tree-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: rgba(51, 65, 85, 0.35);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    font-family: monospace;
}

.tree-sec.expanded > .tree-sec-toggle .tree-icon {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.tree-sec-toggle .tree-count {
    margin-left: auto;
    font-size: 9px;
    font-weight: 600;
    color: #475569;
    background: rgba(51, 65, 85, 0.3);
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0;
    text-transform: none;
}

/* ── Tree: Section children ──────────────────────────────────── */
.tree-sec > .tree-children {
    display: none;
    padding-left: 8px;
}

.tree-sec.expanded > .tree-children {
    display: block;
}

/* ── Tree: Leaf items (individual topics) ───────────────────── */
.tree-leaf {
    display: block;
    width: 100%;
    padding: 4px 10px 4px 32px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-leaf:hover {
    background: rgba(30, 41, 59, 0.6);
    color: #e2e8f0;
}

.tree-leaf.active {
    background: rgba(99, 102, 241, 0.12);
    color: #c4b5fd;
    font-weight: 500;
    border-left: 2px solid #8b5cf6;
    padding-left: 30px;
}

/* ── NetSec accent for active leaf ───────────────────────────── */
.tree-cat[data-tab="netsec"] .tree-leaf.active {
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
    border-left-color: #06b6d4;
}

/* ── DevOps accent for active leaf ───────────────────────────── */
.tree-cat[data-tab="devops"] .tree-leaf.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border-left-color: #6366f1;
}

/* ── Life & Philosophy accent for active leaf ────────────────── */
.tree-cat[data-tab="life"] .tree-leaf.active {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-left-color: #f59e0b;
}

/* ── Life Canvas ─────────────────────────────────────────────── */
#life-canvas {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: #0f172a;
}

/* ── Hide platform tabs on desktop (sidebar replaces them) ──── */
@media (min-width: 768px) {
    .platform-tabs {
        display: none;
    }
}
