/* ===== Mobile Sidebar - Slide from Side ===== */
@media (max-width: 767.98px) {
    /* Mobile top bar */
    .mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #1e3a5f;
        z-index: 1040;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .mobile-topbar .mobile-menu-btn {
        background: none;
        border: none;
        color: #fff;
        font-size: 24px;
        padding: 5px;
        cursor: pointer;
    }
    
    .mobile-topbar .mobile-brand img {
        max-height: 32px;
    }
    
    .mobile-topbar .mobile-user-menu {
        display: flex;
        align-items: center;
    }
    
    .mobile-topbar .mobile-user-menu .avatar {
        width: 32px;
        height: 32px;
    }
    
    /* Add top padding to main content */
    .main-content {
        margin-left: 0 !important;
        padding-top: 66px !important;
        transition: none;
    }
    
    /* Sidebar as overlay from left */
    .navbar-vertical.navbar-expand-md {
        position: fixed !important;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
    }
    
    .navbar-vertical.navbar-expand-md.show {
        left: 0;
    }
    
    /* Hide default sidebar toggle row on mobile */
    .navbar-vertical [system-usernav] {
        display: none !important;
    }
    
    /* Backdrop overlay */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
    }
    
    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
    }
    
    /* Collapse menu always visible when sidebar is open */
    .navbar-vertical.show .navbar-collapse {
        display: block !important;
    }
    
    /* Ensure sidebar stays on top */
    .navbar-vertical .container-fluid {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .navbar-vertical .navbar-collapse {
        flex: 1;
        overflow-y: auto;
    }
}

/* Hide mobile topbar on desktop */
.mobile-topbar {
    display: none;
}

/* RTL Support for Sidebar */
[dir="rtl"] .navbar-vertical.navbar-expand-md,
.rtl .navbar-vertical.navbar-expand-md,
html[lang="ar"] .navbar-vertical.navbar-expand-md {
    left: auto;
    right: -100%;
}

[dir="rtl"] .navbar-vertical.navbar-expand-md.show,
.rtl .navbar-vertical.navbar-expand-md.show,
html[lang="ar"] .navbar-vertical.navbar-expand-md.show {
    right: 0;
    left: auto;
}

