/* WooCommerce Campaign Manager — BXGY Progress Cards
 * Rendered above the cart and checkout body via woocommerce_before_cart /
 * woocommerce_before_checkout_form. Visual language matches campaign-banner_v2.css.
 *
 * v2: adds the multi-campaign stack header, the compact "applied" confirmation
 * card (data-state="applied"), and per-state accent colours.
 */

.wc-bxgy-progress-stack {
    --wc-bxgy-fill: #2ea043;
    --wc-bxgy-fill-soft: rgba(46, 160, 67, 0.12);
    --wc-bxgy-card-bg: #ffffff;
    --wc-bxgy-border: rgba(15, 23, 42, 0.08);
    --wc-bxgy-text: #1c2d40;
    --wc-bxgy-muted: rgba(28, 45, 64, 0.68);
    --wc-bxgy-track: rgba(15, 23, 42, 0.08);
    --wc-bxgy-radius: 18px;
    --wc-bxgy-pad: 20px;

    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

/* Stack header — only rendered when 2+ cards are present. */
.wc-bxgy-progress-stack__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

.wc-bxgy-progress-stack__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--wc-bxgy-text);
}

.wc-bxgy-progress-stack__count {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--wc-bxgy-muted);
    font-variant-numeric: tabular-nums;
}

.wc-bxgy-progress {
    position: relative;
    background: var(--wc-bxgy-card-bg);
    border-radius: var(--wc-bxgy-radius);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--wc-bxgy-border);
    border-inline-start: 4px solid var(--wc-bxgy-fill);
    padding: var(--wc-bxgy-pad);
    color: var(--wc-bxgy-text);
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(8px);
    animation: wcBxgyProgressIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* nth-of-type (not nth-child) so the stack header <div> doesn't shift the
 * stagger sequence — these count only the <article> cards. */
.wc-bxgy-progress:nth-of-type(2) { animation-delay: 0.06s; }
.wc-bxgy-progress:nth-of-type(3) { animation-delay: 0.12s; }
.wc-bxgy-progress:nth-of-type(4) { animation-delay: 0.18s; }
.wc-bxgy-progress:nth-of-type(5) { animation-delay: 0.24s; }
.wc-bxgy-progress:nth-of-type(6) { animation-delay: 0.30s; }

@keyframes wcBxgyProgressIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Per-state accent colours. target_partial and applied keep the brand green. */
.wc-bxgy-progress[data-state="spend_more"] {
    --wc-bxgy-fill: #2f6feb;
    --wc-bxgy-fill-soft: rgba(47, 111, 235, 0.12);
}

.wc-bxgy-progress[data-state="target_empty"] {
    --wc-bxgy-fill: #d98e04;
    --wc-bxgy-fill-soft: rgba(217, 142, 4, 0.12);
}

.wc-bxgy-progress__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.wc-bxgy-progress__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--wc-bxgy-text);
}

.wc-bxgy-progress__pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--wc-bxgy-fill-soft);
    color: var(--wc-bxgy-fill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.wc-bxgy-progress__pill::before {
    content: "\2713"; /* checkmark */
    font-weight: 700;
    font-size: 0.8em;
}

.wc-bxgy-progress__message {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--wc-bxgy-muted);
}

.wc-bxgy-progress__meter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.wc-bxgy-progress__bar {
    flex: 1;
    position: relative;
    height: 8px;
    background: var(--wc-bxgy-track);
    border-radius: 999px;
    overflow: hidden;
}

.wc-bxgy-progress__fill {
    display: block;
    height: 100%;
    background: var(--wc-bxgy-fill);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.wc-bxgy-progress__label {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wc-bxgy-text);
    min-width: 80px;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.wc-bxgy-progress__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 18px;
    background: var(--wc-bxgy-fill);
    color: #ffffff;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    text-align: center;
    border: 0;
    box-sizing: border-box;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    /* Neutral shadow so the glow doesn't clash with per-state accents. */
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.wc-bxgy-progress__cta:hover,
.wc-bxgy-progress__cta:focus {
    color: #ffffff;
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
    text-decoration: none;
}

.wc-bxgy-progress__cta:focus-visible {
    outline: 3px solid var(--wc-bxgy-fill);
    outline-offset: 2px;
}

.wc-bxgy-progress__cta::after {
    content: "\2192"; /* right arrow */
    font-weight: 700;
}

[dir="rtl"] .wc-bxgy-progress__cta::after {
    content: "\2190"; /* left arrow */
}

/* Compact "applied" card — single confirmation row, no meter/CTA/pill. */
.wc-bxgy-progress--applied {
    background: var(--wc-bxgy-fill-soft);
    box-shadow: none;
    border-inline-start-color: var(--wc-bxgy-fill);
}

.wc-bxgy-progress--compact {
    padding: 12px 16px;
}

.wc-bxgy-progress__applied-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.4;
    color: var(--wc-bxgy-text);
}

.wc-bxgy-progress__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--wc-bxgy-fill);
    color: #ffffff;
}

.wc-bxgy-progress__check::before {
    content: "\2713"; /* checkmark, matches the pill glyph */
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.wc-bxgy-progress__applied-title {
    font-weight: 600;
}

.wc-bxgy-progress__applied-msg {
    color: var(--wc-bxgy-muted);
}

@media (max-width: 600px) {
    .wc-bxgy-progress {
        --wc-bxgy-radius: 12px;
        --wc-bxgy-pad: 16px;
    }

    .wc-bxgy-progress-stack__title {
        font-size: 1rem;
    }

    .wc-bxgy-progress__title {
        font-size: 0.95rem;
    }

    .wc-bxgy-progress__message {
        font-size: 0.9rem;
    }

    .wc-bxgy-progress__label {
        min-width: 70px;
        font-size: 0.8rem;
    }

    .wc-bxgy-progress__applied-line {
        font-size: 0.88rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wc-bxgy-progress {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .wc-bxgy-progress__fill,
    .wc-bxgy-progress__cta {
        transition: none;
    }
}
