/**
 * Mobile app-style shell: safe areas, bottom tab bar, spacing for main content.
 * Shown only below 992px; desktop layout unchanged.
 */

:root {
    --mobile-app-nav-height: 56px;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(var(--mobile-app-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    .mobile-app-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        min-height: var(--mobile-app-nav-height);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #fff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
        justify-content: space-around;
        align-items: stretch;
    }

    .mobile-app-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        padding: 6px 4px 8px;
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
        text-align: center;
        color: #4b5563;
        text-decoration: none;
        border: 0;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    .mobile-app-nav__item i {
        font-size: 22px;
        line-height: 1;
        color: #4b5563;
        transition: color 0.2s ease, transform 0.2s ease;
    }

    .mobile-app-nav__item .mobile-app-nav__icon-wrap {
        width: 34px;
        height: 34px;
        border-radius: 999px;
        transition: background-color 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-app-nav__item.is-active {
        color: var(--mobile-app-primary, #007bff);
    }

    .mobile-app-nav__item.is-active .mobile-app-nav__icon-wrap {
        background: color-mix(in srgb, var(--mobile-app-primary, #007bff) 14%, #fff);
        box-shadow: 0 4px 12px color-mix(in srgb, var(--mobile-app-primary, #007bff) 20%, transparent);
    }

    .mobile-app-nav__item.is-active i {
        color: var(--mobile-app-primary, #007bff);
        transform: translateY(-1px);
    }

    /* Prevent global theme icon/link rules from washing out bottom-nav contrast. */
    .mobile-app-nav .mobile-app-nav__item,
    .mobile-app-nav .mobile-app-nav__item i {
        color: #4b5563 !important;
    }

    .mobile-app-nav .mobile-app-nav__item.is-active,
    .mobile-app-nav .mobile-app-nav__item.is-active i {
        color: var(--mobile-app-primary, #007bff) !important;
    }

    .mobile-app-nav__item.is-active span:last-child {
        font-weight: 700;
    }

    .mobile-app-nav__badge {
        position: absolute;
        top: -2px;
        inset-inline-end: -4px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        font-size: 10px;
        font-weight: 700;
        line-height: 18px;
        color: #fff;
        text-align: center;
        background: #e53935;
        border-radius: 9px;
    }

    .mobile-app-nav__badge.js-mobile-cart-count.is-empty {
        display: none;
    }

    .mobile-app-nav__icon-wrap {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 26px;
    }

    .scroll-to-top-btn {
        bottom: calc(var(--mobile-app-nav-height) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    }

    /* Slightly tighter header on small phones (optional app-like density) */
    .site-header.navbar-sticky.is-stuck .topbar,
    .site-header .topbar {
        transition: box-shadow 0.2s ease;
    }

    /* Sticky product CTA: keep Buy Now pink on press (override late global button states). */
    .product-sticky-cta__actions .js-product-buy-now,
    .product-sticky-cta__actions .js-product-buy-now:hover,
    .product-sticky-cta__actions .js-product-buy-now:focus,
    .product-sticky-cta__actions .js-product-buy-now:active,
    .product-sticky-cta__actions .js-product-buy-now.active {
        background: var(--theme-primary, #ef8a93) !important;
        border-color: var(--theme-primary, #ef8a93) !important;
        box-shadow: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    .product-sticky-cta__actions .js-product-buy-now i,
    .product-sticky-cta__actions .js-product-buy-now i::before,
    .product-sticky-cta__actions .js-product-buy-now:hover i,
    .product-sticky-cta__actions .js-product-buy-now:hover i::before,
    .product-sticky-cta__actions .js-product-buy-now:focus i,
    .product-sticky-cta__actions .js-product-buy-now:focus i::before,
    .product-sticky-cta__actions .js-product-buy-now:active i,
    .product-sticky-cta__actions .js-product-buy-now:active i::before,
    .product-sticky-cta__actions .js-product-buy-now.active i,
    .product-sticky-cta__actions .js-product-buy-now.active i::before {
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        opacity: 1 !important;
    }

    /* Prevent global .btn.btn-primary::before black overlay on tapped mobile sticky CTAs. */
    .product-sticky-cta__actions .btn.btn-primary::before,
    .product-sticky-cta__actions .btn.btn-primary::after,
    .product-sticky-cta__actions .js-product-buy-now::before,
    .product-sticky-cta__actions .js-product-buy-now::after {
        content: none !important;
        display: none !important;
        width: 0 !important;
        background: transparent !important;
    }
}

@media (min-width: 992px) {
    .mobile-app-nav {
        display: none !important;
    }
}
