/* Only the totals box is hidden pre-JS. The fee rows arrive from the
     * server as "Service Fee — Colruyt" / "Tips for the shopper — Colruyt"
     * and are relabelled, reordered and given buttons by JS; showing that
     * churn looked broken. Products stay visible the whole time. */
    /* Woodmart renders .cart_totals without a .cart-collaterals wrapper, so
     * target it directly. Hidden until JS has relabelled and reordered the
     * fee rows, otherwise "Service Fee — Colruyt" flashes on every render. */
    /* Target .cart_totals directly — Woodmart renders no .cart-collaterals
     * wrapper, so the old rule matched nothing. This matters because
     * WooCommerce REPLACES the .cart_totals node on every AJAX update,
     * discarding any inline style we set; only a CSS rule keyed on the
     * body class survives the swap and keeps the fresh node hidden until
     * the labels have been rewritten. */
    /* While the totals rebuild, hide the CONTENTS (not the box) and paint a
     * white veil + spinner over it. Using the box's own pseudo-elements means
     * this survives WooCommerce replacing the .cart_totals node on AJAX —
     * the rule simply matches the new node too. visibility:hidden keeps the
     * layout height, so nothing jumps. */
    .cart_totals { position: relative; }

    body:not(.bm8-cart-ready) .cart_totals > * {
        visibility: hidden !important;
    }
    body:not(.bm8-cart-ready) .cart_totals::before {
        content: ''; position: absolute; inset: 0;
        background: #fff; z-index: 5; border-radius: 10px;
    }
    body:not(.bm8-cart-ready) .cart_totals::after {
        content: ''; position: absolute; top: 50%; left: 50%;
        width: 28px; height: 28px; margin: -14px 0 0 -14px;
        border: 3px solid #eee; border-top-color: var(--bm-blue);
        border-radius: 50%; z-index: 6;
        animation: bm8spin .8s linear infinite;
    }

/* ── Full white cover while the cart initialises / reloads (store switch) ──
   Hides the multi-pass init flashing behind a clean white page; the
   "Loading your carts" message sits on top. Removed once bm8-cart-ready. */
body.woocommerce-cart:not(.bm8-cart-ready)::before {
    content: ''; position: fixed; inset: 0; background: #fff; z-index: 9998;
}
body.woocommerce-cart.bm8-cart-ready::before { display: none; }

/* ── Loading message ── */
.bm8-cart-loading-msg {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}
.woocommerce-cart:not(.bm8-cart-ready) .bm8-cart-loading-msg {
    display: block;
}
.woocommerce-cart.bm8-cart-ready .bm8-cart-loading-msg {
    display: none;
}
.bm8-cart-loading-msg-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.bm8-cart-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #FF6B35;
    border-radius: 50%;
    animation: bm8spin 0.8s linear infinite;
}
@keyframes bm8spin { to { transform: rotate(360deg); } }
.bm8-cart-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: #555;
}
