/**
 * 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: var(--theme-topbar-bg, var(--theme-primary, #007bff));
        border-top: 1px solid color-mix(in srgb, var(--theme-topbar-bg, var(--theme-primary, #007bff)) 72%, #ffffff);
        box-shadow: 0 -6px 20px color-mix(in srgb, var(--theme-topbar-bg, var(--theme-primary, #007bff)) 32%, transparent);
        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: var(--theme-primary, #007bff);
        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: var(--theme-primary, #007bff);
        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(--theme-primary, #007bff);
    }

    .mobile-app-nav__item.is-active .mobile-app-nav__icon-wrap {
        background: color-mix(in srgb, #ffffff 20%, transparent);
        box-shadow: 0 4px 12px color-mix(in srgb, #000000 18%, transparent);
    }

    .mobile-app-nav__item.is-active i {
        color: var(--theme-primary, #007bff);
        transform: translateY(-1px);
    }

    .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;
    }
}

@media (min-width: 992px) {
    .mobile-app-nav {
        display: none !important;
    }
}
