/* Final mobile sticky layer rules.
   Keeps bottom navigation, product sticky buy, checkout sticky submit, and scroll-to-top from overlapping. */

@media (max-width: 767px) {
    :root {
        --ip-bottom-nav-height: 74px;
        --ip-bottom-gap: 8px;
        --ip-sticky-shadow: 0 18px 46px rgba(17, 26, 54, .20);
    }

    body {
        padding-bottom: calc(var(--ip-bottom-nav-height) + 12px + env(safe-area-inset-bottom)) !important;
    }

    .quick-actions {
        z-index: 120 !important;
    }

    .scroll-top-button {
        z-index: 119 !important;
        bottom: calc(var(--ip-bottom-nav-height) + 16px + env(safe-area-inset-bottom)) !important;
    }

    .product-mobile-sticky-buy {
        left: max(10px, env(safe-area-inset-left)) !important;
        right: max(10px, env(safe-area-inset-right)) !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        z-index: 124 !important;
        box-shadow: var(--ip-sticky-shadow) !important;
    }

    .checkout-submit-block {
        z-index: 124 !important;
    }

    body:has(.product-mobile-sticky-buy),
    body:has(.checkout-page--final) {
        padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    }

    body:has(.product-mobile-sticky-buy) .quick-actions,
    body:has(.checkout-page--final) .quick-actions {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(calc(100% + 20px)) !important;
    }

    body:has(.product-mobile-sticky-buy) .scroll-top-button,
    body:has(.checkout-page--final) .scroll-top-button {
        bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    }

    body:has(.product-mobile-sticky-buy) .product-check-block {
        margin-bottom: calc(98px + env(safe-area-inset-bottom)) !important;
    }

    body:has(.checkout-page--final) .checkout-submit-block {
        bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }

    body.menu-open .product-mobile-sticky-buy,
    body.catalog-drawer-open .product-mobile-sticky-buy,
    body.filters-open .product-mobile-sticky-buy,
    body.lightbox-open .product-mobile-sticky-buy,
    body.menu-open .checkout-submit-block,
    body.catalog-drawer-open .checkout-submit-block,
    body.filters-open .checkout-submit-block,
    body.lightbox-open .checkout-submit-block {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(calc(100% + 20px)) !important;
    }
}

@media (min-width: 768px) {
    .product-mobile-sticky-buy {
        display: none !important;
    }
}
