/* ═══════════════════════════════════════════
   SP-CHECKOUT-UX — Runtime-Only Styles
   Design system tokens are in sp-commerce.css.
   This file only contains JS-runtime states:
   - Loader / skeleton
   - Toggle buttons
   - Scope guards
   - Reduced motion
   ═══════════════════════════════════════════ */


/* ─── Scope guards ─── */
body.spcux-scope .spcux-critical-checkout { margin-top: 16px; }
body.spcux-scope .spcux-critical-checkout > * + * { margin-top: 14px; }
body.spcux-scope .spcux-dupe-hide { display: none !important; }

/* ─── Loader (minimal + non-blocking) ─── */
.spcux-loader {
    position: fixed; inset: 0;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: calc(18vh + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.35);
    z-index: 99999; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
    min-height: 100vh; height: 100dvh;
}
.spcux-loader-inner {
    text-align: center;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--sp-line, rgba(17,17,17,.1));
    border-radius: 16px; padding: 10px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.spcux-loader-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--sp-ink, #111); margin: 0 auto 8px;
    animation: spcuxPulse 1.2s infinite ease-in-out;
}
.spcux-loader-text {
    font-size: 13px; font-weight: 600;
    color: var(--sp-ink, #111);
}
body.spcux-loading .spcux-loader { opacity: 1; }

@keyframes spcuxPulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    50%  { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1);   opacity: 0.6; }
}

/* ─── Skeleton shimmer ─── */
.spcux-skeleton-target { position: relative; }
body.spcux-loading .spcux-skeleton-target::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
    background-size: 200% 100%;
    animation: spcuxShimmer 1.2s linear infinite;
    pointer-events: none;
}
@keyframes spcuxShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Toggle ─── */
.spcux-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 700; cursor: pointer;
    padding: 10px 12px;
    border: 1px solid var(--sp-line, rgba(17,17,17,.1));
    border-radius: 10px; background: #fff;
}
.spcux-toggle-btn:focus-visible {
    outline: 2px solid var(--sp-burgundy, #7a3b47);
    outline-offset: 2px;
}

/* ─── BONUS badge ─── */
.spcux-bonus-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(0,0,0,.06); color: rgba(0,0,0,.75);
    font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
    margin-right: 8px;
}
.spcux-bonus-note { margin-top: 6px; font-size: 13px; color: var(--sp-ink-soft, rgba(17,17,17,.6)); }

/* ─── Coupon component (runtime) ─── */
.spcux-coupon {
    margin: 10px 0; padding: 10px 12px;
    border: 1px dashed rgba(0,0,0,.14); border-radius: 12px; background: #fff;
}
.spcux-coupon input { width: 100%; max-width: 260px; }
.spcux-coupon .spcux-coupon-msg { margin-top: 6px; font-size: 13px; }

/* ─── Word-break safety ─── */
body.spcux-scope .woocommerce-checkout-review-order-table .product-name,
body.spcux-scope .woocommerce-checkout-review-order-table .product-total,
body.spcux-scope .payment_methods label,
body.spcux-scope .woocommerce-NoticeGroup,
body.spcux-scope .woocommerce-error,
body.spcux-scope .woocommerce-message {
    overflow-wrap: anywhere;
    word-break: break-word;
}
#installment-mini-total {
    max-width: 100%;
    overflow-wrap: anywhere;
    min-height: 44px;
}

/* ─── Hidden helper ─── */
.spcux-hidden { display: none !important; }

/* ─── Touch optimization ─── */
.spcux-sticky-btn,
.spcux-toggle-btn {
    touch-action: manipulation;
}

/* ─── Hide empty variation artifacts ─── */
.woocommerce-checkout-review-order-table dt.variation-,
.woocommerce-checkout-review-order-table dd.variation- {
    display: none !important;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    .spcux-toggle-btn,
    .spcux-sticky-bar,
    .spcux-sticky-btn,
    .spcux-loader-dot,
    .spcux-skeleton-target::after {
        transition: none !important;
        animation: none !important;
    }
}
