/**
 * Inspira Woo Add-ons — Mini-Cart Drawer styles.
 *
 * Loaded on every frontend page when the feature is enabled. The drawer
 * lives at wp_footer and is hidden until JS sets is-open. Performance:
 * the drawer + backdrop are pointer-events:none until is-open so they
 * don't interfere with normal page interaction.
 */

/* ─── Root + backdrop ──────────────────────────────────────── */

.iwa-minicart-root {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
}

.iwa-minicart-root.is-open {
    pointer-events: auto;
}

.iwa-minicart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 19, 15, 0.55);
    opacity: 0;
    transition: opacity 280ms ease;
    cursor: pointer;
}

.iwa-minicart-root.is-open .iwa-minicart-backdrop {
    opacity: 1;
}

/* ─── Drawer ──────────────────────────────────────────────── */

.iwa-minicart {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--iwa-mc-width, 420px);
    max-width: 100%;
    background: #FFFFFF;
    box-shadow: -8px 0 28px rgba(20, 19, 15, 0.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 320ms cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.iwa-minicart-root.is-open .iwa-minicart {
    transform: translateX(0);
}

.iwa-minicart:focus {
    outline: none;
}

/* Responsive widths */
@media (max-width: 768px) {
    .iwa-minicart { width: 80%; }
}
@media (max-width: 480px) {
    .iwa-minicart { width: 100%; }
}

/* ─── Header ──────────────────────────────────────────────── */

.iwa-minicart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #E8E4D8;
    flex-shrink: 0;
}

.iwa-minicart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 500;
    font-size: 22px;
    color: #14130F;
    line-height: 1.2;
}

.iwa-minicart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: #C8472B;
    color: #FFFFFF;
    border-radius: 999px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-style: normal;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0;
}

.iwa-minicart-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #6B665B;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.iwa-minicart-close:hover,
.iwa-minicart-close:focus {
    background: #F4F1E8;
    color: #14130F;
    border-color: #E8E4D8;
    outline: none;
}

/* ─── Body (fragment target) ──────────────────────────────── */

.iwa-minicart-fragment {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* When loading, dim the body */
.iwa-minicart.is-loading .iwa-minicart-fragment {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 150ms ease;
}

/* Per-item pending state (qty changing — subtle, doesn't block interaction) */
.iwa-minicart-item.is-pending .iwa-minicart-item-price,
.iwa-minicart-item.is-pending .iwa-minicart-item-qty {
    opacity: 0.55;
    transition: opacity 120ms ease;
}

/* Per-item removing state (fade + slide out) */
.iwa-minicart-item.is-removing {
    opacity: 0;
    transform: translateX(32px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border-bottom-color: transparent;
    overflow: hidden;
    transition:
        opacity 220ms ease,
        transform 220ms ease,
        max-height 280ms ease 50ms,
        padding 280ms ease 50ms,
        border-bottom-color 280ms ease 50ms;
}

/* ─── Tabs (placeholder for future Wishlist) ──────────────── */

.iwa-minicart-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid #E8E4D8;
    flex-shrink: 0;
}

.iwa-minicart-tab {
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6B665B;
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease;
}

.iwa-minicart-tab[aria-selected="true"] {
    color: #14130F;
    border-bottom-color: #C8472B;
}

/* ─── Empty state ─────────────────────────────────────────── */

.iwa-minicart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    color: #6B665B;
    gap: 14px;
}

.iwa-minicart-empty svg {
    color: #D8D2C2;
}

.iwa-minicart-empty-message {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #14130F;
}

.iwa-minicart-empty-link {
    display: inline-block;
    padding: 10px 22px;
    background: #14130F;
    color: #FFFFFF;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-radius: 4px;
    transition: background 150ms ease;
}

.iwa-minicart-empty-link:hover {
    background: #C8472B;
    color: #FFFFFF;
}

/* ─── Items list ──────────────────────────────────────────── */

.iwa-minicart-items {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.iwa-minicart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 16px 20px;
    border-bottom: 1px solid #F4F1E8;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 200ms ease;
}

/* When the X-button safeguard (confirmation OR disclaimer) is open
   on this item, lift the max-height + overflow constraints so the
   safeguard blocks render fully. JS toggles the class as the user
   clicks X / Yes / No / Dismiss. v0.3.16 fix for Frick's note that
   the inline confirm was getting clipped. */
