/**
 * Mobile Responsive Styles
 * Media queries for mobile devices (max-width: 767px)
 */

/* ===========================
   MOBILE STYLES (max-width: 767px)
   =========================== */

@media (max-width: 767px) {
    /* ===========================
       HEADER / NAVIGATION
       =========================== */

    /* Hide company name text on mobile */
    .header-logo span {
        display: none;
    }

    /* Make logo smaller on mobile */
    .header-logo .w-10 {
        width: 32px !important;
        height: 32px !important;
    }

    /* Company selector full width dropdown */
    .company-selector {
        width: 100%;
    }

    /* Hamburger menu toggle */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        padding: 8px;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-secondary);
        padding: 16px;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }

    .mobile-nav.active {
        transform: translateY(0);
    }

    /* ===========================
       CLIENT CATALOG
       =========================== */

    /* Product grid - single column on mobile */
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    /* Filters stacked vertically */
    .filters-container {
        flex-direction: column !important;
        gap: 12px;
    }

    .filters-container > * {
        width: 100% !important;
    }

    /* Cart sidebar becomes bottom sheet */
    .cart-sidebar {
        position: fixed !important;
        top: auto !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        max-height: 60vh;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
        z-index: 999;
    }

    .cart-sidebar.active {
        transform: translateY(0);
    }

    /* Cart toggle button (fixed at bottom) */
    .cart-toggle-mobile {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: var(--color-primary);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
        cursor: pointer;
        z-index: 998;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }

    .cart-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: var(--color-error);
        color: white;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        font-size: 12px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ===========================
       MODALS
       =========================== */

    /* Product modal - single column layout */
    .product-modal .modal-content {
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh;
        overflow-y: auto;
    }

    .product-modal .modal-grid {
        grid-template-columns: 1fr !important;
    }

    .product-modal .modal-image {
        max-height: 300px;
    }

    /* Review modal - vertical scroll */
    .review-modal .modal-content {
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh;
        overflow-y: auto;
    }

    .review-modal table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* ===========================
       ADMIN DASHBOARD
       =========================== */

    /* Admin sidebar becomes drawer */
    .admin-sidebar {
        position: fixed !important;
        top: 64px;
        left: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    /* Hamburger toggle for admin */
    .admin-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        padding: 8px;
    }

    /* Main content full width on mobile */
    #admin-dashboard main {
        width: 100% !important;
        padding: 16px !important;
    }

    /* Stat cards stack on mobile */
    .stat-card {
        padding: 16px !important;
    }

    /* Excel table horizontal scroll */
    .excel-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .excel-table thead,
    .excel-table tbody,
    .excel-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    /* Order detail - stack columns */
    .order-detail-grid {
        flex-direction: column !important;
    }

    .order-detail-sidebar {
        width: 100% !important;
        margin-top: 16px;
    }

    /* Dashboard cards stack */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    /* Charts responsive */
    canvas {
        max-height: 200px !important;
    }

    /* ===========================
       TABLES
       =========================== */

    /* All tables with horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* ===========================
       FORMS
       =========================== */

    /* Form grids to single column */
    .form-grid,
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    /* Buttons full width on mobile */
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* ===========================
       UTILITY CLASSES
       =========================== */

    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }

    /* Text sizes */
    .text-3xl {
        font-size: 1.5rem !important;
    }

    .text-2xl {
        font-size: 1.25rem !important;
    }

    /* Padding adjustments */
    .p-8 {
        padding: 16px !important;
    }

    .px-6 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Gap adjustments */
    .gap-6 {
        gap: 16px !important;
    }

    .gap-4 {
        gap: 12px !important;
    }
}

/* ===========================
   TABLET STYLES (768px - 1023px)
   =========================== */

@media (min-width: 768px) and (max-width: 1023px) {
    /* Product grid - 2 columns on tablet */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Dashboard grid - 2 columns on tablet */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===========================
   LANDSCAPE MOBILE
   =========================== */

@media (max-width: 767px) and (orientation: landscape) {
    /* Reduce heights in landscape */
    .cart-sidebar {
        max-height: 80vh;
    }

    .modal-content {
        max-height: 90vh;
    }
}
