/* Mobile Menu Styles */
@media (max-width: 767.98px) {
    /* Add some spacing to the mobile menu area */
    .navbar-collapse {
        padding-top: 0.5rem;
        position: absolute;
        top: 56px; /* Match navbar height */
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1049; /* Above content but below sidebar */
        padding: 10px 15px;
        border-radius: 0 0 5px 5px;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Style the user info section */
    .mobile-user-info {
        padding: 10px 0;
        margin-bottom: 10px;
    }
    
    /* Style the mini user info in header */
    .mobile-user-info-header {
        font-size: 0.85rem;
        margin-right: 8px;
        background-color: rgba(0, 0, 0, 0.05);
        padding: 2px 8px;
        border-radius: 15px;
    }
    
    /* Improve dark mode toggle appearance on mobile */
    #darkModeToggleMobile {
        margin-right: 5px;
    }
    
    /* Make the menu items easier to tap */
    .navbar-nav .nav-item {
        padding: 8px 0;
    }
    
    /* Mobile navbar toggle button (ellipsis menu) */
    .navbar-toggler {
        padding: 0.25rem 0.6rem; 
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }
    
    /* Format mobile buttons in line */
    #mobileMenuToggle, .navbar-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 32px;
        width: 32px;
    }
    
    /* Prevent navbar menu from affecting page layout */
    .navbar-collapse.show + .main-content {
        margin-top: 0 !important;
    }
}

/* Fix for mobile device sidebar animation */
@media (max-width: 767.98px) {
    /* Style for floating sidebar in mobile view */
    .sidebar {
        transition: transform 0.3s ease-in-out;
        transform: translateX(-100%);
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        z-index: 1050 !important; /* Higher than navbar */
        width: 80% !important; /* Slightly narrower for mobile */
        max-width: 280px !important;
        overflow-y: auto !important;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2) !important;
        background-color: #f8f9fa !important; /* Match your app's sidebar color */
        padding-top: 60px !important; /* Space for navbar */
    }
    
    /* When sidebar is shown */
    .sidebar.show {
        transform: translateX(0) !important;
    }
    
    /* DO NOT shift main content - sidebar floats over it */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        transition: none !important;
    }
    
    /* Overlay to darken the rest of the screen */
    #sidebar-overlay {
        background-color: rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(2px);
        z-index: 1040 !important; /* Below sidebar but above content */
    }
    
    /* Fixed navbar in mobile view */
    .navbar {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        z-index: 1045 !important; /* Above overlay but below sidebar */
    }
    
    /* Add padding to body to account for fixed navbar */
    body {
        padding-top: 56px !important; /* Match navbar height */
    }
    
    /* Always keep navbar brand and user menu visible */
    .navbar-brand,
    .navbar .dropdown-toggle {
        position: relative;
        z-index: 1060 !important; /* Above everything */
    }
}