/* ==========================================================================
   Mobile Sidebar & Header Layout (Responsive)
   ========================================================================== */

/* Initially hidden elements for desktop */
.mobile-menu-toggle,
.mobile-sidebar-header,
.mobile-overlay {
    display: none;
}

/* Default desktop behavior for right col: contents will display inline */
.header-right-col {
    display: contents;
}

.mobile-sidebar-content {
    display: contents;
}

.mobile-dashboard-menu {
    display: none;
}

@media (max-width: 980px) {
    .mobile-dashboard-menu {
        display: block;
    }
    
    .mobile-dashboard-menu .sidebar-menu {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-top: -8px; /* Pulls it up slightly */
    }


    /* Header layout changes */
    .header-inner {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: relative;
        min-height: 64px;
        padding: 0 16px !important;
    }

    .mobile-menu-toggle {
        display: flex;
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 8px;
        align-items: center;
        justify-content: center;
        margin-left: -8px;
        border-radius: 8px;
        transition: background 0.2s;
    }

    .mobile-menu-toggle:active {
        background: rgba(0, 0, 0, 0.05);
    }

    .header-inner .brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        padding: 6px;
    }

    /* Sidebar container */
    .header-right-col {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: var(--surface);
        z-index: 1001;
        transition: left 0.35s cubic-bezier(0.25, 1, 0.5, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
    }

    .header-right-col.active {
        left: 0;
    }

    /* Sidebar internal layout */
    .mobile-sidebar-header {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid var(--line);
        position: relative;
        min-height: 72px;
    }

    .mobile-sidebar-header .brand-text {
        font-size: 16px;
        font-weight: 800;
        color: var(--text);
        letter-spacing: -0.02em;
    }

    .mobile-sidebar-close {
        position: absolute;
        right: 16px;
        background: rgba(0, 0, 0, 0.04);
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s;
    }

    .mobile-sidebar-close:hover,
    .mobile-sidebar-close:active {
        background: rgba(0, 0, 0, 0.08);
        color: var(--danger, #dc2626);
    }

    .mobile-sidebar-content {
        display: flex;
        flex-direction: column;
        padding: 24px 20px;
        gap: 32px;
        overflow-y: auto;
        flex: 1;
    }

    /* Search inside sidebar */
    .top-search {
        display: flex !important;
        flex-direction: row;
        width: 100% !important;
        margin-top: 0;
        gap: 8px;
        position: relative;
    }

    .top-search input[type="search"] {
        flex: 1;
        width: 100% !important;
        border-radius: 12px;
        background: #f8fafc;
        border: 1px solid rgba(15, 23, 42, 0.1);
        padding: 12px 16px;
        font-size: 14px;
    }

    .top-search .btn {
        border-radius: 12px;
        padding: 12px 16px;
        font-weight: 600;
    }

    .suggest {
        display: none !important;
        /* Hide suggestions in mobile for cleaner look unless customized */
    }

    /* Auth & Nav links inside sidebar */
    .auth {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 12px !important;
        margin-top: 24px !important;
        padding-bottom: 24px; /* Ensure some space at the very bottom of scrolling list */
    }

    .auth .btn,
    .auth .nav-link {
        width: 100% !important;
        justify-content: center !important;
        padding: 14px 20px !important;
        border-radius: 12px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center;
        text-align: center;
        transition: all 0.2s ease;
    }

    .auth .nav-link {
        background: #f8fafc;
        border: 1px solid rgba(15, 23, 42, 0.08);
        color: var(--text);
        margin-bottom: 8px;
    }

    .auth .nav-link:active {
        background: #f1f5f9;
    }

    .auth .btn-ghost {
        background: #fff;
        border: 1px solid var(--line);
        color: var(--text);
    }

    .auth .btn-ghost:active {
        background: #f8fafc;
    }

    .auth .btn-solid {
        box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
    }

    .auth .btn-solid:active {
        transform: translateY(1px);
        box-shadow: 0 2px 6px rgba(22, 163, 74, 0.2);
    }

    /* Overlay */
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: transparent;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .d-mobile-flex {
        display: flex !important;
    }
    
    #userDropdownMenu {
        display: none !important;
    }
    
    .profile-chevron {
        display: none !important;
    }
}

.d-mobile-flex {
    display: none !important;
}