/* GEX mobile shell, part 2 (phones and small tablets, up to 799px), modelled on dacby.com:
   header with the cart button (no search, Sell or Repair there), no floating cart or filter button,
   and Filters / Sell / Repair as bottom sheets instead of a side drawer and pop-ups.
   Loads on every page, including the cart. */
.gex-hcart { display: none; }
/* Top announcement strip: black instead of orange. */
html:root body .gexc-strip { background: #111 !important; }
@media (max-width: 799px) {
    /* ---------- Header ---------- */
    /* Slightly rounded bottom corners, the same 12px as the product cards. */
    html:root body .gexc-header,
    html:root body .gexc-header-top-outer { border-radius: 0 0 12px 12px !important; }
    html:root body .gexc-header-search,
    html:root body .gexc-header-sell,
    html:root body .gexc-header-actions .gexc-header-repair { display: none !important; }
    html:root body .gexc-header-top {
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: flex-start;
        gap: 0 4px !important;
        padding: 8px 10px 8px 16px !important;
    }
    html:root body .gexc-header-top::after { display: none !important; }
    html:root body .gexc-header-logo { margin-right: auto; }
    html:root body .gexc-header-account {
        order: 2 !important;
        flex: 0 0 44px !important;
        width: 44px !important;
        height: 44px !important;
        margin: 0 !important;
        position: static !important;
    }
    html:root body .gexc-header-actions {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 0 !important;
        margin: 0 !important;
        width: auto !important;
    }
    .gex-hcart {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        color: var(--gexc-black, #111);
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .gex-hcart:active { background: #f3f3f3; }
    .gex-hcart svg { display: block; width: 24px; height: 24px; }
    /* Account and cart icons look the same size (the person glyph fills less of its box) and colour on every page. */
    html:root body .gexc-header-account, html:root body .gex-hcart { color: #111 !important; }
    html:root body .gexc-header-account svg { display: block; width: 28px !important; height: 28px !important; margin: 0 auto; }
    .gex-hcart-count {
        position: absolute;
        top: 3px;
        right: 1px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        box-sizing: border-box;
        border-radius: 9px;
        background: var(--gexc-orange, #FF6A00);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 17px;
        text-align: center;
    }
    .gex-hcart-count[hidden] { display: none; }
    /* The header stays put (it used to fold away to reveal the search box). */
    html:root body .gexc-header.is-compact { transform: none !important; }
    html:root body .gexc-header.is-compact .gexc-header-top { padding-top: 8px !important; }
    html:root body .gexc-header.is-compact .gexc-header-logo,
    html:root body .gexc-header.is-compact .gexc-header-actions { pointer-events: auto; }

    /* ---------- Floating buttons are replaced by the header cart and the bottom bar ---------- */
    html:root body .gexc-cart-fab,
    html:root body .gexc-filter-fab { display: none !important; }

    /* ---------- Filters: bottom sheet ---------- */
    html:root body .gexc-shop-filters {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        max-height: 86vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(105%);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, .2);
    }
    html:root body .gexc-shop-filters.open { transform: none; }
    html:root body .gexc-shop-filters summary { padding-top: 26px; }
    html:root body .gexc-shop-filters summary::before,
    html:root body .gexc-sell-modal::before {
        content: "";
        position: absolute;
        top: 9px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin: 0 0 0 -20px;
        border-radius: 2px;
        background: #d9d9d9;
    }
    html:root body .gexc-shop-filters .gexc-shop-filters-inner { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

    /* ---------- Sell and Repair: bottom sheets ---------- */
    html:root body .gexc-sell-modal-overlay {
        display: flex;
        align-items: flex-end;
        padding: 0;
        background: rgba(17, 17, 17, .5);
        opacity: 0;
        visibility: hidden;
        transition: opacity .28s ease, visibility 0s .32s;
    }
    html:root body .gexc-sell-modal-overlay.open { opacity: 1; visibility: visible; transition: opacity .28s ease; }
    html:root body .gexc-sell-modal {
        max-width: none;
        width: 100%;
        max-height: 88vh;
        position: relative;
        padding: 34px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform .3s ease;
    }
    html:root body .gexc-sell-modal-overlay.open .gexc-sell-modal { transform: none; }
    /* ---------- Home: product cards use the same side margin as the shop page (16px) ---------- */
    html:root body.home .gexc-section .woocommerce { margin-left: -22px; margin-right: -22px; }

    /* ---------- Shop pages: no breadcrumb or title card, the results start right under the header ---------- */
    html:root body.gex-nav-shop .woocommerce-breadcrumb,
    html:root body.gex-nav-shop .woocommerce-products-header { display: none !important; }

    /* ---------- Category slider leaves the header (the bottom bar and Filters replace it) ---------- */
    html:root body .gexc-header-nav { display: none !important; }

    /* ---------- One close button for every sheet: black circle, white cross ---------- */
    html:root body .gexc-sell-modal-close,
    html:root body .gexc-filters-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        min-width: 36px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #111 !important;
        color: #fff !important;
        box-shadow: none;
    }
    html:root body .gexc-sell-modal-close { top: 16px; right: 16px; }
    html:root body .gexc-sell-modal-close svg,
    html:root body .gexc-filters-close svg { width: 18px; height: 18px; stroke: #fff !important; }
    html:root body .gexc-filters-close { margin-left: auto; }
    /* The sign-in toggle starts below the close button instead of under it. */
    html:root body .gexc-auth-modal { padding-top: 66px; }
    /* Sign In and Create Account share one height (both forms take the same grid cell; only the active one shows). */
    html:root body .gexc-auth-modal { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
    html:root body .gexc-auth-modal .gexc-auth-tabs { grid-row: 1; grid-column: 1; }
    html:root body .gexc-auth-modal .gexc-auth-form { display: block !important; grid-row: 2; grid-column: 1; visibility: hidden; pointer-events: none; }
    html:root body .gexc-auth-modal .gexc-auth-form.active { visibility: visible; pointer-events: auto; }
    /* Remember me: the label text sits right beside its checkbox. */
    html:root body .gexc-auth-remember { display: inline-flex; align-items: center; justify-content: flex-start; gap: 10px; }
    html:root body .gexc-auth-remember input { width: auto !important; flex: 0 0 auto; margin: 0; }

    /* ---------- Fields: 16px text (iOS zooms the page in on anything smaller), same look for selects ---------- */
    html:root body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
    html:root body select,
    html:root body textarea { font-size: 16px !important; }
    html:root body .gexc-sell-modal select,
    html:root body .gexc-auth-modal select {
        -webkit-appearance: none;
        appearance: none;
        height: 44px;
        padding-right: 40px;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 16px center / 12px 8px;
        color: #111;
        border-radius: 12px;
    }
}
