/* GEX cart flow (modelled on dacby.com): the cart sidebar is replaced by the cart page,
   a Cart > Checkout progress bar sits on the cart and checkout pages,
   phones get a sticky bottom button (Next on the cart, Place Order on the checkout),
   and adding to the cart shows a small "Added to cart" bar with a View cart button. */

/* The old sidebar is never shown. */
.gexc-cart-drawer, .gexc-drawer-overlay { display: none !important; }

/* Progress bar */
.gex-steps {
    list-style: none;
    display: flex;
    gap: 12px;
    margin: 0 0 18px;
    padding: 0;
}
.gex-steps li { flex: 1 1 0; margin: 0; padding: 0; font-size: 11px; line-height: 1.2; color: #757575; }
.gex-steps li > *, .gex-steps li > a { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.gex-steps i { display: block; height: 4px; border-radius: 2px; background: #e0e0e0; transition: background .2s; }
.gex-steps li.done i, .gex-steps li.on i { background: var(--gexc-orange, #FF6A00); }
.gex-steps li.on { color: #111; font-weight: 600; }
.gex-steps li a, .gex-steps li a:hover { color: inherit !important; }

/* Added to cart bar */
#gex-added {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    z-index: 260;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #111;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
#gex-added.show { opacity: 1; transform: none; pointer-events: auto; }
#gex-added a {
    flex: none;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .03em;
}
@media (min-width: 800px) {
    #gex-added { left: auto; right: 24px; bottom: 24px; width: 380px; }
}

/* Phones: sticky bottom button on the cart and checkout pages */
@media (max-width: 799px) {
    body.woocommerce-cart, body.woocommerce-checkout { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
    html:root body.woocommerce-cart .wc-block-cart__submit-container {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 240;
        margin: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box;
        background: #fff;
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
    }
    body.woocommerce-cart .wc-block-cart__submit-button .wc-block-components-button__text { font-size: 0; }
    body.woocommerce-cart .wc-block-cart__submit-button .wc-block-components-button__text::after { content: "Proceed to Checkout"; font-size: 15px; }
    body.woocommerce-checkout .wc-block-checkout__actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 240;
        margin: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
    }
    body.woocommerce-checkout .wc-block-checkout__actions .wc-block-components-checkout-return-to-cart-button,
    body.woocommerce-checkout .wc-block-checkout__actions .gexc-blocks-trust { display: none; }
}

/* Cart and checkout: the footer links go, copyright and "Powered by MW" stay. */
body.woocommerce-cart .gexc-footer-grid,
body.woocommerce-checkout .gexc-footer-grid { display: none; }

/* ---------- Phones: Dacby-style cart (app bar, Items, Payment details, sticky Next) ---------- */
.gex-appbar { display: none; }
@media (max-width: 799px) {
    body.gex-has-appbar { padding-top: 56px; background: #fff; }
    html:root body.gex-has-appbar .gexc-header,
    html:root body.gex-has-appbar .gexc-strip { display: none !important; }
    html:root body.gex-has-appbar main.site-main { padding-left: 0 !important; padding-right: 0 !important; padding-top: 0 !important; }
    .gex-appbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 250;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 56px;
        background: #fff;
        border-bottom: 1px solid #e5e5e5;
        color: #111;
        font-size: 16px;
        font-weight: 500;
    }
    .gex-appbar a {
        position: absolute;
        left: 6px;
        top: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: #111 !important;
        -webkit-tap-highlight-color: transparent;
    }
    /* Home button sits right next to the back arrow. */
    .gex-appbar a.gex-appbar-home { left: 50px; }
    .gex-appbar svg { display: block; }
    body.gex-has-appbar .mw-container { padding-left: 0; padding-right: 0; }
    body.gex-has-appbar .gex-steps li > span { display: block; margin-top: 10px; }
    body.gex-has-appbar .gex-steps li > a { gap: 10px; }
    body.gex-has-appbar .gex-steps { margin: 0; padding: 16px 16px 14px; background: #fff; border-bottom: 1px solid #e5e5e5; }

    html:root body.woocommerce-checkout .wp-block-woocommerce-checkout { padding: 12px 16px 8px; }

    /* Items */
    html:root body.woocommerce-cart .wc-block-cart__main {
        position: relative;
        margin: 0;
        padding: 49px 0 0;
        background: #fff;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: none;
        border-radius: 0;
    }
    body.woocommerce-cart .wc-block-cart__main::before {
        content: "Items";
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        height: 49px;
        box-sizing: border-box;
        padding: 0 16px 0 46px;
        border-bottom: 1px solid #e5e5e5;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") no-repeat 16px center;
        color: #111;
        font-size: 15px;
        font-weight: 600;
        line-height: 49px;
    }
    body.woocommerce-cart .wc-block-cart__main::after {
        content: attr(data-count);
        position: absolute;
        right: 16px;
        top: 0;
        color: #444;
        font-size: 13px;
        line-height: 49px;
    }
    html:root body.woocommerce-cart table.wc-block-cart-items {
        margin: 0;
        padding: 0 16px;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }
    html:root body.woocommerce-cart .wc-block-cart-items__row td { padding-top: 14px !important; padding-bottom: 14px !important; }
    html:root body.woocommerce-cart .wc-block-cart-items__row { padding-bottom: 0 !important; border-bottom: 1px solid #ececec; }
    body.woocommerce-cart .wc-block-cart-items__row:last-child { border-bottom: 0; }
    body.woocommerce-cart .wc-block-cart-item__image img { border-radius: 4px; }

    /* Payment details */
    html:root body.woocommerce-cart .wc-block-cart__sidebar {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    body.woocommerce-cart .wc-block-cart__sidebar::before {
        content: "Payment details";
        display: block;
        padding: 18px 16px;
        background: #f0f1f4;
        color: #111;
        font-size: 16px;
        font-weight: 500;
    }
    body.woocommerce-cart .wp-block-woocommerce-cart-order-summary-block { padding: 4px 16px 0; }
    body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label { font-size: 0; }
    body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label::after { content: "Total"; font-size: 15px; font-weight: 700; }
    body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value { font-size: 15px; font-weight: 700; }
    body.woocommerce-cart .gexc-blocks-trust { padding: 14px 16px; }
    /* Product titles show in full. */
    html:root body.woocommerce-cart .wc-block-components-product-name {
        display: block;
        overflow: visible;
        white-space: normal;
        text-overflow: clip;
        -webkit-line-clamp: unset;
        max-height: none;
    }
    /* Tax note under the total */
    body.woocommerce-cart .wc-block-components-totals-footer-item { flex-wrap: wrap; }
    body.woocommerce-cart .wc-block-components-totals-footer-item::after {
        content: "Inclusive of all taxes";
        flex: 0 0 100%;
        margin-top: 2px;
        color: #757575;
        font-size: 12px;
        font-weight: 400;
        line-height: 1.3;
    }
    /* No dead space between the last section and the footer credits. */
    html:root body.gex-has-appbar { padding-bottom: 0 !important; }
    html:root body.gex-has-appbar main.site-main { padding-bottom: 0 !important; margin-bottom: 0 !important; }
    html:root body.gex-has-appbar .gexc-footer { padding: 0 18px calc(96px + env(safe-area-inset-bottom, 0px)); }
    html:root body.gex-has-appbar .gexc-footer-bottom { margin-top: 14px; }
    html:root body.woocommerce-cart .wc-block-cart__submit-container {
        border-top: 1px solid #e5e5e5;
        box-shadow: none;
    }
    html:root body.woocommerce-cart .wc-block-cart__submit-button,
    html:root body.woocommerce-checkout .wc-block-components-checkout-place-order-button { border-radius: 10px !important; min-height: 50px; }
}
