/* ============================================================================
   Shop navigation (16 Nov 2026, owner: app-style shopping on phones)
   1. .shop-tabbar   floating bottom tab bar (Shop / Search / Cart / Account / Help) - phones, shop pages only
   2. .shop-help-sheet  the Help bottom sheet (the quick-contact buttons live here on shop pages)
   3. #deptStrip     the department band: a sticky one-line strip that swipes sideways on phones;
                     a tap opens the department's sub-menu (photo per product type) just under the strip
   4. the product page's add-to-cart bar floats above the tab bar; the chat button moves into Help
   Loaded only on the store pages (Helpers/ShopPages) and every rule is for phones (below 768 px): owner 16 Nov -
   "ONLY FOR MOBILE ON STORE, NOT ON ANY OTHER PAGE AND NOT FOR DESKTOP". Behaviour: wwwroot/js/shop-nav.js.
   Never put backdrop-filter / transform / filter on #deptStrip or its parents: the phone sub-menu is
   position: fixed and would then be placed inside the strip (owner bug report, 2 Nov).
   ========================================================================== */

:root { --stb-h: 66px; --stb-gap: 10px; --stb-space: calc(var(--stb-h) + var(--stb-gap) * 2 + env(safe-area-inset-bottom, 0px)); }

/* ---------------------------------------------------------------- 1. tab bar */
.shop-tabbar {
    position: fixed; left: 10px; right: 10px; bottom: calc(var(--stb-gap) + env(safe-area-inset-bottom, 0px)); z-index: 1035;
    height: var(--stb-h); padding: 6px; display: flex; align-items: stretch; gap: 2px;
    border-radius: 24px; background: rgba(255, 255, 255, .84);
    -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid rgba(20, 40, 58, .10);
    box-shadow: 0 14px 34px rgba(20, 40, 58, .22), 0 3px 8px rgba(20, 40, 58, .08), inset 0 1px 0 rgba(255, 255, 255, .7);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { .shop-tabbar { background: rgba(255, 255, 255, .97); } }
.shop-tabbar.is-hidden { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }

.stb-tab {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; margin: 0; padding: 0; background: transparent; border-radius: 18px; cursor: pointer;
    color: #3b4b5b; text-decoration: none; font-family: var(--pg-font, 'Poppins', system-ui, sans-serif);
    -webkit-tap-highlight-color: transparent; transition: background .2s ease, color .2s ease, transform .12s ease;
}
.stb-tab:hover { color: var(--pg-ink, #14283a); }
.stb-tab:active { transform: scale(.93); }
.stb-tab:focus-visible { outline: 3px solid var(--pg-sun, #ffc107); outline-offset: -3px; }
.stb-ico { position: relative; display: flex; font-size: 1.32rem; line-height: 1; }
.stb-lbl { font-size: .66rem; font-weight: 600; line-height: 1; letter-spacing: .01em; white-space: nowrap; }
.stb-tab.is-active {
    color: var(--pg-ink, #14283a);
    background: linear-gradient(180deg, #ffd54a 0%, var(--pg-sun, #ffc107) 100%);
    box-shadow: 0 6px 14px rgba(224, 168, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.stb-tab.is-active .stb-lbl { font-weight: 700; }
.stb-badge {
    position: absolute; top: -7px; left: 60%; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
    background: var(--pg-bad, #d8463f); color: #fff; border: 2px solid #fff;
    font: 700 .64rem/15px var(--pg-font, 'Poppins', system-ui, sans-serif); text-align: center;
}
.stb-badge.is-bump { animation: stb-bump .5s ease; }
@keyframes stb-bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* room for the bar at the end of the page; the chat button moves into Help; back-to-top sits above the bar */
@media (max-width: 767.98px) {
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) { padding-bottom: var(--stb-space) !important; }
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) #ai-chatbot-toggle { display: none !important; }
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) .btn-back-to-top { bottom: calc(var(--stb-space) + 8px) !important; right: 14px !important; }
    :is(body.has-shop-tabbar, body:has(#shopTabbar)).pd-sticky-on { padding-bottom: calc(var(--stb-space) + 76px) !important; }
    :is(body.has-shop-tabbar, body:has(#shopTabbar)).pd-sticky-on .btn-back-to-top { bottom: calc(var(--stb-space) + 84px) !important; }
}

/* ---------------------------------------------------------------- 2. Help sheet */
.shop-help-sheet.offcanvas-bottom {
    height: auto; max-height: 88vh; border: 0; border-radius: 26px 26px 0 0; background: #fff;
    box-shadow: 0 -16px 44px rgba(20, 40, 58, .28); padding-bottom: env(safe-area-inset-bottom, 0px);
    font-family: var(--pg-font, 'Poppins', system-ui, sans-serif);
}
.shs-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(20, 40, 58, .18); margin: 10px auto 0; }
.shop-help-sheet .offcanvas-header { align-items: flex-start; padding: 12px 18px 6px; }
.shop-help-sheet .offcanvas-title { font-size: 1.22rem; font-weight: 800; color: var(--pg-ink, #14283a); letter-spacing: -.01em; margin: 0; }
.shs-status { display: flex; align-items: center; gap: 7px; margin: 3px 0 0; font-size: .82rem; font-weight: 600; color: var(--pg-muted, #5f6f7f); }
.shs-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pg-bad, #d8463f); box-shadow: 0 0 0 4px rgba(216, 70, 63, .15); }
.shs-status.is-open { color: #17784a; }
.shs-status.is-open .shs-dot { background: var(--pg-good, #1f9d61); box-shadow: 0 0 0 4px rgba(31, 157, 97, .16); }
.shop-help-sheet .offcanvas-body { padding: 8px 16px 18px; }
.shs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shs-act {
    display: flex; align-items: center; gap: 10px; min-height: 66px; min-width: 0; padding: 11px 12px; margin: 0;
    border-radius: 18px; background: #f3f6f9; border: 1px solid rgba(20, 40, 58, .07);
    color: var(--pg-ink, #14283a); text-decoration: none; text-align: left; font: inherit; cursor: pointer;
    -webkit-tap-highlight-color: transparent; transition: background .2s, transform .12s;
}
.shs-act[hidden] { display: none; }
.shs-act:hover { background: #eaf0f5; color: var(--pg-ink, #14283a); }
.shs-act:active { transform: scale(.97); }
.shs-act:focus-visible { outline: 3px solid var(--pg-sun, #ffc107); outline-offset: 2px; }
.shs-ico {
    flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem;
    background: #fff; color: var(--pg-sea, #1a5f7a); box-shadow: 0 2px 6px rgba(20, 40, 58, .10);
}
.shs-act-wa { background: #e9f9ef; border-color: rgba(37, 211, 102, .25); }
.shs-act-wa:hover { background: #dcf5e6; }
.shs-act-wa .shs-ico { background: #25d366; color: #fff; }
.shs-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.shs-txt strong { font-size: .86rem; font-weight: 700; }
.shs-txt small { margin-top: 2px; font-size: .72rem; line-height: 1.25; color: var(--pg-muted, #5f6f7f); overflow-wrap: anywhere; }
.shs-hours { margin-top: 12px; border-radius: 18px; background: #f3f6f9; border: 1px solid rgba(20, 40, 58, .07); }
.shs-hours summary { padding: 13px 16px; font-size: .88rem; font-weight: 700; color: var(--pg-ink, #14283a); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.shs-hours summary::-webkit-details-marker { display: none; }
.shs-hours summary::after { content: "\F282"; font-family: bootstrap-icons; margin-left: auto; transition: transform .2s; }
.shs-hours[open] summary::after { transform: rotate(180deg); }
.shs-hours dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; padding: 0 16px 14px; font-size: .84rem; }
.shs-hours dt { font-weight: 500; color: var(--pg-muted, #5f6f7f); }
.shs-hours dd { margin: 0; font-weight: 600; color: var(--pg-ink, #14283a); text-align: right; }

/* ---------------------------------------------------------------- 3. department strip (phones) */
/* (the strip arrows, product-type photos and plain counts are hidden by default in Views/Store/Index.cshtml) */
@media (max-width: 767.98px) {   /* phones only (owner 16 Nov: not tablets, not desktop) */
    #deptStrip {
        position: sticky; top: var(--shop-header-h, 0px); z-index: 1018;
        background: #eef2f6 !important; border-bottom: 1px solid rgba(20, 40, 58, .10); box-shadow: none;
        transition: box-shadow .2s ease;
    }
    #deptStrip.is-stuck { box-shadow: 0 8px 18px rgba(20, 40, 58, .10); }
    #deptStrip:has(.category-item.show) { z-index: 1045; }
    #deptStrip > .container-fluid { padding: 0; }
    #deptStrip .category-nav-wrapper { position: relative; }
    #deptStrip .category-nav {
        display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; gap: 0;
        overflow-x: auto; overflow-y: visible; padding: 0 6px; margin: 0;
        scroll-snap-type: x proximity; scroll-padding: 0 36px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    #deptStrip .category-nav::-webkit-scrollbar { display: none; }
    #deptStrip .category-item { flex: 0 0 auto; width: auto; scroll-snap-align: start; z-index: auto; }
    #deptStrip .category-link {
        position: relative; flex-direction: row; align-items: center; gap: 6px; width: auto; height: 48px; padding: 0 11px;
        border-radius: 0; border-bottom: 0 !important; background: transparent !important;
        color: var(--pg-ink, #14283a); text-decoration: none; -webkit-tap-highlight-color: transparent;
    }
    #deptStrip .category-link span:not(.badge) {
        font-size: .71rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
        white-space: nowrap; max-width: none; max-height: none; overflow: visible; line-height: 1;
    }
    #deptStrip .category-link i:first-child { font-size: 1.02rem; color: var(--pg-sea, #1a5f7a); }
    #deptStrip .category-link .category-count { display: none; }
    #deptStrip .category-link .dropdown-arrow { display: inline-block; font-size: .62rem; opacity: .55; margin-left: -1px; transition: transform .2s ease; }
    #deptStrip .category-item:hover .category-link { background: transparent !important; color: var(--pg-ink, #14283a); }
    #deptStrip .category-item:hover .dropdown-arrow { transform: none; }
    /* the current / open department: a rounded bar under the name (sun = the page you are on, ink = menu open) */
    #deptStrip .category-link::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; transition: background .2s ease; }
    #deptStrip .category-item.active .category-link::after { background: var(--pg-sun, #ffc107); }
    #deptStrip .category-item.show .category-link::after { background: var(--pg-ink, #14283a); }
    #deptStrip .category-item.active .category-link i:first-child { color: var(--pg-ink, #14283a); }
    #deptStrip .category-item.show .category-link { color: var(--pg-ink, #14283a); }
    #deptStrip .category-item.show .dropdown-arrow { transform: rotate(180deg); opacity: 1; }

    /* fades + arrows at the ends while there is more to swipe to */
    #deptStrip .dept-strip-arrow {
        position: absolute; top: 0; bottom: 3px; z-index: 2; width: 44px; border: 0; padding: 0; margin: 0;
        display: flex; align-items: center; color: var(--pg-ink, #14283a); font-size: 1rem; cursor: pointer;
        opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    #deptStrip .dept-strip-next { right: 0; justify-content: flex-end; padding-right: 8px; background: linear-gradient(to left, #eef2f6 45%, rgba(238, 242, 246, 0)); }
    #deptStrip .dept-strip-prev { left: 0; justify-content: flex-start; padding-left: 8px; background: linear-gradient(to right, #eef2f6 45%, rgba(238, 242, 246, 0)); }
    #deptStrip.can-next .dept-strip-next, #deptStrip.can-prev .dept-strip-prev { opacity: 1; pointer-events: auto; }

    /* the sub-menu: a card just under the strip, a photo per product type, two columns */
    #deptStrip .subcategory-dropdown {
        position: fixed; left: 8px; right: 8px; top: var(--dept-menu-top, 120px) !important; bottom: auto;
        width: auto; min-width: 0; max-width: none;
        max-height: calc(100vh - var(--dept-menu-top, 120px) - var(--stb-space, 20px) - 8px); max-height: calc(100dvh - var(--dept-menu-top, 120px) - var(--stb-space, 20px) - 8px);
        overflow-y: auto; overscroll-behavior: contain; border-radius: 20px; padding: 8px; z-index: 1050;
        background: #fff; border: 1px solid rgba(20, 40, 58, .10); box-shadow: 0 22px 50px rgba(20, 40, 58, .30);
        opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .18s ease, transform .2s ease, visibility 0s linear .2s;
    }
    #deptStrip .category-item.show .subcategory-dropdown { opacity: 1; visibility: visible; transform: none; transition: opacity .18s ease, transform .2s ease; }
    #deptStrip .category-item:hover:not(.show) .subcategory-dropdown { opacity: 0; visibility: hidden; }
    #deptStrip .subcategory-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0; }
    #deptStrip .subcategory-item {
        display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 58px; padding: 7px 8px; margin: 0;
        border-radius: 14px; background: #f4f6f9; color: var(--pg-ink, #14283a); font-size: .78rem; font-weight: 600; line-height: 1.2;
        transition: background .15s ease;
    }
    #deptStrip .subcategory-item:hover { padding-left: 8px; background: #e9eef4; }
    #deptStrip .subcategory-item.active { background: var(--pg-sun-soft, rgba(255, 193, 7, .18)); box-shadow: inset 0 0 0 2px var(--pg-sun, #ffc107); }
    #deptStrip .subcategory-item > i { flex: none; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: #fff; color: var(--pg-sea, #1a5f7a); font-size: .9rem; }
    #deptStrip .subcategory-all {
        grid-column: 1 / -1; min-height: 52px; background: var(--pg-ink, #14283a); color: #fff; border: 0; font-size: .86rem; font-weight: 700;
    }
    #deptStrip .subcategory-all:hover { background: var(--pg-sea-deep, #0f3f55); color: #fff; }
    #deptStrip .subcategory-all > i { background: rgba(255, 255, 255, .12); color: var(--pg-sun, #ffc107); width: 38px; height: 38px; }
    #deptStrip .subcategory-all .subcat-count { margin-left: auto; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-size: .72rem; }
    #deptStrip .subcat-thumb { flex: none; width: 42px; height: 42px; border-radius: 11px; background: #fff; display: grid; place-items: center; overflow: hidden; }
    #deptStrip .subcat-thumb img { width: 88%; height: 88%; object-fit: contain; mix-blend-mode: multiply; }
    #deptStrip .subcat-name { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    #deptStrip .subcat-thumb ~ .subcat-chev, #deptStrip .subcat-count-d { display: none; }
    #deptStrip .subcategory-all .subcat-count-m { display: inline-block; }
}
@media (max-width: 359.98px) { #deptStrip .subcategory-list { grid-template-columns: 1fr; } }


/* ---------------------------------------------------------------- 4. product page: add-to-cart floats above the tab bar */
@media (max-width: 767.98px) {
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) .pd-sticky {
        left: 10px; right: 10px; bottom: calc(var(--stb-h) + var(--stb-gap) * 2 - 2px + env(safe-area-inset-bottom, 0px));
        padding: 8px 8px 8px 16px; border-radius: 20px; border: 1px solid rgba(20, 40, 58, .10);
        background: rgba(255, 255, 255, .97); box-shadow: 0 12px 30px rgba(20, 40, 58, .20);
    }
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) .pd-sticky .pd-sticky-btn { padding: 11px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .shop-tabbar, .stb-tab, .shs-act, #deptStrip .subcategory-dropdown, #deptStrip .dropdown-arrow { transition: none !important; }
    .stb-badge.is-bump { animation: none; }
}
@media print { .shop-tabbar, .shop-help-sheet { display: none !important; } }

/* the store's compare bar (ticked products) floats above the tab bar on phones instead of covering it */
@media (max-width: 767.98px) {
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) .compare-bar {
        left: 10px; right: 10px; bottom: calc(var(--stb-h) + var(--stb-gap) * 2 - 2px + env(safe-area-inset-bottom, 0px));
        border-radius: 20px; padding: 10px 0;
    }
}

/* phones on shop pages: the cart lives in the tab bar, so the header keeps only the wishlist + menu buttons
   (on a 360 px phone the menu button wrapped to a second line with all three) */
@media (max-width: 767.98px) {
    :is(body.has-shop-tabbar, body:has(#shopTabbar)) .hpm-mobile-actions .cart-link { display: none !important; }
}