.iwa-minicart-item.has-safeguard-open {
    max-height: none;
    overflow: visible;
}

.iwa-minicart-item:last-child {
    border-bottom: none;
}

.iwa-minicart-item-thumb img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* Brand badges sit ABOVE the product name in the info column.
   Horizontal flow with wrap, compact size. */
.iwa-minicart-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 2px;
}

.iwa-minicart-item-badges .iwa-brand-badge {
    font-size: 9px;
    padding: 2px 6px;
    line-height: 1.2;
    border-radius: 3px;
    /* Override absolute positioning from brand-badge.css — this is an
       inline-flow badge, not a corner overlay. */
    position: static;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
}

.iwa-minicart-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* SKU line on cart items — small, muted, between name and qty/price. */
.iwa-minicart-item-sku {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #6B665B;
    letter-spacing: .02em;
    line-height: 1.3;
}

.iwa-minicart-item-sku-label {
    font-weight: 600;
}

.iwa-minicart-item-sku-value {
    color: #14130F;
    font-weight: 700;
}

.iwa-minicart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #14130F;
    text-decoration: none;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

a.iwa-minicart-item-name:hover {
    color: #C8472B;
}

.iwa-minicart-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.iwa-minicart-item-qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #E8E4D8;
    border-radius: 4px;
    overflow: hidden;
}

.iwa-minicart-qty-btn {
    width: 26px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 700;
    color: #14130F;
    cursor: pointer;
    transition: background 150ms ease;
    line-height: 1;
}

.iwa-minicart-qty-btn:hover {
    background: #F4F1E8;
}

.iwa-minicart-qty-input {
    width: 36px;
    text-align: center;
    border: none;
    border-left: 1px solid #E8E4D8;
    border-right: 1px solid #E8E4D8;
    font-size: 13px;
    font-weight: 600;
    color: #14130F;
    background: #FFFFFF;
    -moz-appearance: textfield;
}

.iwa-minicart-qty-input::-webkit-outer-spin-button,
.iwa-minicart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.iwa-minicart-qty-input:focus {
    outline: none;
    background: #FAF8F2;
}

.iwa-minicart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #14130F;
    white-space: nowrap;
}

.iwa-minicart-item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #B8B2A4;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.iwa-minicart-item-remove:hover,
.iwa-minicart-item-remove:focus {
    background: #FCEEEA;
    color: #C8472B;
    border-color: #F3D1C8;
    outline: none;
}

/* ─── Footer (subtotal + buttons) ─────────────────────────── */

.iwa-minicart-footer {
    flex-shrink: 0;
    padding: 18px 20px 22px;
    border-top: 1px solid #E8E4D8;
    background: #FAF8F2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iwa-minicart-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
}

.iwa-minicart-subtotal-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6B665B;
}

.iwa-minicart-subtotal-value {
    font-size: 18px;
    font-weight: 700;
    color: #14130F;
}

