/**
 * Sidebar layout styles
 * Note: nav-sidebar and category-sidebar (in main.css) are legacy.
 * sidebar-modern is the primary. On desktop, the legacy sidebars are hidden.
 */
@media (min-width: 992px) {
    .nav-sidebar,
    .category-sidebar {
        display: none !important;
    }
}

body.sidebar-collapsed {
    --sidebar-active-width: 0px;
    --sidebar-gap: 0px;
}

body {
    transition: padding-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: var(--sidebar-gap);
}

body.sidebar-collapsed {
    padding-left: 0;
}

.sidebar-modern {
    position: fixed;
    top: 15px;
    left: 15px;
    height: calc(100vh - 30px);
    width: var(--sidebar-width);
    background: var(--bg-sidebar) !important;
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.sidebar-header {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header .logo img {
    height: 40px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    scrollbar-width: none;
}

.sidebar-content::-webkit-scrollbar {
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 4px 15px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: #9ca3af !important;
    text-decoration: none !important;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    gap: 15px;
}

.sidebar-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(59, 130, 246, 0.1) !important;
    color: var(--primary) !important;
}

.sidebar-link:hover i, .sidebar-link.active i {
    color: var(--primary) !important;
}

.sidebar-dropdown-toggle {
    cursor: pointer;
}

.sidebar-dropdown-menu {
    list-style: none;
    padding-left: 55px;
    display: none;
}

.rotate-180 {
    transform: rotate(180deg);
}

.sidebar-dropdown-menu li a {
    padding: 8px 0;
    display: block;
    font-size: 0.9rem;
    color: #6b7280 !important;
    transition: color 0.3s;
}

.sidebar-dropdown-menu li a:hover {
    color: var(--primary) !important;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-right: 15px;
}

.sidebar-toggle-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.floating-sidebar-toggle {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2001;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 992px) {
    body.sidebar-collapsed .floating-sidebar-toggle {
        display: flex;
    }
}

.floating-sidebar-toggle:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.sidebar-user img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #6b7280;
}

@media (max-width: 991px) {
    :root {
        --sidebar-active-width: 0px !important;
        --sidebar-gap: 0px !important;
    }

    body { padding-left: 0 !important; }

    .sidebar-modern {
        transform: translateX(-100%);
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        border-radius: 0 !important;
        z-index: 2005 !important;
        width: 280px !important;
    }

    body.sidebar-opened .sidebar-modern {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.7);
        z-index: 2004;
        display: none;
    }

    body.sidebar-opened .sidebar-overlay {
        display: block;
    }

    .sidebar-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        margin-right: 0 !important;
    }

    .mobile-menu {
        background: rgba(10, 10, 10, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        border-top: 1px solid var(--border-light) !important;
        z-index: 1001 !important;
        height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
    }

    .mobile-menu a, .mobile-menu button {
        color: #9ca3af !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        font-size: 10px !important;
        gap: 4px !important;
        transition: all 0.3s ease !important;
    }

    .mobile-menu a i, .mobile-menu button i {
        font-size: 1.25rem !important;
        color: #d1d5db !important;
    }

    .mobile-menu a.active, .mobile-menu a:hover,
    .mobile-menu button:hover, .mobile-menu button.active {
        color: var(--primary) !important;
    }

    .mobile-menu a.active i, .mobile-menu a:hover i,
    .mobile-menu button:hover i, .mobile-menu button.active i {
        color: var(--primary) !important;
    }
}

@media (max-width: 380px) {
    .sidebar-toggle-btn {
        width: 34px !important;
        height: 34px !important;
    }
}
