/* ===================================
   MOBILE RESPONSIVE STYLES
   =================================== */

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slide-down {
    animation: slideDown 0.3s ease-out forwards;
}

/* Mobile-First Base Styles */
@media (max-width: 768px) {
    body {
        font-size: 14px !important;
    }

    /* Header Adjustments */
    header .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    /* Logo and Site Name */
    header a.text-2xl {
        font-size: 1.25rem !important;
    }

    header img.h-10 {
        height: 32px !important;
    }



    /* Navigation Menu - Stack vertically on mobile */
    nav ul {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
    }

    nav ul li {
        flex: 0 0 auto;
    }

    /* Product Grid - 2 columns on mobile */
    .grid.grid-cols-4,
    .grid.grid-cols-3,
    .grid.grid-cols-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }

    /* Product Cards */
    .product-card {
        padding: 0.75rem !important;
    }

    .product-card img {
        height: 150px !important;
    }

    .product-card h3 {
        font-size: 0.875rem !important;
    }

    .product-card .product-price {
        font-size: 1rem !important;
    }

    /* Buttons */
    button,
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Container Padding */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Cart Page */
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .cart-item img {
        width: 100% !important;
        max-width: 200px !important;
    }

    /* Checkout Form */
    .checkout-form .grid {
        grid-template-columns: 1fr !important;
    }

    /* Modal/Popup */
    .modal,
    .popup {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem !important;
    }

    /* Tables - Make scrollable */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Tables - Make scrollable */
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table thead,
    table tbody,
    table tfoot {
        display: inline-table !important;
        min-width: 800px !important;
    }

    /* POS Mobile Adjustments */
    .pos-system .grid-cols-12 {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
    }

    .pos-system .col-span-7 {
        width: 100% !important;
        order: 2 !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .pos-system .col-span-5 {
        width: 100% !important;
        order: 1 !important;
        border-left: none !important;
        border-bottom: 2px solid var(--border-color) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 30 !important;
        max-height: 400px !important;
        background: white !important;
    }

    .pos-system .pos-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .pos-system .flex.gap-4 {
        flex-direction: column !important;
    }

    .pos-system .w-32 {
        width: 100% !important;
    }


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

    /* Top Bar - Simplify */
    .bg-gray-900 .container {
        font-size: 0.75rem !important;
    }



    /* User Dropdown override was here, removed as it breaks absolute badges in cards */

    /* Category Dropdown */
    .mobile-category-dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .mobile-category-dropdown .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
        padding: 1rem !important;
    }

    /* Footer */
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Product Detail Page */
    .product-detail-grid {
        grid-template-columns: 1fr !important;
    }

    .product-detail-image {
        max-height: 400px !important;
    }

    /* Filters */
    .filters-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        height: 100vh !important;
        width: 80% !important;
        max-width: 300px !important;
        background: white !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
    }

    .filters-sidebar.active {
        left: 0 !important;
    }

    /* Mobile Filter Toggle Button */
    .mobile-filter-toggle {
        display: block !important;
        position: fixed !important;
        bottom: 80px !important;
        right: 1rem !important;
        z-index: 999 !important;
        background: var(--primary-color) !important;
        color: white !important;
        padding: 0.75rem 1.5rem !important;
        border-radius: 50px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }

    /* Chatbot Mobile Adjustments */
    .chatbot-container {
        width: 100% !important;
        height: 100vh !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
    }

    .chatbot-toggle {
        bottom: 80px !important;
        right: 1rem !important;
        width: 56px !important;
        height: 56px !important;
    }

    /* Mobile Bottom Navigation Spacing */
    body {
        padding-bottom: 70px !important;
    }

    main {
        padding-bottom: 2rem !important;
    }

    /* Touch-friendly tap targets */
    a,
    button,
    input,
    select {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden !important;
    }

    /* Make images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Text sizing for readability */
    body {
        font-size: 16px !important;
    }

    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* Spacing adjustments */
    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        padding: 0.75rem !important;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem !important;
    }

    /* Badges and Tags */
    .badge,
    .tag {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* PWA Footer Icons & Quick View expansion icon */
    .mobile-bottom-nav .nav-item i {
        font-size: 1.25rem !important;
    }

    .mobile-bottom-nav .nav-item span {
        font-size: 8px !important;
        margin-top: 2px !important;
    }

    /* Center Quick View Expansion Icon on Mobile Images */
    .group .absolute.inset-0.bg-black\/0 {
        opacity: 1 !important;
        background-color: rgba(0, 0, 0, 0.05) !important;
    }

    .group .absolute.inset-0.bg-black\/0 i.fa-expand {
        display: block !important;
        font-size: 1.5rem !important;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Tablet Styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {

    .grid.grid-cols-4,
    .grid.grid-cols-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .container {
        max-width: 100% !important;
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .grid.grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
    }

    nav ul {
        font-size: 0.75rem !important;
    }

    .product-card img {
        height: 120px !important;
    }

    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-container {
        height: 100vh !important;
    }

    .mobile-bottom-nav {
        height: 50px !important;
    }

    body {
        padding-bottom: 50px !important;
    }
}

/* Print Styles */
@media print {

    .chatbot-toggle,
    .chatbot-container,
    .mobile-bottom-nav,
    header nav,
    .bg-gray-900 {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}