/* Mobile-only usability layer for the physical goods store. */
@media (max-width: 768px) {
    html {
        scroll-padding-bottom: calc(82px + env(safe-area-inset-bottom));
    }

    body.store-body {
        padding-bottom: calc(82px + env(safe-area-inset-bottom)) !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav {
        position: fixed !important;
        inset-inline: 0 !important;
        bottom: 0 !important;
        z-index: 1000 !important;
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        align-items: center !important;
        gap: 3px !important;
        min-height: 66px !important;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom)) !important;
        background: color-mix(in srgb, var(--merchant-surface, #fff) 96%, transparent) !important;
        border: 0 !important;
        border-top: 1px solid var(--merchant-border, #e6e8ef) !important;
        box-shadow: 0 -8px 22px rgba(17, 24, 39, .10) !important;
        backdrop-filter: blur(9px) saturate(1.15) !important;
        -webkit-backdrop-filter: blur(9px) saturate(1.15) !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav .nav-item {
        position: relative !important;
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 52px !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 3px !important;
        padding: 5px 2px !important;
        border-radius: 13px !important;
        color: var(--merchant-muted, #697386) !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        text-decoration: none !important;
        -webkit-tap-highlight-color: transparent;
        transition: color .16s ease, background-color .16s ease, transform .16s ease !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav .nav-item.active {
        background: color-mix(in srgb, var(--merchant-primary, #6d43ff) 10%, transparent) !important;
        color: var(--merchant-primary, #6d43ff) !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav .nav-item.active::before {
        position: absolute;
        top: 2px;
        left: 50%;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        content: "";
        transform: translateX(-50%);
    }

    .mobile-nav-icon {
        display: block;
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-bottom-nav .cart-icon-wrapper {
        display: grid;
        width: 25px;
        height: 24px;
        place-items: center;
    }

    .mobile-bottom-nav .cart-badge {
        top: -4px !important;
        inset-inline-end: -7px !important;
        min-width: 16px !important;
        height: 16px !important;
        padding: 0 4px !important;
        font-size: 9px !important;
        line-height: 16px !important;
    }

    .mobile-bottom-nav .nav-item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        font-size: clamp(10px, 2.8vw, 11px) !important;
        line-height: 1.25 !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #merchantMobileAccountAvatar {
        width: 26px;
        height: 26px;
        flex: 0 0 26px;
        border-radius: 50%;
        object-fit: cover;
    }

    #merchantMobileAccountAvatar[hidden],
    #mobileAccountIcon[hidden],
    #mobileAccountLabel[hidden] {
        display: none !important;
    }

    /* When user is logged in with profile picture, show ONLY the avatar photo */
    #mobileAccountBtn.has-avatar-only {
        justify-content: center !important;
    }

    #mobileAccountBtn.has-avatar-only #mobileAccountIcon,
    #mobileAccountBtn.has-avatar-only #mobileAccountLabel,
    #mobileAccountBtn.has-avatar-only > span {
        display: none !important;
    }

    #mobileAccountBtn.has-avatar-only #merchantMobileAccountAvatar {
        display: block !important;
        width: 32px !important;
        height: 32px !important;
        flex: 0 0 32px !important;
        border-radius: 50% !important;
        border: 2px solid var(--brand-color, #7c3aed) !important;
        box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28) !important;
        object-fit: cover !important;
        transition: transform 0.18s ease, box-shadow 0.18s ease !important;
    }

    #mobileAccountBtn.has-avatar-only.active #merchantMobileAccountAvatar {
        transform: scale(1.08) !important;
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color, #7c3aed) 35%, transparent) !important;
    }

    #searchBtn,
    #theme-toggle,
    #wishlistBtn,
    #openCartBtn,
    #mobileFilterToggle,
    .product-card-actions .add-btn,
    .product-card-purchase .add-btn,
    .product-card .add-btn,
    .product-item .add-btn {
        min-height: 44px !important;
    }

    #searchBtn,
    #theme-toggle,
    #wishlistBtn,
    #openCartBtn {
        min-width: 44px !important;
        width: 44px !important;
    }

    html[data-theme] body.store-body .search-box #searchBtn {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        flex: 0 0 44px !important;
    }

    html[data-theme] body.store-body .product-card-actions .add-btn,
    html[data-theme] body.store-body .product-card-purchase .add-btn,
    html[data-theme] body.store-body .product-card .add-btn,
    html[data-theme] body.store-body .product-item .add-btn,
    html[data-theme] body.store-body .recently-viewed-section .product-card-actions .add-btn,
    html[data-theme] body.store-body .new-arrivals-section .product-card-actions .add-btn,
    html[data-theme] body.store-body .smart-products-section .product-card-actions .add-btn {
        min-height: 44px !important;
    }

    .search-box #searchInput,
    .tracking-search-card input,
    .tracking-search-card select,
    #accountPageContainer input:not([type="checkbox"]):not([type="radio"]),
    #accountPageContainer select,
    #accountPageContainer textarea,
    #checkoutModal input:not([type="checkbox"]):not([type="radio"]),
    #checkoutModal select,
    #checkoutModal textarea {
        min-height: 44px;
        scroll-margin-bottom: calc(92px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav .nav-item:focus-visible,
    #searchBtn:focus-visible,
    #theme-toggle:focus-visible,
    #wishlistBtn:focus-visible,
    #openCartBtn:focus-visible,
    #mobileFilterToggle:focus-visible,
    .product-card-actions .add-btn:focus-visible,
    .product-card-purchase .add-btn:focus-visible {
        outline: 3px solid color-mix(in srgb, var(--merchant-primary, #6d43ff) 55%, white) !important;
        outline-offset: 2px;
    }
}

@media (max-width: 360px) {
    html[data-theme] body.store-body .mobile-bottom-nav {
        gap: 1px !important;
        padding-inline: 4px !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav .nav-item span {
        font-size: 10px !important;
    }

    .mobile-nav-icon {
        width: 21px;
        height: 21px;
        flex-basis: 21px;
    }
}

@media (max-width: 768px) and (hover: none) {
    html[data-theme] body.store-body .mobile-bottom-nav .nav-item:hover {
        transform: none !important;
    }

    html[data-theme] body.store-body .mobile-bottom-nav .nav-item:active {
        transform: scale(.97) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.store-body,
    body.store-body *,
    body.store-body *::before,
    body.store-body *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    /* ================= COMPACT MOBILE FOOTER ================= */
    html[data-theme] body.store-body .site-footer {
        margin-top: 16px !important;
        padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
        background: color-mix(in srgb, var(--card-bg, #fff) 96%, transparent) !important;
        border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)) !important;
    }

    html[data-theme] body.store-body .site-footer .footer-top {
        padding: 14px 0 8px !important;
    }

    html[data-theme] body.store-body .site-footer .footer-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 0 12px !important;
    }

    /* Row 1: Brand on right, Social icons on left */
    html[data-theme] body.store-body .site-footer .about-col {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 50%, transparent) !important;
    }

    html[data-theme] body.store-body .site-footer .footer-brand-logo {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin: 0 !important;
    }

    html[data-theme] body.store-body .site-footer .footer-brand-logo img {
        width: 28px !important;
        height: 28px !important;
        border-radius: 7px !important;
    }

    html[data-theme] body.store-body .site-footer .footer-brand-logo span {
        font-size: .80rem !important;
        font-weight: 800 !important;
    }

    html[data-theme] body.store-body .site-footer .footer-desc {
        display: none !important;
    }

    html[data-theme] body.store-body .site-footer .merchant-footer-socials {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin: 0 !important;
    }

    html[data-theme] body.store-body .site-footer .merchant-footer-socials a {
        width: 30px !important;
        height: 30px !important;
        font-size: .78rem !important;
        border-radius: 8px !important;
        background: color-mix(in srgb, var(--brand-color, #7c3aed) 10%, transparent) !important;
        border: 1px solid color-mix(in srgb, var(--brand-color, #7c3aed) 22%, transparent) !important;
        color: var(--brand-color, #7c3aed) !important;
        display: grid !important;
        place-items: center !important;
    }

    /* Hide redundant quick links list (already permanently available in the sticky bottom bar) */
    html[data-theme] body.store-body .site-footer .footer-quick-links-col {
        display: none !important;
    }

    /* Customer Support & Contact streamlined into horizontal action chips */
    html[data-theme] body.store-body .site-footer .footer-customer-col,
    html[data-theme] body.store-body .site-footer .contact-col {
        padding: 0 !important;
        border: none !important;
    }

    html[data-theme] body.store-body .site-footer .footer-col h4 {
        display: none !important;
    }

    html[data-theme] body.store-body .site-footer .footer-links,
    html[data-theme] body.store-body .site-footer .contact-info {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    html[data-theme] body.store-body .site-footer .footer-links li,
    html[data-theme] body.store-body .site-footer .contact-info li {
        margin: 0 !important;
        list-style: none !important;
    }

    html[data-theme] body.store-body .site-footer .footer-links a,
    html[data-theme] body.store-body .site-footer .contact-info li a,
    html[data-theme] body.store-body .site-footer .contact-info li span {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        padding: 5px 11px !important;
        border-radius: 999px !important;
        background: color-mix(in srgb, var(--card-bg, #fff) 85%, transparent) !important;
        border: 1px solid color-mix(in srgb, var(--brand-color, #7c3aed) 16%, var(--border-color, #e2e8f0)) !important;
        font-size: .72rem !important;
        font-weight: 600 !important;
        color: var(--text-main, #333) !important;
        text-decoration: none !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
    }

    html[data-theme] body.store-body .site-footer .footer-links a i,
    html[data-theme] body.store-body .site-footer .contact-info li i {
        color: var(--brand-color, #7c3aed) !important;
        font-size: .70rem !important;
    }

    /* Hide duplicate email and repeated whatsapp link on mobile */
    html[data-theme] body.store-body .site-footer .contact-col li:has(a[href*="mailto"]),
    html[data-theme] body.store-body .site-footer .contact-col li:has(a[href*="wa.me"]) {
        display: none !important;
    }

    /* Footer Bottom: compact centered row */
    html[data-theme] body.store-body .site-footer .footer-bottom {
        padding: 8px 12px 6px !important;
        border-top: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 40%, transparent) !important;
    }

    html[data-theme] body.store-body .site-footer .bottom-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        text-align: center !important;
    }

    html[data-theme] body.store-body .site-footer .copyright p {
        font-size: .66rem !important;
        color: var(--text-muted, #888) !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }

    html[data-theme] body.store-body .site-footer .payment-methods {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 3px 10px !important;
        border-radius: 999px !important;
        background: color-mix(in srgb, var(--card-bg, #fff) 90%, transparent) !important;
        border: 1px solid var(--border-color, #e2e8f0) !important;
        font-size: .65rem !important;
    }

    html[data-theme] body.store-body .site-footer .payment-methods i {
        font-size: .8rem !important;
        color: var(--brand-color, #7c3aed) !important;
    }

    html[data-theme] body.store-body .site-footer .payment-methods span {
        font-size: .65rem !important;
        color: var(--text-muted, #777) !important;
    }
    /* ================= STORE FEATURES: 3 CARDS SIDE-BY-SIDE ================= */
    html[data-theme] body.store-body .store-features,
    .store-features {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
        margin-bottom: 22px !important;
        overflow: visible !important;
    }

    html[data-theme] body.store-body .store-features .feature-box,
    .store-features .feature-box,
    .feature-box {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        min-width: 0 !important;
        min-height: 92px !important;
        padding: 9px 4px !important;
        gap: 5px !important;
        border-radius: 13px !important;
        box-sizing: border-box !important;
    }

    html[data-theme] body.store-body .store-features .feature-icon,
    .store-features .feature-icon,
    .feature-icon {
        width: 36px !important;
        height: 36px !important;
        flex: 0 0 36px !important;
        border-radius: 10px !important;
        display: grid !important;
        place-items: center !important;
        margin: 0 auto !important;
    }

    html[data-theme] body.store-body .store-features .feature-icon i,
    .store-features .feature-icon i,
    .feature-icon i {
        font-size: .90rem !important;
    }

    html[data-theme] body.store-body .store-features .feature-info,
    .store-features .feature-info,
    .feature-info {
        width: 100% !important;
        min-width: 0 !important;
        text-align: center !important;
    }

    html[data-theme] body.store-body .store-features .feature-info h4,
    .store-features .feature-info h4,
    .feature-info h4 {
        font-size: clamp(10px, 2.8vw, 11.5px) !important;
        font-weight: 800 !important;
        line-height: 1.25 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    html[data-theme] body.store-body .store-features .feature-info p,
    .store-features .feature-info p,
    .feature-info p {
        font-size: clamp(8.5px, 2.2vw, 9.5px) !important;
        line-height: 1.3 !important;
        margin: 3px 0 0 !important;
        color: var(--text-muted, #71717a) !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
}
