﻿.sidebar-modern {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    overflow-x: hidden;
    z-index: 1020;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

    .sidebar-modern::-webkit-scrollbar,
    .sidebar-offcanvas::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-modern::-webkit-scrollbar-track,
    .sidebar-offcanvas::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar-modern::-webkit-scrollbar-thumb,
    .sidebar-offcanvas::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

        .sidebar-modern::-webkit-scrollbar-thumb:hover,
        .sidebar-offcanvas::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.3);
        }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--sidebar-accent), var(--dash-primary));
    border-radius: var(--dash-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
    flex-shrink: 0;
}

.brand-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
    .sidebar-nav::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-nav::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

        .sidebar-nav::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.3);
        }

    .sidebar-nav .menu-items {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar-nav .menu-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        color: var(--sidebar-text);
        text-decoration: none;
        border-radius: 10px;
        font-size: 0.9375rem;
        font-weight: 500;
        transition: all 0.2s ease;
        position: relative;
    }

        .sidebar-nav .menu-link:hover {
            background: var(--sidebar-hover);
            color: white;
            transform: translateX(4px);
        }

        .sidebar-nav .menu-link.active {
            background: var(--sidebar-active);
            color: white;
            box-shadow: inset 3px 0 0 var(--sidebar-accent);
        }

        .sidebar-nav .menu-link i,
        .sidebar-nav .menu-link .menu-icon {
            width: 20px;
            text-align: center;
            font-size: 1.1rem;
            opacity: 0.85;
        }

        .sidebar-nav .menu-link.active i,
        .sidebar-nav .menu-link.active .menu-icon {
            opacity: 1;
            color: var(--sidebar-accent);
        }

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #868e96, #495057);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-name {
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 10px;
    color: #ff8787;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .btn-logout:hover {
        background: rgba(255, 107, 107, 0.25);
        border-color: rgba(255, 107, 107, 0.5);
        color: #ffa8a8;
        transform: translateY(-1px);
    }

    .btn-logout i {
        font-size: 1rem;
    }

.sidebar-offcanvas {
    width: 280px !important;
    max-width: 85vw;
    background: var(--sidebar-bg) !important;
    border-right: none !important;
    padding: 0 !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

    .sidebar-offcanvas .offcanvas-header {
        display: none;
    }

.sidebar-close-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--sidebar-border);
}

.btn-close-sidebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--dash-radius-sm);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .btn-close-sidebar:hover {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }

    .btn-close-sidebar i {
        font-size: 1rem;
    }

.sidebar-offcanvas .offcanvas-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-mobile-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

    .sidebar-mobile-body .sidebar-nav {
        flex: 1;
        overflow-y: auto;
    }

    .sidebar-mobile-body .sidebar-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex-shrink: 0;
        border-top: 1px solid var(--sidebar-border);
    }

.sidebar-offcanvas .sidebar-brand {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
    border-bottom: 1px solid var(--sidebar-border);
}

    .sidebar-offcanvas .sidebar-brand .brand-name {
        max-width: 180px;
    }

@media (min-width: 768px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-nav .menu-items li {
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

    .sidebar-nav .menu-items li:nth-child(1) {
        animation-delay: 0.05s;
    }

    .sidebar-nav .menu-items li:nth-child(2) {
        animation-delay: 0.1s;
    }

    .sidebar-nav .menu-items li:nth-child(3) {
        animation-delay: 0.15s;
    }

    .sidebar-nav .menu-items li:nth-child(4) {
        animation-delay: 0.2s;
    }

    .sidebar-nav .menu-items li:nth-child(5) {
        animation-delay: 0.25s;
    }

    .sidebar-nav .menu-items li:nth-child(6) {
        animation-delay: 0.3s;
    }

    .sidebar-nav .menu-items li:nth-child(7) {
        animation-delay: 0.35s;
    }

    .sidebar-nav .menu-items li:nth-child(8) {
        animation-delay: 0.4s;
    }

.sidebar-offcanvas.offcanvas-start {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.25s ease;
}

    .submenu-arrow.rotated {
        transform: rotate(180deg);
    }

.submenu {
    list-style: none;
    margin: 4px 0 0 0;
    padding: 5px 5px 5px 15px;
    overflow-y: auto;
    animation: submenuSlideIn 0.25s ease forwards;
}

@keyframes submenuSlideIn {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 400;
    border-radius: var(--dash-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-left: 12px;
    margin-bottom: 5px;
    border-left: 2px solid var(--sidebar-border);
}

    .submenu-link:hover {
        color: white;
        background: var(--sidebar-hover);
        border-left-color: var(--sidebar-accent);
    }

@media (max-width: 640px) {
    .sidebar-footer {
        padding: 8px;
    }

    .user-info {
        padding: 7px;
        margin-bottom: 8px;
    }

    .btn-logout {
        padding: 8px 16px;
    }
}
