.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--white);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    border-right: 1px solid var(--gray-light);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .nav-submenu,
.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.875rem;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--gray-light);
    background: linear-gradient(135deg, var(--primary-color-1) 0%, var(--primary-color-2) 100%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon-wrapper {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 100%;
    height: 100%;
    color: var(--text-color);
}

.sidebar-logo .logo-text {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-color);
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.5);
}

.toggle-icon {
    width: 18px;
    height: 18px;
    color: var(--text-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--gray-dark);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.nav-item {
    margin: 0.125rem 0;
    display: block;
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-link:hover {
    background: var(--gray-light);
    border-left-color: var(--accent-color);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.1) 0%, transparent 100%);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: inherit;
}

.nav-text {
    flex: 1;
    font-size: 0.9375rem;
}

.nav-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.nav-group-toggle[aria-expanded="true"] .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--gray-light);
}

.nav-submenu.open {
    max-height: 500px;
}

.nav-subitem {
    margin: 0;
}

.nav-sublink {
    display: block;
    padding: 0.625rem 1.25rem 0.625rem 3.5rem;
    color: var(--gray-dark);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-sublink::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gray-dark);
}

.nav-sublink:hover {
    color: var(--accent-color);
    background: rgba(26, 115, 232, 0.05);
}

.nav-sublink:hover::before {
    background: var(--accent-color);
}

.nav-sublink.active {
    color: var(--accent-color);
    font-weight: 600;
}

.nav-sublink.active::before {
    background: var(--accent-color);
}

.nav-sublink.nav-subgroup-toggle {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem 0.625rem 2rem;
    font-weight: 500;
}

.nav-sublink.nav-subgroup-toggle::before {
    display: none;
}

.nav-subicon {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.nav-subarrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.nav-subgroup-toggle[aria-expanded="true"] .nav-subarrow {
    transform: rotate(90deg);
}

.nav-subsubmenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.02);
}

.nav-subsubmenu.open {
    max-height: 300px;
}

.nav-subsubitem {
    margin: 0;
}

.nav-subsublink {
    display: block;
    padding: 0.5rem 1.25rem 0.5rem 4.5rem;
    color: var(--gray-dark);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-subsublink::before {
    content: '';
    position: absolute;
    left: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gray);
}

.nav-subsublink:hover {
    color: var(--accent-color);
    background: rgba(26, 115, 232, 0.05);
}

.nav-subsublink:hover::before {
    background: var(--accent-color);
}

.nav-subsublink.active {
    color: var(--accent-color);
    font-weight: 600;
}

.nav-subsublink.active::before {
    background: var(--accent-color);
}

.sidebar-footer {
    border-top: 1px solid var(--gray-light);
    padding: 1rem;
    background: var(--gray-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--text-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-text {
    color: var(--white);
    font-weight: bold;
    font-size: 1rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-dark);
    text-transform: capitalize;
}

.logout-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border: 1px solid var(--gray);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
    color: var(--gray-dark);
}

.logout-btn:hover {
    background: var(--error);
    border-color: var(--error);
}

.logout-btn:hover svg {
    color: var(--white);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}
