/* WooCommerce Campaign Manager — cart & checkout surfaces
 *
 * v4 (2.23.13): L126 -- the cart line price rules are scoped to the cart form (.woocommerce-cart-form). The mini-cart
 * prints the same .wc-campaign-price markup (Engine::render_mini_cart_campaign_price()), and this file also loads on the
 * cart and checkout pages, so on those two pages the header mini-cart turned into a column that looked different from
 * the same mini-cart on every other page.
 *
 * v3 (2.23.7): U34 -- the checkout sync notice's text is --twm-cm-text-red and its retry button
 * --twm-cm-fill-red (both from twm-cm-tokens_v2.css, a dependency of this stylesheet's handle); the bright
 * system red was 3.1 and 3.6:1. L41 -- the dead rule .wc-campaign-offers__amount is gone (nothing prints
 * that class). .wc-campaign-price--split has no rule either, and stays on the markup: a theme may target it.
 *
 * v2 (2.15.1). Three surfaces that previously emitted no plugin classes at all and inherited
 * Flatsome styling wholesale:
 *
 *   .wc-campaign-price        — the discounted cart line price
 *   .wc-campaign-offers       — U11, the guest offers card
 *   .wc-campaign-field-notice — U9, inline sync errors with a retry
 *
 * Cart + checkout only. It cannot ride on bxgy-progress_v11.css, which loads only for an
 * active BXGY campaign, while the discounted-price filter runs for any fixed_product one.
 *
 * Everything is scoped inside a plugin-owned class — no bare-element selectors.
 */

/* Light-only by design (see twm-cm-tokens_v2.css). The --wc-ios-* and --twm-cm-* tokens this file reads are in
 * assets/css/twm-cm-tokens_v2.css, the stylesheet `twm-cm-tokens`, which this stylesheet depends on (L40, 2.23.7). */

/* ========================================
   Cart line price
   ======================================== */

.woocommerce-cart-form .wc-campaign-price {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.woocommerce-cart-form .wc-campaign-price__original {
    font-size: var(--wc-ios-t-footnote);
    color: var(--wc-ios-ink-2);
    text-decoration: line-through;
}

.woocommerce-cart-form .wc-campaign-price__current {
    font-weight: 600;
    color: var(--wc-ios-ink);
}

/* The split "N units at the discounted price, M at the original" breakdown. */
.woocommerce-cart-form .wc-campaign-price__breakdown {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.woocommerce-cart-form .wc-campaign-price__row {
    white-space: nowrap;
}

.woocommerce-cart-form .wc-campaign-price__row--original {
    font-size: var(--wc-ios-t-footnote);
    color: var(--wc-ios-ink-2);
}

/* ========================================
   U11 — guest offers card
   Replaces two wc_print_notice() calls that put promotional copy in the same
   channel as validation errors.
   ======================================== */

.wc-campaign-offers {
    background: var(--wc-ios-bg);
    border: 1px solid var(--wc-ios-hairline);
    border-inline-start: 4px solid var(--wc-ios-blue);
    border-radius: var(--wc-ios-r-lg);
    box-shadow: var(--wc-ios-shadow-card);
    padding: 18px 20px;
    margin: 0 0 20px;
    color: var(--wc-ios-ink);
    font-family: var(--wc-ios-font);
    box-sizing: border-box;
}

.wc-campaign-offers__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: var(--wc-ios-t-headline);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--wc-ios-ink);
}

.wc-campaign-offers__title::before {
    content: "\2726"; /* four-pointed star */
    color: var(--wc-ios-blue);
    font-size: 0.95em;
}

.wc-campaign-offers__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wc-campaign-offers__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-size: var(--wc-ios-t-subhead);
    line-height: 1.45;
    color: var(--wc-ios-ink-2);
}

.wc-campaign-offers__item::before {
    content: "";
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-top: 0.55em;
    border-radius: 50%;
    background: var(--wc-ios-blue);
}

/* ========================================
   U9 — inline field notice with retry
   ======================================== */

.wc-campaign-field-notice {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 0;
    padding: 10px 14px;
    background: rgba(255, 59, 48, 0.10);
    border-radius: var(--wc-ios-r-sm);
    font-family: var(--wc-ios-font);
    font-size: var(--wc-ios-t-footnote);
    line-height: 1.4;
    color: var(--twm-cm-text-red);
    box-sizing: border-box;
}

.wc-campaign-field-notice__text {
    flex: 1 1 auto;
    min-width: 0;
}

.wc-campaign-field-notice__retry {
    flex-shrink: 0;
    min-height: 32px;
    margin: 0;
    padding: 0 14px;
    border: none;
    border-radius: var(--wc-ios-r-pill);
    background: var(--twm-cm-fill-red);
    color: #ffffff;
    font-size: var(--wc-ios-t-caption);
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: opacity var(--wc-ios-dur-fast) var(--wc-ios-ease-std),
                transform var(--wc-ios-dur-fast) var(--wc-ios-ease-std);
}

.wc-campaign-field-notice__retry:hover {
    opacity: 0.9;
    color: #ffffff;
}

.wc-campaign-field-notice__retry:active {
    transform: scale(0.96);
}

.wc-campaign-field-notice__retry:focus-visible {
    outline: 3px solid var(--wc-ios-blue);
    outline-offset: 2px;
}

/* ========================================
   U9 — payment-method pending state
   The debounce is short now, but the interim still gets an attributable cue.
   ======================================== */

.wc-campaign-pending {
    position: relative;
}

.wc-campaign-pending::after {
    content: "";
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--wc-ios-ink-2);
    border-top-color: transparent;
    border-radius: 50%;
    animation: wcCampaignPendingSpin 0.7s linear infinite;
    pointer-events: none;
}

@keyframes wcCampaignPendingSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .wc-campaign-offers {
        border-radius: var(--wc-ios-r-md);
        padding: 16px;
    }

    .wc-campaign-offers__title {
        font-size: var(--wc-ios-t-callout);
    }

    .wc-campaign-offers__item {
        font-size: var(--wc-ios-t-footnote);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wc-campaign-pending::after {
        animation: none;
    }

    .wc-campaign-field-notice__retry {
        transition: none;
    }
}

/* ========================================
   Cart box: the offer inside Social Account's buttons (cart page)
   ======================================== */

.twm-cm-cart-signup__text {
    margin: 0 0 12px;
    padding: 0;
    background: var(--wc-ios-bg, #ffffff);
    color: var(--wc-ios-ink, #1d1d1f);
    font-size: 0.95em;
    line-height: 1.45;
    text-align: center;
}

.twm-cm-cart-signup__email-line {
    margin: 12px 0 0;
    padding: 0;
    background: var(--wc-ios-bg, #ffffff);
    color: var(--wc-ios-ink, #1d1d1f);
    text-align: center;
}

.twm-cm-cart-signup__email {
    background: var(--wc-ios-bg, #ffffff);
    color: var(--twm-cm-text-blue, #0055b3);
    font-weight: 600;
    text-decoration: underline;
}

.twm-cm-cart-signup__email:hover,
.twm-cm-cart-signup__email:focus {
    color: var(--twm-cm-text-blue, #0055b3);
    text-decoration: none;
}
