/* ─── Nexus Cloud POS — Responsive Overrides ─── */

/* ─── TABLET (max-width: 1024px) ─── */
@media (max-width: 1024px) {
    /* Sidebar collapses to icons */
    .sidebar {
        width: 60px !important;
        overflow: hidden;
    }
    .sidebar .nav-text,
    .sidebar .sidebar-header h2,
    .sidebar .sidebar-header p,
    .sidebar .nav-label {
        display: none !important;
    }
    .sidebar .nav-item {
        justify-content: center;
        padding: 12px 0 !important;
    }
    .sidebar .nav-item i {
        font-size: 20px;
        margin: 0 !important;
    }

    /* Main content takes remaining width */
    .main-content {
        margin-left: 60px !important;
    }

    /* KPI cards — 2-column on tablet */
    .kpi-grid, .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Tables with horizontal scroll */
    .table-container, .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table, table {
        min-width: 600px;
    }

    /* Charts — full width, reduced height */
    .chart-container canvas {
        max-height: 250px !important;
    }
}

/* ─── MOBILE (max-width: 768px) ─── */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    /* Hide sidebar, show bottom nav */
    .sidebar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 10px !important;
        padding-bottom: 70px !important;
    }

    /* Bottom tab bar navigation */
    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        z-index: 1000;
        justify-content: space-around;
        padding: 6px 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .bottom-nav a, .bottom-nav .nav-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 10px;
        color: #64748b;
        text-decoration: none;
        padding: 4px 8px;
        gap: 2px;
    }
    .bottom-nav a.active, .bottom-nav .nav-tab.active {
        color: #043e33;
    }
    .bottom-nav i {
        font-size: 20px;
    }

    /* KPI cards stack vertically */
    .kpi-grid, .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Page headers */
    .page-header, .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    .page-header h1, .section-header h1 {
        font-size: 20px !important;
    }

    /* POS Checkout — mobile layout */
    .pos-container {
        flex-direction: column !important;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .cart-panel, .cart-section {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        max-height: 50vh;
        overflow-y: auto;
        z-index: 999;
        background: #fff;
        border-top: 2px solid #043e33;
        border-radius: 16px 16px 0 0;
        padding: 15px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }

    /* Cards full width */
    .card {
        width: 100% !important;
        margin: 0 0 10px 0 !important;
    }

    /* Charts */
    .chart-container canvas {
        max-height: 200px !important;
    }

    /* Font size minimum 16px for mobile readability */
    input, select, textarea, button {
        font-size: 16px !important;
    }

    /* Touch targets — minimum 44px */
    button, .btn, a.btn, .nav-item, .action-btn {
        min-height: 44px !important;
        padding: 10px 16px !important;
    }

    /* Tables — sticky first column */
    .data-table th:first-child,
    .data-table td:first-child,
    table th:first-child,
    table td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 2;
        box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    }
}

/* ─── SMALL PHONE (max-width: 480px) ─── */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    /* Single-column everything */
    .kpi-grid, .stats-grid, .form-grid, .grid-2, .grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* Product grid — single column scrollable list */
    .product-grid {
        grid-template-columns: 1fr !important;
    }
    .product-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 10px;
        padding: 10px !important;
    }
    .product-card img {
        width: 50px !important;
        height: 50px !important;
        border-radius: 8px;
    }

    /* Modals full screen */
    .modal-content, .dialog-content, .popup-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        overflow-y: auto;
        z-index: 10000;
    }
    .modal-overlay, .dialog-overlay {
        padding: 0 !important;
    }

    /* Smaller headings */
    h1 { font-size: 18px !important; }
    h2 { font-size: 16px !important; }
    h3 { font-size: 15px !important; }

    /* Tables even more compact */
    .data-table th, .data-table td,
    table th, table td {
        padding: 8px 6px !important;
        font-size: 13px !important;
    }

    /* Larger touch targets */
    button, .btn {
        width: 100% !important;
        min-height: 48px !important;
    }

    /* Form inputs full width */
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100% !important;
    }
}

/* ─── PRINT STYLES ─── */
@media print {
    .sidebar, .bottom-nav, .no-print {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
