/* Mobile App-Like Enhancements */

/* 1. Bottom App Bar */
.bottom-app-bar {
    position: fixed;
    bottom: 15px;
    /* Floating above the bottom */
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    /* Small width instead of 100% */
    max-width: 400px;
    background-color: var(--gg-header, #0a110f);
    display: flex;
    justify-content: space-around;
    padding: 0.6rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1040;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    /* Pill shape */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bottom-app-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    font-weight: 600;
    transition: 0.2s ease-in-out;
}

.bottom-app-bar-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.bottom-app-bar-item.active,
.bottom-app-bar-item:active {
    color: var(--gg-yellow, #ffc107);
    transform: scale(0.95);
}

/* Adjust body padding so content isn't hidden behind bottom bar on mobile */
@media (max-width: 991.98px) {
    body {
        padding-bottom: 80px;
    }
}

/* Hide top nav items that are moved to bottom on mobile */
@media (max-width: 991.98px) {
    .hide-on-mobile-nav {
        display: none !important;
    }
}

/* Show bottom nav only on mobile */
@media (min-width: 992px) {
    .bottom-app-bar {
        display: none !important;
    }
}

/* 2. Bottom Sheet Offcanvas (Override default right-side offcanvas) */
@media (max-width: 991.98px) {
    .offcanvas-bottom-sheet {
        top: auto !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: auto !important;
        max-height: 85vh;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1) !important;
    }

    .offcanvas-bottom-sheet.show {
        transform: translateY(0) !important;
    }

    /* Small grab handle indicator */
    .offcanvas-bottom-sheet::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 10px;
    }
}

