/* ==========================================================================
   BageBoxe - 100% Mobile & Cross-Device Responsiveness
   Breakpoints: 320px (XS), 480px (SM), 768px (MD), 1024px (LG), 1280px (XL)
   ========================================================================== */

/* 1. Global Viewport & Reset */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, video, svg, iframe {
    max-width: 100%;
    height: auto;
}

/* Prevent auto-zoom on mobile inputs in iOS */
@media (max-width: 767px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* 2. Header Mobile Styling */
@media (max-width: 767px) {
    .bb-header-row {
        height: auto !important;
        min-height: 3.75rem !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }

    .bb-header-logo {
        flex: 0 0 auto !important;
    }

    .bb-header-logo img {
        height: 2.25rem !important;
        width: auto !important;
        max-width: 130px !important;
    }

    .bb-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        margin-left: auto !important;
    }

    .bb-header-actions button,
    .bb-header-actions a {
        min-width: 36px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .bb-header-search {
        order: 3 !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0.25rem !important;
    }

    .bb-header-search input {
        padding-left: 2.5rem !important;
        padding-right: 5.5rem !important;
        font-size: 14px !important;
        height: 2.5rem !important;
    }

    .bb-header-search button {
        padding: 0.35rem 0.85rem !important;
        font-size: 12px !important;
        right: 0.25rem !important;
    }

    .bb-header-search i[data-lucide="search"] {
        left: 0.75rem !important;
        width: 18px !important;
        height: 18px !important;
    }

    .bb-header-currency {
        display: none !important;
    }
}

@media (max-width: 360px) {
    .bb-header-logo img {
        height: 2rem !important;
        max-width: 110px !important;
    }
    .bb-header-actions {
        gap: 0.4rem !important;
    }
}

/* 3. Main Container */
main.bb-main-container {
    width: 100% !important;
    max-width: 80rem !important;
    min-width: 0 !important;
}

@media (max-width: 1023px) {
    main.bb-main-container {
        flex-direction: column !important;
        gap: 1.25rem !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 1rem !important;
    }
}

/* 4. Hero Section Responsiveness */
.bb-hero {
    min-height: 320px;
}

@media (max-width: 639px) {
    .bb-hero {
        min-height: 280px !important;
        padding: 1.5rem 1rem !important;
    }
    .bb-hero h1 {
        font-size: 1.5rem !important;
        line-height: 1.25 !important;
    }
    .bb-hero p {
        font-size: 0.875rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.25rem !important;
    }
    .bb-hero-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    .bb-hero-buttons a {
        width: 100% !important;
        text-align: center !important;
        padding: 0.65rem 1.25rem !important;
        font-size: 0.875rem !important;
    }
}

/* 5. Product Grid & Cards on Small Screens */
@media (max-width: 639px) {
    .bb-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.625rem !important;
    }

    .bb-product-card {
        padding: 0.5rem !important;
    }

    .bb-product-card .card-title {
        font-size: 0.8125rem !important;
        line-height: 1.15rem !important;
    }

    .bb-product-card .card-vendor {
        font-size: 0.6875rem !important;
    }

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

/* Badges on Product Cards (Subtle, sleek, compact) */
.bb-badge-best-value,
.bb-badge-bestseller {
    font-size: 8.5px !important;
    line-height: 1 !important;
    padding: 3px 7px !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    border-radius: 9999px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

@media (min-width: 640px) {
    .bb-badge-best-value,
    .bb-badge-bestseller {
        font-size: 9.5px !important;
        padding: 3.5px 8px !important;
    }
}

/* 6. Shop Filters Drawer on Mobile */
.bb-filter-drawer {
    display: none;
}

@media (max-width: 1023px) {
    .bb-filter-drawer.active {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 100 !important;
    }

    .bb-filter-drawer-backdrop {
        position: fixed !important;
        inset: 0 !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(2px) !important;
    }

    .bb-filter-drawer-content {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 85% !important;
        max-width: 340px !important;
        background: #ffffff !important;
        z-index: 101 !important;
        overflow-y: auto !important;
        padding: 1.25rem !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15) !important;
        display: flex !important;
        flex-direction: column !important;
    }
}

/* 7. Product Detail Page Mobile Polish */
@media (max-width: 767px) {
    .bb-product-detail-layout {
        gap: 1.25rem !important;
    }

    .bb-gallery-thumbs {
        gap: 0.5rem !important;
    }

    .bb-gallery-thumbs button {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }

    .bb-cta-row {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .bb-cta-row > * {
        width: 100% !important;
    }

    .bb-qty-selector {
        justify-content: center !important;
        width: 100% !important;
    }

    .bb-tabs-header {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .bb-tabs-header::-webkit-scrollbar {
        display: none !important;
    }

    .bb-tabs-header button {
        padding: 0.65rem 0.85rem !important;
        font-size: 0.8125rem !important;
        white-space: nowrap !important;
    }
}

/* Sticky Bottom Add to Cart Bar for Mobile */
.bb-sticky-mobile-cart {
    display: none;
}

@media (max-width: 767px) {
    .bb-sticky-mobile-cart {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 45 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(8px) !important;
        border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 0.65rem 1rem !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08) !important;
    }

    body.has-sticky-cart {
        padding-bottom: 4.5rem !important;
    }
}

/* 8. Cart Item Card Responsiveness */
@media (max-width: 639px) {
    .bb-cart-item {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 0.875rem 0 !important;
    }

    .bb-cart-item-header {
        display: flex !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .bb-cart-item-footer {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-top: 0.5rem !important;
        border-top: 1px dashed rgba(0, 0, 0, 0.08) !important;
    }
}

/* 9. Responsive Tables (Shoe size, Nike vs Adidas, Specifications) */
.bb-table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bb-table-responsive table,
.overflow-x-auto > table {
    min-width: 480px;
}

/* 10. Hide scrollbars utility */
.scrollbar-none {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.scrollbar-none::-webkit-scrollbar {
    display: none !important;
}
