/* ============================================
   SIDEBAR - Hierarchical Tree Navigation
   ============================================ */

/* Sidebar header */
.sidebar-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}
.sidebar-app-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-light);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav groups (top-level: Cadrage, Modules, Consolidation, Synthèse) */
.nav-group { padding: 0.4rem 0; }
.nav-group + .nav-group { border-top: 1px solid var(--border); }

.nav-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    margin-bottom: 0.15rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    user-select: none;
    transition: color var(--transition-fast);
}
.nav-group-title:hover { color: var(--text-bright); }

/* Chevron icon for expand/collapse */
.nav-chevron {
    font-size: 0.6rem;
    display: inline-block;
    transition: transform var(--transition-fast);
    color: var(--text-muted);
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}
.nav-chevron.expanded { transform: rotate(90deg); }

/* Nav items (leaf nodes) */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.nav-item.active {
    background: rgba(99,102,241,0.1);
    border-left-color: var(--primary);
    color: var(--primary-light);
    font-weight: 500;
}

.nav-item .nav-icon {
    font-size: 0.45rem;
    width: 12px;
    text-align: center;
    color: var(--border-light);
    flex-shrink: 0;
}
.nav-item .nav-badge {
    margin-left: auto;
    font-size: 0.6rem;
    background: var(--bg-hover);
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    color: var(--text-muted);
    min-width: 16px;
    text-align: center;
}

/* Nested children (indented) */
.nav-children { margin-left: 0; }
.nav-children .nav-item { padding-left: 1.6rem; font-size: 0.8rem; }
.nav-children .nav-children .nav-item { padding-left: 2.4rem; font-size: 0.78rem; }
.nav-children .nav-children .nav-children .nav-item { padding-left: 3rem; font-size: 0.75rem; }

/* Module header in nav (collapsible) */
.nav-module-header {
    font-weight: 500;
    color: var(--text-bright);
    font-size: 0.85rem;
}
.nav-module-header:hover { color: var(--primary-light); }

/* Section/Resource items in nav */
.nav-section-item { margin-top: 0.1rem; }
.nav-section-link { font-style: italic; }
.nav-icon-section { font-size: 0.5rem; color: var(--accent); }
.nav-icon-resource { font-size: 0.7rem; color: var(--border-light); }
.nav-resource-link {
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}
.nav-resource-link:hover { background: var(--bg-hover); color: var(--accent); }
.nav-resources { margin-left: 0.5rem; }
