#sidebar-nav {
    position: fixed;
    top: 50%;
    left: 30px;
    transform: translateY(-50%);
    z-index: 1000;
    height: 60vh;
    max-height: 500px;
    width: auto;
    max-width: 80px;
    overflow-y: hidden;
    overflow-x: hidden;
    transition: max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 12px;
    padding: 20px;
    background: transparent;
}

@media (min-width: 769px) {
    #sidebar-nav:hover {
        max-width: 300px;
        padding-right: 40px;
        overflow-y: auto;
        background: rgba(251, 251, 253, 0.95);
        backdrop-filter: blur(12px);
        box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    }

    #sidebar-nav:hover::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
    }

    #sidebar-nav:hover .sidebar-item::before {
        opacity: 0;
        transform: scaleX(0.5);
    }

    #sidebar-nav:hover .sidebar-tooltip {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
        transition-delay: 0.1s;
    }

    #sidebar-nav:hover .sidebar-item.active .sidebar-tooltip {
        color: var(--green);
        font-weight: 700;
    }

    #sidebar-nav:hover .sidebar-item:hover .sidebar-tooltip {
        color: var(--gray-800);
    }
}

#sidebar-nav::-webkit-scrollbar { width: 4px; }
#sidebar-nav::-webkit-scrollbar-track { background: transparent; }
#sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.08); border-radius: 4px; }

.sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-item {
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    align-items: center;
    justify-items: start;
    height: 14px;
    flex-shrink: 0;
}

.sidebar-item::before {
    content: '';
    grid-area: 1 / 1 / 2 / 2;
    display: block;
    height: 3px;
    border-radius: 2px;
    background: #D2D2D7;
    opacity: 1;
    transform: scaleX(1);
    transform-origin: left;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-item[data-level='slide']::before { width: 12px; }
.sidebar-item[data-level='lesson']::before { width: 24px; background: #B0B0B5; }
.sidebar-item[data-level='module']::before { width: 36px; background: #86868B; height: 4px; }

.sidebar-item.active::before {
    background: var(--green);
    box-shadow: 0 0 6px rgba(27, 138, 90, 0.3);
}

.sidebar-item[data-level='module'].active::before {
    background: var(--green);
    width: 42px;
}

.sidebar-tooltip {
    grid-area: 1 / 1 / 2 / 2;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    font-size: 0.85rem;
    line-height: 1;
    font-family: var(--font-primary);
    color: #86868B;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

@media (max-width: 768px) {
    #sidebar-nav {
        top: auto;
        bottom: 80px;
        left: 20px;
        transform: translateY(20px);
        opacity: 0;
        pointer-events: none;
        max-width: 250px;
        max-height: 60vh;
        background: rgba(251, 251, 253, 0.97);
        border: 1px solid rgba(0,0,0,0.06);
        overflow-y: auto;
        width: auto;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }

    #sidebar-nav.mobile-visible {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        padding-right: 30px;
    }

    #sidebar-nav.mobile-visible .sidebar-tooltip {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
        color: #86868B;
    }

    #sidebar-nav.mobile-visible .sidebar-item::before { opacity: 0; }

    #sidebar-nav.mobile-visible .sidebar-item.active .sidebar-tooltip {
        color: var(--green);
        font-weight: 700;
    }

    #sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: white;
        border: 1px solid rgba(0,0,0,0.06);
        z-index: 1001;
        cursor: pointer;
        color: #1D1D1F;
        transition: transform 0.2s;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    #sidebar-toggle:active { transform: scale(0.95); }
}

@media (min-width: 769px) {
    #sidebar-toggle { display: none; }
}
