/* ---
   SupplyNext Digital Dashboard - Responsive Stylesheet
   Targets: Tablets and Mobile Devices
--- */

/* =========== For Tablets and Smaller Desktops (<= 1024px) =========== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px; /* Slightly narrower sidebar */
    }

    .main-content {
        padding: 1.5rem;
    }

    .module-header h1 {
        font-size: 1.8rem;
    }

    /* Stack the inventory planner's table and detail pane */
    .inventory-container {
        grid-template-columns: 1fr; /* Change from 2fr 1fr to a single column */
    }

    .detail-pane {
        margin-top: 1.5rem; /* Add space when it's stacked below the table */
    }
}


/* =========== For Mobile Devices (<= 768px) =========== */
@media (max-width: 768px) {
    /* --- Main Layout & Sidebar Transformation --- */

    .app-container {
        /* Remove the grid column for the sidebar */
        grid-template-columns: 1fr;
    }

    .sidebar {
        /* Make sidebar an overlay */
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 260px; /* Keep a decent width for tapping */
        z-index: 1000;
        
        /* Hide it off-screen by default */
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }

    /* This class will be toggled by JavaScript to show the sidebar */
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* 
       IMPORTANT: You will need to add a "hamburger" menu button
       in your HTML (or create with JS) to toggle the .sidebar.open class.
       Example: <button id="menu-toggle"><i class="fas fa-bars"></i></button>
    */

    .main-content {
        /* No need to offset for sidebar anymore */
        padding: 1rem;
        padding-top: 60px; /* Add padding to prevent content from being hidden under a potential fixed header/menu button */
    }

    /* --- General Component Adjustments --- */

    .module-header {
        margin-bottom: 1.5rem;
    }

    .module-header h1 {
        font-size: 1.5rem;
    }

    .module-header p {
        font-size: 0.9rem;
    }

    /* Force grids into a single column */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .team-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* --- Table Responsiveness --- */
    .inventory-table-wrapper {
        overflow-x: auto; /* Allow horizontal scrolling for the table */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
    }

    .data-table {
        width: auto; /* Allow table to be wider than the container */
        min-width: 600px; /* Set a minimum width to enforce scrolling */
    }

    /* --- Tab Navigation --- */
    .tab-nav {
        /* Allow tabs to scroll if they don't fit */
        overflow-x: auto;
        white-space: nowrap;
    }
    .tab-link {
        flex-shrink: 0; /* Prevent tabs from shrinking */
    }

    /* --- Loader on Mobile --- */
    .supply-chain-animation {
        /* Make the animation slightly smaller on mobile */
        transform: scale(0.8);
    }
}