@media (min-width: 1025px) {
    body.has-sidebar {
        padding-right: 320px;
        /* Shift content to make room for fixed sidebar */
        transition: padding-right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    body.sidebar-collapsed {
        padding-right: 0;
    }
}

.app-sidebar {
    width: 320px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    height: 100vh;
    padding: 20px;
    position: fixed;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

body.sidebar-collapsed .app-sidebar {
    transform: translateX(350px);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header p {
    font-size: 0.75rem !important;
    color: #64748b;
    margin-top: 0;
}

.app-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    margin: 5px 0;
    flex: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Sidebar */
.app-list::-webkit-scrollbar {
    width: 5px;
}

.app-list::-webkit-scrollbar-track {
    background: transparent;
}

.app-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: background 0.3s;
}

.app-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-ad-box {
    width: 100%;
    height: 120px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin: 5px 0px 5px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sidebar-ad-box::after {
    content: 'Advertisement Slot';
    font-size: 0.7rem;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.app-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.app-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #43e97b;
    color: #f8fafc;
    transform: translateX(5px);
}

.app-link.active {
    background: rgba(67, 233, 123, 0.1);
    border-color: #43e97b;
    color: #43e97b;
}

.app-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* Sidebar Mobile Toggle (Breadcrumb/Hamburger) */
.sidebar-toggle {
    display: flex;
    /* Always show toggle */
    position: fixed;
    top: 15px;
    /* Moved slightly up */
    right: 15px;
    width: 42px;
    height: 42px;
    background: rgba(15, 23, 42, 0.8);
    /* Darker background for visibility */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    z-index: 1100;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.breadcrumb-bar {
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.sidebar-toggle.active .breadcrumb-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.sidebar-toggle.active .breadcrumb-bar:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle.active .breadcrumb-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    body.has-sidebar {
        padding-right: 0 !important;
        overflow-x: hidden;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-backdrop {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        right: -350px;
        top: 0;
        height: 100vh;
        width: 320px;
        border-right: none;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
    }

    .app-sidebar.open {
        transform: translateX(-350px);
    }

    .app-list {
        flex-direction: column;
        overflow-y: auto;
    }

    .app-link {
        flex-shrink: 0;
    }
}