.iwa-minicart-checkout-btn {
    display: block;
    padding: 14px 20px;
    background: var(--iwa-mc-checkout-bg, #14130F);
    color: var(--iwa-mc-checkout-fg, #FFFFFF);
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 180ms ease, transform 100ms ease, filter 180ms ease;
}

.iwa-minicart-checkout-btn:hover {
    background: var(--iwa-mc-checkout-hover-bg, #C8472B);
    color: var(--iwa-mc-checkout-hover-fg, #FFFFFF);
}

.iwa-minicart-checkout-btn:active {
    transform: scale(0.98);
}

/* ─── Secondary action row — [View cart | Continue shopping]
   Equal-width 50/50 when both buttons render. When only one is
   rendered (View cart toggled off, or future Continue toggle), the
   single remaining child fills the row width via flex: 1 1 0. */
.iwa-minicart-secondary-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.iwa-minicart-secondary-row > .iwa-minicart-view-cart-btn,
.iwa-minicart-secondary-row > .iwa-minicart-continue-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.iwa-minicart-continue-btn {
    padding: 11px 20px;
    background: var(--iwa-mc-continue-bg, transparent);
    color: var(--iwa-mc-continue-fg, #14130F);
    border: 1px solid var(--iwa-mc-continue-fg, #E8E4D8);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.iwa-minicart-continue-btn:hover {
    background: var(--iwa-mc-continue-hover-bg, #F4F1E8);
    color: var(--iwa-mc-continue-hover-fg, #14130F);
    border-color: var(--iwa-mc-continue-hover-bg, #F4F1E8);
}

/* ─── Body scroll lock when drawer is open ────────────────── */

body.iwa-minicart-open {
    overflow: hidden;
}

/* ─── Body-class scoped overrides ─────────────────────────────────
   These only apply when the Mini-Cart module is rendering on the
   page (body.iwa-minicart-active). They override WC defaults that:
     1. Center the add-to-cart loading spinner properly across themes
        (WC's default uses an icon-font character at top:.618em;
        right:1em which themes routinely break).
     2. Hide WC's auto-injected "View Cart" link next to shop loop
        add-to-cart buttons (drawer is the feedback now).
     3. Hide WC's "Product added to cart" success banner since the
        drawer opening is the visible feedback.
─────────────────────────────────────────────────────────────── */

/* Centered loading spinner on any add-to-cart button (shop loop +
   single product + our own buttons). Replaces WC's icon-font
   approach with a clean CSS-only ring spinner that works regardless
   of theme padding / positioning quirks. */

@keyframes iwa-mc-btn-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

body.iwa-minicart-active .woocommerce a.button.loading,
body.iwa-minicart-active a.button.ajax_add_to_cart.loading,
body.iwa-minicart-active button.single_add_to_cart_button.loading,
body.iwa-minicart-active button.loading.add_to_cart_button {
    color: transparent !important;
    position: relative !important;
    padding-right: inherit !important;  /* undo WC's loading padding-right */
    pointer-events: none;
}

body.iwa-minicart-active .woocommerce a.button.loading::after,
body.iwa-minicart-active a.button.ajax_add_to_cart.loading::after,
body.iwa-minicart-active button.single_add_to_cart_button.loading::after,
body.iwa-minicart-active button.loading.add_to_cart_button::after {
    content: '' !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    vertical-align: middle !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    width: 1em !important;
    height: 1em !important;
    border: 2px solid currentColor !important;
    border-top-color: transparent !important;
    border-radius: 50% !important;
    color: #FFFFFF !important;
    transform: translate(-50%, -50%) !important;
    box-sizing: border-box !important;
    animation: iwa-mc-btn-spin 0.65s linear infinite !important;
    margin: 0 !important;
}

/* NOTE: WC's auto-injected <a class="added_to_cart wc-forward">View cart</a>
   link IS allowed to render (gives users a visible "added" confirmation
   right next to the button they just clicked). Clicks on it are
   intercepted by mini-cart.js and open the drawer instead of navigating
   to /cart/. Previous versions (v0.3.4) hid this link, but that removed
   all visible feedback on themes that style it as the post-add state. */

/* Hide WC's "Product added to cart" success banner. Drawer slide-in
   is the visible feedback — banners create redundant noise (and stack
   if user adds multiple items rapidly). */
body.iwa-minicart-active .woocommerce-message,
body.iwa-minicart-active .wc-block-components-notice-banner.is-success {
    display: none !important;
}

/* ─── Top-of-items "Clear cart" button ───────────────────── */
.iwa-minicart-actions-top {
    display: flex;
    justify-content: flex-end;
    padding: 8px 20px 0;
    flex-shrink: 0;
}

.iwa-minicart-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 0;
    background: var(--iwa-mc-clear-bg, transparent);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--iwa-mc-clear-fg, #6B665B);
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.iwa-minicart-clear-btn:hover,
.iwa-minicart-clear-btn:focus {
    background: var(--iwa-mc-clear-hover-bg, #FCEEEA);
    color: var(--iwa-mc-clear-hover-fg, #C8472B);
    border-color: var(--iwa-mc-clear-hover-bg, #FCEEEA);
    outline: none;
}

.iwa-minicart-clear-btn svg {
    flex-shrink: 0;
}

/* ─── Footer "View cart" button (between checkout + continue) ─ */
.iwa-minicart-view-cart-btn {
    display: block;
    padding: 12px 20px;
    background: var(--iwa-mc-viewcart-bg, #FFFFFF);
    color: var(--iwa-mc-viewcart-fg, #14130F);
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-radius: 4px;
    border: 1.5px solid var(--iwa-mc-viewcart-fg, #14130F);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.iwa-minicart-view-cart-btn:hover {
    background: var(--iwa-mc-viewcart-hover-bg, #14130F);
    color: var(--iwa-mc-viewcart-hover-fg, #FFFFFF);
    border-color: var(--iwa-mc-viewcart-hover-bg, #14130F);
}

/* ─── Surcharges + Total in drawer footer ───────────────────── */
.iwa-minicart-surcharges {
    padding: 10px 20px 14px;
    border-top: 1px dashed #E5E2DA;
    background: #FAF9F6;
}

.iwa-minicart-surcharge-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    color: #4A463E;
    margin-bottom: 4px;
}

.iwa-minicart-surcharge-line .iwa-minicart-surcharge-name {
    flex: 1;
    min-width: 0;
}

.iwa-minicart-surcharge-line .iwa-minicart-surcharge-value {
    font-weight: 600;
    color: #14130F;
}

.iwa-minicart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #14130F;
    font-size: 15px;
    font-weight: 700;
    color: #14130F;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.iwa-minicart-total .iwa-minicart-total-value {
    font-size: 16px;
}

/* ─── Persistent "In cart" / "View cart" marker ─────────────────
   Server-rendered on shop loop product cards when the product is in
   the cart. REPLACES the original Add to Cart button (not appended
   — v0.3.6 appended which caused the "two buttons" duplication
   Frick reported in v0.3.7). Uses the .button class so theme button
   styles cascade for visual consistency, plus our own .iwa-loop-in-cart
   class for the gold/cream "in cart" treatment, the checkmark badge,
   and the optional quantity count badge for products with multiple
   units in cart.

   Single product page has NO server-rendered marker — the theme's
   natural "added" state on the original button + the drawer opening
   + the sticky bar's View Cart transformation provide all the
   feedback needed.
─────────────────────────────────────────────────────────────── */

body.iwa-minicart-active a.iwa-loop-in-cart {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #2E7D5B !important;
    color: #FFFFFF !important;
    border: 1.5px solid #2E7D5B !important;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    position: relative;
    /* !important is necessary because theme button selectors typically
       have higher specificity than ours: e.g.
         .woocommerce ul.products li.product .button → (0,4,1)
         body.iwa-minicart-active a.iwa-loop-in-cart → (0,2,1)
       Without !important the theme wins and we lose the green treatment.
       Color treatment matches Sticky Cart's "View Cart" state for visual
       consistency across all surfaces (sticky bar, archive cards, single
       product). */
}

body.iwa-minicart-active a.iwa-loop-in-cart::before {
    content: '';
    width: 12px;
    height: 12px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    flex-shrink: 0;
}

body.iwa-minicart-active a.iwa-loop-in-cart:hover,
body.iwa-minicart-active a.iwa-loop-in-cart:focus {
    background: #246b4d !important;
    color: #FFFFFF !important;
    border-color: #246b4d !important;
    outline: none;
    filter: none;
}

/* Optional quantity badge — only renders when count > 1. Small dark
   pill at the end of the button text. */
body.iwa-minicart-active .iwa-loop-in-cart-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 6px;
    background: #FFFFFF !important;
    color: #2E7D5B !important;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

body.iwa-minicart-active a.iwa-loop-in-cart:hover .iwa-loop-in-cart-count,
body.iwa-minicart-active a.iwa-loop-in-cart:focus .iwa-loop-in-cart-count {
    background: #FFFFFF !important;
    color: #246b4d !important;
}

/* ─── Dual-state wrappers — invisible to layout ──────────────
   display:contents makes the wrapper element itself "transparent"
   for layout — its children are positioned by the browser as if
   the wrapper wasn't there. This is critical because themes style
   the original button to be full-width (or whatever their layout
   demands) of the PRODUCT CARD COLUMN (li.product). If the wrapper
   were inline-block, the button would be sized relative to the
   wrapper instead of the column, damaging the theme's intended
   button width.

   The [hidden] override is in !important because display:contents
   would otherwise win against the UA stylesheet's [hidden] {display:none}. */
.iwa-loop-state {
    display: contents;
}
.iwa-loop-state__add,
.iwa-loop-state__view {
    display: contents;
}
.iwa-loop-state__add[hidden],
.iwa-loop-state__view[hidden] {
    display: none !important;
}

/* ─── Re-add safeguard (single product only) ────────────────── */
/* Standalone div rendered ABOVE the WC add-to-cart form (NOT a
   wrapper around the button — v0.3.6 wrapped, v0.3.7 split into a
   separate div per Frick feedback for cleaner UX). Shows the count
   of items already in cart. JS finds the .single_add_to_cart_button
   via global selector (one per single product page) and toggles its
   disabled state based on the checkbox. */

.iwa-safeguard {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 14px 0 18px;
    padding: 14px 16px;
    background: #FAF9F6;
    border: 1px solid #E5E2DA;
    border-left: 3px solid #B89E5F;
    border-radius: 6px;
}

.iwa-safeguard-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #6B5A20;
}

.iwa-safeguard-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #B89E5F;
    color: #FFFFFF;
    border-radius: 50%;
    flex-shrink: 0;
}

.iwa-safeguard-status-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}

.iwa-safeguard-status-text strong {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6B5A20;
}

.iwa-safeguard-count {
    font-size: 12px;
    font-weight: 600;
    color: #8C8273;
}

/* ─── Safeguard action links (View cart + Checkout) ──────────
   Sit between the status row and the "Add another anyway"
   checkbox. View cart opens the drawer (via the existing
   capture-phase intercept on .added_to_cart.wc-forward).
   Checkout goes directly to /checkout. */
.iwa-safeguard-actions {
    display: flex;
    gap: 10px;
    margin: 12px 0 4px;
    flex-wrap: wrap;
}

.iwa-safeguard-link {
    flex: 1 1 0;
    min-width: 120px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    box-sizing: border-box;
    cursor: pointer;
}

/* View cart — secondary (light bg, dark text, subtle border). */
.iwa-safeguard-link--cart {
    background: #FFFFFF !important;
    color: #14130F !important;
    border: 1.5px solid #D9D5CC !important;
}
.iwa-safeguard-link--cart:hover,
.iwa-safeguard-link--cart:focus {
    background: #F4F1EB !important;
    color: #14130F !important;
    border-color: #14130F !important;
    outline: none;
}

/* Checkout — primary CTA. Same green as the View Cart markers
   so all "in-cart" UI shares the same color language. */
.iwa-safeguard-link--checkout {
    background: #2E7D5B !important;
    color: #FFFFFF !important;
    border: 1.5px solid #2E7D5B !important;
}
.iwa-safeguard-link--checkout:hover,
.iwa-safeguard-link--checkout:focus {
    background: #246b4d !important;
    color: #FFFFFF !important;
    border-color: #246b4d !important;
    outline: none;
    filter: none;
}

@media (max-width: 480px) {
    .iwa-safeguard-actions {
        flex-direction: column;
    }
    .iwa-safeguard-link {
        width: 100%;
    }
}

.iwa-safeguard-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #4A463E;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

.iwa-safeguard-checkbox input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.iwa-safeguard-checkbox span {
    line-height: 1.4;
}

/* When safeguard is NOT armed, the global .single_add_to_cart_button
   gets visually disabled via JS .disabled class + native disabled attr.
   We style here as a belt-and-suspenders fallback in case some theme
   doesn't style :disabled. */
.single_add_to_cart_button.disabled,
.single_add_to_cart_button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Single product "View cart" button ──────────────────────
   Server-rendered by render_view_cart_button() inside the
   .iwa-single-state__view dual-state container. Color treatment
   matches sticky-cart's --iwa-success (#2E7D5B) green for visual
   consistency across all surfaces: sticky bar, archive cards,
   single product page. The .single_add_to_cart_button class was
   DROPPED in v0.3.9 (was being applied to our <a> link, which
   may have caused theme JS that binds to that class to error
   when treating our link as a form submit button — likely the
   root cause of the brand-nav disappearance Frick reported). */

body.iwa-minicart-active a.iwa-single-in-cart {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #2E7D5B !important;
    color: #FFFFFF !important;
    border: 1.5px solid #2E7D5B !important;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    position: relative;
}

body.iwa-minicart-active a.iwa-single-in-cart::before {
    content: '';
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    flex-shrink: 0;
}

body.iwa-minicart-active a.iwa-single-in-cart:hover,
body.iwa-minicart-active a.iwa-single-in-cart:focus {
    background: #246b4d !important;
    color: #FFFFFF !important;
    border-color: #246b4d !important;
    outline: none;
    filter: none;
}

body.iwa-minicart-active .iwa-single-in-cart-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    margin-left: 4px;
    background: #FFFFFF !important;
    color: #2E7D5B !important;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

body.iwa-minicart-active a.iwa-single-in-cart:hover .iwa-single-in-cart-count,
body.iwa-minicart-active a.iwa-single-in-cart:focus .iwa-single-in-cart-count {
    background: #FFFFFF !important;
    color: #246b4d !important;
}

/* Single product dual-state wrapper. Block so children stack
   vertically (safeguard above, view/form below). The view/add
   children are inline-block by default but flex when visible — let
   them respect their natural layout. */
.iwa-single-state {
    display: block;
}
.iwa-single-state__view,
.iwa-single-state__add {
    display: block;
}
.iwa-single-state__view[hidden],
.iwa-single-state__add[hidden] {
    display: none !important;
}

/* When BOTH view + add are visible (safeguard ON + product in cart),
   give them a little vertical breathing room. */
.iwa-single-state__view:not([hidden]) + .iwa-single-state__add:not([hidden]) {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #E5E2DA;
}

/* Hide our suppress placeholder (invisible <span> we inject before
   firing added_to_cart so WC's wc-add-to-cart.js skips its own
   View cart link injection). */
.iwa-suppress-wc-inject {
    display: none !important;
}

/* ─── v0.3.15 — X-button safeguard: confirmation + disclaimer ───
   Both blocks are pre-rendered hidden inside each cart item.
   The confirmation appears when the X button is clicked on a line
   with qty > 1; it asks the customer to confirm removing the entire
   line. The disclaimer surfaces if the customer picks "No, keep" —
   one-time onboarding hint about using -/+ for incremental removal.
   Dismissible via the X on the disclaimer itself (localStorage
   persists the dismissal). */

.iwa-minicart-item-confirm {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 12px 14px;
    background: #FBEEEA;
    border: 1px solid #E8C8BD;
    border-left: 3px solid #C8472B;
    border-radius: 6px;
    animation: iwa-mc-confirm-slide 200ms ease-out;
}

@keyframes iwa-mc-confirm-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.iwa-minicart-item-confirm[hidden] {
    display: none !important;
}

.iwa-minicart-item-confirm-text {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #14130F;
}

.iwa-minicart-item-confirm-text strong {
    font-weight: 700;
    color: #C8472B;
}

.iwa-minicart-item-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.iwa-minicart-item-confirm-btn {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-radius: 4px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    border: 1.5px solid transparent;
    line-height: 1;
}

.iwa-minicart-item-confirm-btn--no {
    background: #FFFFFF;
    color: #14130F;
    border-color: #D9D5CC;
}
.iwa-minicart-item-confirm-btn--no:hover,
.iwa-minicart-item-confirm-btn--no:focus {
    background: #F4F1EB;
    border-color: #14130F;
    outline: none;
}

.iwa-minicart-item-confirm-btn--yes {
    background: #C8472B;
    color: #FFFFFF;
    border-color: #C8472B;
}
.iwa-minicart-item-confirm-btn--yes:hover,
.iwa-minicart-item-confirm-btn--yes:focus {
    background: #A93A23;
    border-color: #A93A23;
    outline: none;
}

/* Dismissible disclaimer */
.iwa-minicart-item-disclaimer {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding: 10px 12px;
    background: #FAF9F6;
    border: 1px solid #E5E2DA;
    border-left: 3px solid #8C8273;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: iwa-mc-confirm-slide 200ms ease-out;
}

.iwa-minicart-item-disclaimer[hidden] {
    display: none !important;
}

.iwa-minicart-item-disclaimer-icon {
    flex-shrink: 0;
    color: #8C8273;
    line-height: 0;
    margin-top: 1px;
}

.iwa-minicart-item-disclaimer-text {
    flex: 1 1 auto;
    font-size: 12px;
    line-height: 1.45;
    color: #4A463E;
}

.iwa-minicart-item-disclaimer-dismiss {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: 0;
    color: #8C8273;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, color 150ms ease;
}

.iwa-minicart-item-disclaimer-dismiss:hover,
.iwa-minicart-item-disclaimer-dismiss:focus {
    background: #ECE8DE;
    color: #14130F;
    outline: none;
}
