﻿/* Mobile Adaptation for OrgaSphere */
@media screen and (max-width: 768px) {
    .app-container {
        display: block !important;
        /* Override flex */
        height: auto;
        overflow: auto;
    }

    /* Sidebar */
    nav.sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        transform: none;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
        background-color: var(--bg-secondary) !important;
        /* Ensure visible bg */
        overflow-y: auto !important;
        /* Enable Sidebar Scrolling */
    }

    nav.sidebar.active {
        left: 0;
        transform: none;
    }

    /* Overlay */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    /* Main Content */
    main.main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 60px;
        /* Space for mobile header */
    }

    /* Mobile Header */
    .mobile-header {
        display: flex !important;
        align-items: center;
        width: 100%;
        height: 60px;
        background-color: var(--header-bg, #fff);
        border-bottom: 1px solid var(--border-color, #e0e0e0);
        padding: 0 1rem;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 900;
    }

    /* Dashboard Grid */
    .dashboard-grid,
    .stats-row {
        grid-template-columns: 1fr !important;
        display: grid;
        gap: 1rem;
    }

    /* Tables */
    .table-container,
    .customers-table-container,
    .orders-table-container {
        overflow-x: auto;
    }

    table.data-table {
        min-width: 600px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
    }

    .modal-content {
        width: 95% !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Force Body Scrolling */
    body,
    html {
        overflow-y: auto !important;
        height: auto !important;
    }

    /* Ensure main content scrolls */
    main.main-content {
        overflow: visible !important;
        height: auto !important;
    }
}