/* Mobile App-like Experience CSS */

@media (max-width: 768px) {
    /* 1. Reset & Global Mobile Adjustments */
    :root {
        --mobile-header-height: 60px;
        --mobile-bottom-nav-height: 70px;
    }

    body {
        padding-bottom: var(--mobile-bottom-nav-height); /* Space for bottom nav */
        background-color: #fff; /* Changed from #f7f7f7 to avoid color mismatch at bottom */
    }

    /* 2. Enhanced Sticky Header (Single Row: Logo Left, Search Right) */
    header {
        position: sticky;
        top: 0;
        z-index: 1100;
        background: #fff !important;
        padding: 8px 15px !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        height: 60px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
    }

    .mobile-header-top {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .mobile-home-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        color: #333;
        font-size: 20px;
        text-decoration: none;
        background: #f1f2f4;
        border-radius: 50%;
        order: 2 !important; /* Place after search */
    }

    .mobile-spacer {
        display: none !important; /* No longer needed with Logo Left layout */
    }

    .home-page .mobile-home-btn {
        display: none !important;
    }

    .logo {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        order: 0 !important;
    }

    .logo img {
        height: 32px !important;
    }

    .header-right {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        order: 1 !important;
    }

    .search-container {
        flex: 1 !important;
        display: flex !important;
        position: relative !important;
    }

    .search-container input {
        background: #f1f2f4 !important;
        border: 1px solid #e2e8f0 !important;
        height: 38px !important;
        padding: 0 35px 0 12px !important;
        border-radius: 8px !important;
        font-size: 13px !important;
        width: 100% !important;
    }

    .search-btn {
        position: absolute !important;
        right: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 14px !important;
        background: none !important;
        border: none !important;
        display: block !important;
    }

    /* Move back button to the right */
    .mobile-home-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        color: #333;
        font-size: 20px;
        text-decoration: none;
        background: #f1f2f4;
        border-radius: 50%;
        order: 2 !important; /* Place after search */
    }

    /* 3. Category Tabs (Two Modes: Grid & Scroller) */
    
    /* Scroller Mode (Default for better scrolling experience as requested earlier) */
    .mobile-category-tabs.scroller-mode {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 10px !important;
        gap: 15px !important;
        background: #fff !important;
        border-bottom: 1px solid #f1f5f9;
        -webkit-overflow-scrolling: touch;
    }

    /* Sticky version if used at top */
    .mobile-category-tabs.scroller-mode.sticky-top {
        position: sticky !important;
        top: 105px !important; /* Below 2-row header */
        z-index: 1050;
    }

    /* Bottom version as requested */
    .mobile-category-tabs.scroller-mode.bottom-slider {
        margin: 20px 0 !important;
        border-top: 1px solid #eee;
        padding: 20px 10px !important;
    }

    .mobile-category-tabs.scroller-mode::-webkit-scrollbar {
        display: none;
    }

    .mobile-category-tabs.scroller-mode .category-tab {
        flex: 0 0 65px !important;
        padding: 0 !important;
    }

    .mobile-category-tabs.scroller-mode .tab-icon {
        width: 55px !important;
        height: 55px !important;
        font-size: 20px !important;
        border-radius: 12px !important;
    }

    /* Grid Mode (When specifically set) */
    .mobile-category-tabs.grid-mode {
        display: flex !important;
        flex-wrap: wrap !important;
        padding: 10px 0 !important;
        gap: 0 !important;
        background: #fff !important;
        border-bottom: 1px solid #f1f5f9;
    }

    .mobile-category-tabs.grid-mode .category-tab {
        flex: 0 0 25% !important;
        padding: 8px 2px !important;
    }

    .mobile-category-tabs.grid-mode .tab-icon {
        width: 75px !important;
        height: 75px !important;
        font-size: 28px !important;
        border-radius: 12px !important;
    }

    .category-tab {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-decoration: none !important;
        margin-bottom: 5px !important;
    }

    .tab-icon {
        background: #fff;
        border: 1px solid #eee;
        margin-bottom: 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }

    .category-tab span {
        font-size: 10px;
        text-align: center;
        color: #333;
        font-weight: 600;
        display: block;
    }

    .mobile-category-tabs.scroller-mode span {
        white-space: nowrap !important;
    }

    .category-tab.active .tab-icon {
        border-color: var(--primary-purple) !important;
        background: var(--light-purple-bg) !important;
        transform: scale(1.1);
        box-shadow: 0 0 0 2px var(--primary-purple);
    }

    .category-tab.active span {
        color: var(--primary-purple) !important;
        font-weight: 700;
    }

    /* Smooth Tap Effect */
    .category-tab:active {
        transform: scale(0.95);
        transition: 0.1s;
    }

    .nav-item:active {
        background: rgba(0,0,0,0.05);
        border-radius: 10px;
    }

    /* 4. Enhanced Bottom Navigation Bar */
    .bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: var(--mobile-bottom-nav-height) !important;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.08) !important;
        z-index: 9999 !important;
        justify-content: space-around !important;
        align-items: center !important;
        padding: 0 5px !important;
        border-top: 1px solid rgba(0,0,0,0.05) !important;
    }

    .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #666;
        gap: 4px;
        position: relative;
        transition: 0.2s;
    }

    .nav-item i {
        font-size: 20px;
        transition: transform 0.2s;
    }

    .nav-item.active i {
        transform: translateY(-2px);
    }

    .nav-item span {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: -0.2px;
    }

    .nav-item.active {
        color: var(--primary-purple);
    }

    .nav-item .cart-badge {
        position: absolute;
        top: 2px;
        right: 25%;
        background: #ff3b30;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 16px;
        border: 2px solid #fff;
    }

    /* 4.1 Mobile Footer Adjustments */
    footer {
        padding: 40px 20px 0 20px !important; /* Removed bottom padding */
        background: #1a1a1a !important;
    }

    .footer-top {
        display: flex !important;
        flex-direction: column !important;
        gap: 25px !important;
        text-align: center !important;
    }

    .footer-col {
        width: 100% !important;
        margin: 0 !important;
    }

    .footer-col h4 {
        margin-bottom: 12px !important;
        font-size: 16px !important;
        color: #fff !important;
        position: relative;
        padding-bottom: 8px;
    }

    .footer-col h4::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 2px;
        background: var(--primary-purple);
    }

    .footer-col ul {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .footer-col ul li a {
        font-size: 14px !important;
        color: #bbb !important;
    }

    .social-links {
        justify-content: center !important;
        margin-top: 10px !important;
    }

    .contact-info p {
        justify-content: center !important;
        margin-bottom: 10px !important;
    }

    .footer-bottom {
        border-top: 1px solid rgba(255,255,255,0.1) !important;
        padding: 15px 0 0 0 !important;
        margin-top: 15px !important;
        flex-direction: column-reverse !important;
        gap: 10px !important;
    }

    .footer-bottom p {
        margin: 0 !important;
    }

    .payment-icons {
        justify-content: center !important;
    }

    /* 5. Product Grid Adjustments */
    .full-width-container {
        padding: 20px 15px !important;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .grid-item {
        padding: 10px !important;
        border-radius: 10px !important;
    }

    .item-img {
        height: 140px !important;
        margin-bottom: 10px !important;
    }

    .grid-item p {
        font-size: 13px !important;
        height: 38px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .price {
        font-size: 15px !important;
    }

    .add-to-cart-btn {
        padding: 8px !important;
        font-size: 12px !important;
    }

    /* 6. Hide unnecessary elements on mobile */
    .nav-links-header, .header-actions, .top-bar {
        display: none !important;
    }

    .hero-section-container {
        padding: 0 !important;
        display: block !important;
    }

    .sidebar-wrapper, .hero-banner {
        display: none !important; /* Mobile doesn't need big banners usually */
    }
    
    /* If you want to keep a small promo banner */
    .mobile-promo-banner {
        display: block;
        width: calc(100% - 30px);
        margin: 10px 15px;
        height: 120px;
        background-size: cover;
        background-position: center;
        border-radius: 12px;
    }

    .trust-bar {
        overflow-x: auto;
        justify-content: flex-start !important;
        padding: 15px !important;
        gap: 20px !important;
    }

    .stat-item {
        flex: 0 0 auto;
        font-size: 12px !important;
    }

    .section-header h3 {
        font-size: 18px !important;
        text-align: left !important;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        padding-bottom: 20px;
    }
}
