/**
 * SDEO Responsive Dashboard Styles
 * Handles the mobile sidebar, hamburger menu, and responsive widget layout.
 * VERSION 5.0: Final guaranteed fix for fixed menu and edge-to-edge layout.
 */

/* --- Mobile Menu Trigger (Hamburger Icon) --- */
#sdeo-mobile-menu-trigger {
    display: none; /* Hidden by default */
    position: fixed; 
    top: 15px;      
    left: 15px;
    z-index: 10000; /* Highest z-index to ensure it's on top */
    font-size: 24px;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    background: #fff; 
    padding: 5px 8px; 
    border-radius: 4px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}

#sdeo-mobile-menu-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999; /* Below the menu trigger, above everything else */
}

/* --- FIX: UNIVERSAL LIST STYLING (FOR TOP SELLING PRODUCTS, ETC.) --- */
.sdeo-dashboard-widget ul.sdeo-widget-list li {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 12px;
}
.sdeo-dashboard-widget ul.sdeo-widget-list li > span:first-child {
    margin-right: 15px; 
    white-space: normal; 
}
.sdeo-dashboard-widget ul.sdeo-widget-list .sdeo-item-count {
    flex-shrink: 0; 
}

/* This is the main media query for mobile devices */
@media (max-width: 990px) {

/* =================================================================== */
/* == BASANTI'S FINAL & PERFECTED DECREE FOR THE WALLET PAGE HEADER == */
/* This version pushes the ENTIRE header down AND to the side. */
/* =================================================================== */

/* STEP 1: Target the wallet header container and give IT the main spacing */
.dokan-product-listing-area > .sdeo-wallet-header {
    padding-top: 60px;       /* THIS IS THE KEY! Pushes the whole block down below the menu. */
    padding-left: 15px;      /* Adds some space from the left edge. */
    padding-right: 15px;     /* Adds some space from the right edge. */
    box-sizing: border-box;  /* Ensures padding is included in the width calculation. */
    flex-direction: column;
    align-items: flex-start;
}

/* STEP 2: The title now only needs a little adjustment */
.dokan-product-listing-area > .sdeo-wallet-header .entry-title {
    padding-top: 0;          /* No extra top padding needed here */
    margin-left: 0 !important; /* We don't need the side margin anymore! */
    margin-bottom: 15px;
    text-align: left !important;
}

/* STEP 3: The button styling remains the same */
.dokan-product-listing-area > .sdeo-wallet-header #sdeo_recharge_wallet_btn {
    width: 100%;
    text-align: center;
}
    /* --- MASTER FIX: DISABLE HORIZONTAL SCROLL --- */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
    }

    /* --- FIX: HIDE THEME'S MOBILE HEADER --- */
    body.page-template-template-admin-dashboard .header-mobile-main,
    body.page-template-template-vendor-dashboard .header-mobile-main {
        display: none !important;
    }

    /* --- Show the Hamburger Icon --- */
    #sdeo-mobile-menu-trigger {
        display: block;
    }

    /* --- Sidebar Styling for Mobile --- */
    .sdeo-admin-dashboard-wrap .sdeo-admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 280px; 
        z-index: 10001; /* Must be on top of the overlay */
        transform: translateX(-100%); 
        transition: transform 0.3s ease-in-out;
        overflow-y: auto; 
    }

    /* --- FINAL LAYOUT FIX: EDGE-TO-EDGE --- */
    .sdeo-admin-dashboard-wrap .dokan-dashboard-content {
        margin-left: 0 !important; 
        padding: 0 !important; /* Remove all padding from the main container */
        width: 100%; /* Force it to be the full screen width */
        min-width: 100%;
    }
    .dokan-dashboard-content .dokan-product-listing-area,
    .dokan-dashboard-header {
        padding: 0 15px; /* Apply padding to the *inner* elements */
        box-sizing: border-box;
        width: 100%;
    }
    
    .dokan-dashboard-header {
        padding-top: 20px;
        margin-bottom: 20px;
    }
    
    .dokan-dashboard-header h1.entry-title {
        padding-top: 45px; /* Creates space for the fixed hamburger menu */
        text-align: center;
        margin-left: 0;
    }

    /* --- The "Slide-In" Action --- */
    body.sdeo-sidebar-open .sdeo-admin-sidebar {
        transform: translateX(0); 
    }
    body.sdeo-sidebar-open #sdeo-mobile-menu-overlay {
        display: block;
    }

    /* --- Responsive Widgets --- */
    .sdeo-stats-grid,
    .sdeo-dashboard-grid {
        grid-template-columns: 1fr; 
        gap: 20px;
    }

    /* --- GRAPH & TABLE FIXES (No change needed from last time) --- */
    .sdeo-dashboard-widget .sdeo-widget-body { position: relative; height: 300px; }
    .sdeo-dashboard-widget .sdeo-widget-body.has-list { height: auto; }
    #sdeo-sales-chart { width: 100% !important; height: 100% !important; }
    .dokan-product-listing-area .dokan-table,
    .dokan-product-listing-area table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .dokan-product-listing-area .dokan-btn,
    .dokan-product-listing-area button,
    .dokan-product-listing-area input[type="submit"] { padding: 8px 12px; font-size: 14px; width: 100%; margin-bottom: 10px; box-sizing: border-box; }
}