/* ===== SIDEBAR ===== */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    flex-direction: column;
    z-index: 1000;
    transition:
        transform 0.3s ease,
        width 0.3s ease;
    overflow: hidden;
}

#sidebar.collapsed {
    transform: translateX(-100%);
}

/* ===== SIDEBAR SEARCH ===== */
.sidebar-search {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-primary);
}
.sidebar-search .form-control {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    border-radius: 8px;
    padding: 8px 12px;
    width: 100%;
    transition: border-color 0.2s;
}
.sidebar-search .form-control::placeholder {
    color: var(--text-muted);
}
.sidebar-search .form-control:focus {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.1);
    outline: none;
}

/* ===== NAV MENU ===== */
#sidebar .nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-bottom: 2rem;
    margin: 0;
}

#sidebar .nav-item,
#sidebar .submenu li {
    margin: 0 !important;
    padding: 0 !important;
}

#sidebar .nav-link.menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: none;
    border-radius: 0;
    transition: all 0.18s ease;
    white-space: nowrap;
    border-left: 2px solid transparent;
    line-height: 1.4;
}

#sidebar .nav-link.menu:hover {
    background: rgba(79, 142, 247, 0.06);
    color: var(--text-primary);
    border-left-color: rgba(79, 142, 247, 0.3);
}

#sidebar .nav-link.menu.active {
    background: rgba(79, 142, 247, 0.1);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    font-weight: 500;
}

#sidebar .nav-link.menu i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== SUBMENU TOGGLE ARROW ===== */
#sidebar .nav-link.menu .arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    color: var(--text-muted);
    width: auto;
}

#sidebar .has-submenu.open > .nav-link.menu .arrow {
    transform: rotate(180deg);
}

/* ===== SUBMENU ===== */
.submenu {
    max-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
    border-left: 2px solid var(--border-primary);
    margin-left: 16px;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.has-submenu.open .submenu {
    max-height: 300px;
}

.submenu li a.nav-link.menu {
    padding: 6px 14px 6px 12px;
    font-size: 0.825rem;
    color: var(--text-secondary);
    border-left: none;
    margin: 0;
}
.submenu li a.nav-link.menu:hover {
    color: var(--text-primary);
    background: rgba(79, 142, 247, 0.05);
    border-left: none;
}
.submenu li a.nav-link.menu.active {
    color: var(--accent-blue);
    background: rgba(79, 142, 247, 0.08);
}

/* ===== SECTION LABEL ===== */
.nav-section-label {
    padding: 10px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ===== OVERLAY (mobile) ===== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #sidebar.collapsed {
        transform: translateX(-100%);
    }
    .overlay {
        display: block;
        opacity: 0;
    }
}