/* 3. Sticky Bottom CTA */
@media (max-width: 991.98px) {
    .sticky-bottom-cta {
        position: fixed;
        bottom: 70px;
        /* Above bottom app bar */
        left: 0;
        width: 100%;
        padding: 1rem;
        background: var(--gg-bg, #f8f9fa);
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
        z-index: 1030;
        border-top: 1px solid var(--gg-border, rgba(0, 0, 0, 0.08));
    }

    .sticky-bottom-cta .btn {
        width: 100%;
        margin: 0;
    }
}

/* 4. Active Touch Feedback */
.touch-feedback {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.touch-feedback:active {
    transform: scale(0.96) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* 5. Mobile Input Optimization (Prevent iOS Auto-zoom) */
@media screen and (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
        /* iOS zooms if less than 16px */
    }
}

/* 6. App-Style Bottom Toasts */
@media (max-width: 991.98px) {
    .message-container {
        top: auto !important;
        bottom: 90px !important;
        /* Above bottom nav */
        left: 50% !important;
        transform: translateX(-50%);
        right: auto !important;
        width: 90%;
        max-width: 400px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .alert {
        border-radius: 50px !important;
        /* Pill shape */
        padding: 0.8rem 1.5rem !important;
        font-size: 0.9rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
        text-align: center;
    }

    .alert .btn-close {
        display: none;
        /* Hide close button on mobile toasts */
    }

    @keyframes slideUpBottom {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

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

    .alert {
        animation: slideUpBottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }
}

/* 7. Native Swipe */
.native-swipe {
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

/* 8. Hero Section Mobile Fixes */
@media (max-width: 768px) {
    .hero-box {
        height: 390px !important;
        padding: 1.5rem 1rem 0.75rem !important;
        justify-content: flex-end !important;
        border-radius: 20px;
    }

    .hero-content {
        width: 100%;
        padding: 0 !important;
        margin-top: auto !important;
        display: flex;
        justify-content: center;
    }

    .hero-content h1 {
        font-size: 2.2rem !important;
        line-height: 1.2 !important;
        margin-top: 1rem;
    }

    .hero-content p.lead {
        font-size: 1rem;
        margin-bottom: 1.5rem !important;
    }

    .hero-search {
        display: none !important;
        /* Hide old bulky search bar on mobile, we use the sticky one now */
    }

    .hero-search input {
        width: 100%;
        background: white !important;
        border-radius: 14px !important;
        padding: 1rem !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .btn-terracotta {
        width: auto !important;
        display: inline-block !important;
        padding: 0.6rem 1.2rem !important;
        /* Made button smaller */
        font-size: 0.9rem !important;
        border-radius: 12px !important;
    }
}

/* =========================================
   PHASE 2: ULTRA-PREMIUM UI OVERHAUL
   ========================================= */

@media (max-width: 768px) {

    /* Hide giant footer on mobile */
    footer {
        display: none !important;
    }

    /* Compact Header */
    header {
        padding: 0.5rem 0 !important;
    }

    .logo-circle {
        width: 35px !important;
        height: 35px !important;
    }

    header .heading-font.fs-4 {
        font-size: 1.2rem !important;
    }

    /* Premium Mobile Search Bar */
    .mobile-search-bar {
        display: flex !important;
        padding: 5px 15px 0 !important;
        /* Minimized top/bottom padding */
        background: transparent;
        position: sticky;
        top: 60px;
        z-index: 999;
        pointer-events: none;
        /* Let clicks pass through the invisible background */
    }

    .mobile-search-bar input {
        pointer-events: auto;
        /* Re-enable clicks */
        border: none;
        border-radius: 50px;
        padding: 0.8rem 1.5rem;
        padding-right: 3rem;
        /* Space for the button */
        flex-grow: 1;
        outline: none;
        background: rgba(241, 245, 249, 0.95);
        /* Premium soft gray with glass effect */
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        font-size: 0.95rem;
        color: var(--gg-header);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        /* Soft floating shadow */
    }

    .mobile-search-bar button {
        pointer-events: auto;
        /* Re-enable clicks */
        background: transparent;
        color: var(--gg-header);
        border: none;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        padding: 10px;
        font-size: 1.1rem;
        opacity: 0.7;
    }

    /* Horizontal Category Pills */
    .slider-nav-container {
        display: none !important;
        /* Hide old bulky slider */
    }

    .cat-pill-container {
        display: flex !important;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 15px 5px !important;
        /* Minimized vertical padding */
        scrollbar-width: none;
        /* Firefox */
        -webkit-overflow-scrolling: touch;
    }

    .cat-pill-container::-webkit-scrollbar {
        display: none;
        /* Safari/Chrome */
    }

    .cat-pill {
        background: white;
        border: 1px solid var(--gg-border);
        padding: 8px 18px;
        border-radius: 20px;
        white-space: nowrap;
        font-size: 0.85rem;
        font-weight: 700;
        color: var(--gg-text);
        text-decoration: none;
        transition: 0.3s;
    }

    .cat-pill.active {
        background: var(--gg-header);
        color: var(--gg-yellow);
        border-color: var(--gg-header);
    }

    /* Sleek 2-Column Product Grid */
    .prod-card {
        height: 260px !important;
        border-radius: 16px !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    }

    .prod-img {
        height: 55% !important;
    }

    .prod-info {
        height: 45% !important;
        padding: 0.5rem 0.8rem !important;
        text-align: left !important;
        align-items: flex-start !important;
        position: relative;
    }

    .prod-info h4 {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        margin-bottom: 0.3rem !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }

    .prod-price {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
        position: absolute;
        bottom: 10px;
        left: 0.8rem;
    }

    .btn-add {
        display: none !important;
        /* Hide giant text button */
    }

    .floating-cart-btn {
        display: flex !important;
        position: absolute;
        bottom: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        background: var(--gg-header);
        color: var(--gg-yellow);
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        z-index: 5;
        transition: 0.2s;
        text-decoration: none;
    }

    .floating-cart-btn:active {
        transform: scale(0.9);
        background: var(--gg-accent);
        color: white;
    }
}

/* Hide Phase 2 mobile elements on desktop */
.mobile-search-bar {
    display: none;
}

.cat-pill-container {
    display: none;
}

.floating-cart-btn {
    display: none;
}

/* =========================================
   Home Page Typography & Placement Perfection
   ========================================= */
@media (max-width: 768px) {
    .hero-content {
        padding: 1rem 0 !important;
    }

    .hero-content h1 {
        font-size: 2.6rem !important;
        /* Larger, bolder impact */
        font-weight: 900 !important;
        letter-spacing: -1.5px !important;
        line-height: 1.1 !important;
        margin-bottom: 0.8rem !important;
    }

    .hero-content p.lead {
        font-size: 1.05rem !important;
        opacity: 0.9 !important;
        margin-bottom: 2.5rem !important;
        padding: 0 10px !important;
    }

    .section-title {
        font-size: 1.6rem !important;
        font-weight: 900 !important;
        margin: 3rem 0 1.5rem !important;
        letter-spacing: 0.5px !important;
        text-align: center;
    }
}

/* =========================================
   Global Space Management & Differentiation (Mobile)
   ========================================= */
@media (max-width: 768px) {

    /* Minimize spaces between edges and containers */
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Absolute minimum gaps between product cards */
    .row {
        --bs-gutter-x: 8px !important;
        --bs-gutter-y: 8px !important;
    }

    /* Ensure clear differentiation for Products, Cart, Checkout */
    .prod-card,
    .cart-card,
    .checkout-card,
    .order-card {
        background-color: #FFFFFF !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
    }

    /* Distinct Premium Category Cards (Image Overlay Style) */
    .cat-card {
        position: relative !important;
        height: 120px !important;
        padding: 0 !important;
        border-radius: 16px !important;
        border: none !important;
        overflow: hidden !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    }

    .cat-img {
        height: 100% !important;
        width: 100% !important;
    }

    .cat-img::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.8));
        z-index: 1;
    }

    .cat-card h3 {
        position: absolute !important;
        bottom: 12px !important;
        left: 12px !important;
        right: 12px !important;
        margin: 0 !important;
        color: #FFFFFF !important;
        z-index: 2 !important;
        font-size: 1.1rem !important;
        font-family: 'Inter', sans-serif !important;
        font-weight: 800 !important;
        text-align: left !important;
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
    }

    /* Reduce excessive vertical margins on containers */
    .mt-4,
    .my-4 {
        margin-top: 1rem !important;
    }

    .mb-4,
    .my-4 {
        margin-bottom: 1rem !important;
    }

    .mt-5,
    .my-5,
    .mt-md-5,
    .my-md-5 {
        margin-top: 1.5rem !important;
    }

    .mb-5,
    .my-5,
    .mb-md-5,
    .my-md-5 {
        margin-bottom: 1.5rem !important;
    }

    /* Let Bootstrap utility classes handle Cart/Checkout padding and layouts */

    /* Tighten spacing above Hero image */
    .hero-container {
        padding-top: 0.5rem !important;
    }
}
