/*
 * Promo checkpoints bar: segmented track + numbered nodes.
 *
 * Uses its own class names on purpose: frequently-bought-together.js replaces
 * every .rbb-free-ship-goal with the free shipping bar after a bundle add.
 */
.bs-promo-cp {
    /* same green as .mini-cart-sale-banner */
    --bs-promo-cp-green: #009669;
    --bs-promo-cp-track: #e6ebe9;
    --bs-promo-cp-muted: #d1d5db;
    --bs-promo-cp-node: 28px;
    width: 100%;
    background-color: #fff;
    padding: 18px 20px 20px;
    border-bottom: 1px solid #eee;
}

/* "Add $18.50 more to unlock 10% off" / "All rewards unlocked — nice." */
.bs-promo-cp-text {
    margin-bottom: 14px;
    font-size: 15px;
    line-height: 1.35;
    text-align: center;
    color: #222;
}
.bs-promo-cp-text b,
.bs-promo-cp-text strong {
    font-weight: 700;
    color: var(--bs-promo-cp-green);
}

/* Steps: [segment][node] per checkpoint, with its label on a second row underneath */
.bs-promo-cp-steps {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.bs-promo-cp-step {
    display: flex;
    flex: 1 1 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 4px;
    min-width: 0;
    margin: 0;
}

.bs-promo-cp-segment {
    position: relative;
    flex: 1 1 auto;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background-color: var(--bs-promo-cp-track);
}
.bs-promo-cp-segment-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background-color: var(--bs-promo-cp-green);
    /* js/scripts.js turns the rendered width into full width + translateX and
       animates that; the duration matches its SEGMENT_MS */
    transition: transform .45s ease;
}

.bs-promo-cp-node {
    position: relative;
    display: flex;
    flex: 0 0 var(--bs-promo-cp-node);
    justify-content: center;
    align-items: center;
    width: var(--bs-promo-cp-node);
    height: var(--bs-promo-cp-node);
    border: 2px solid var(--bs-promo-cp-muted);
    border-radius: 50%;
    background-color: #fff;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: background-color .3s, border-color .3s, color .3s;
}
.bs-promo-cp-step.is-next .bs-promo-cp-node {
    border-color: var(--bs-promo-cp-green);
    color: var(--bs-promo-cp-green);
}
.bs-promo-cp-step.is-reached .bs-promo-cp-node {
    border-color: var(--bs-promo-cp-green);
    background-color: var(--bs-promo-cp-green);
    color: #fff;
}

/* Number ⇄ check: both sit in the middle of the node; the number shrinks away
   as the check spins in (with a little overshoot), and back when un-reached. */
.bs-promo-cp-num,
.bs-promo-cp-check {
    position: absolute;
    top: 50%;
    left: 50%;
    line-height: 1;
    transition: opacity .25s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.bs-promo-cp-num {
    transform: translate(-50%, -50%) scale(1);
}
.bs-promo-cp-check {
    font-size: 10px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.3) rotate(-90deg);
}
.bs-promo-cp-step.is-reached .bs-promo-cp-num {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.3);
}
.bs-promo-cp-step.is-reached .bs-promo-cp-check {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
    /* let the node turn green first */
    transition-delay: .08s;
}

/* Ring pulse when a node is reached during an animation (class added by
   js/scripts.js only, so re-rendered bars don't pulse every reached node on each
   cart change). A ring rather than scaling the node, which would also scale the
   label inside it. */
.bs-promo-cp-step.bs-promo-cp-pop .bs-promo-cp-node {
    animation: bs-promo-cp-pop .6s ease-out;
}
@keyframes bs-promo-cp-pop {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 150, 105, .45);
    }
    100% {
        box-shadow: 0 0 0 9px rgba(0, 150, 105, 0);
    }
}

/* js/scripts.js: snapping a freshly rendered bar back to the previous state */
.bs-promo-cp-instant .bs-promo-cp-node,
.bs-promo-cp-instant .bs-promo-cp-num,
.bs-promo-cp-instant .bs-promo-cp-check,
.bs-promo-cp-instant .bs-promo-cp-reward {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .bs-promo-cp-num,
    .bs-promo-cp-check {
        transition: none;
    }
    .bs-promo-cp-step.bs-promo-cp-pop .bs-promo-cp-node {
        animation: none;
    }
}

/* Labels: a full-width row inside their own step, right-aligned under the node.
   They wrap instead of spilling into the neighbouring steps. */
.bs-promo-cp-label {
    flex: 0 0 100%;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.3;
    text-align: right;
    overflow-wrap: anywhere;
}
.bs-promo-cp-reward {
    transition: color .3s;
    color: #909090;
    margin-left: 2px;
}
.bs-promo-cp-step.is-next .bs-promo-cp-reward {
    color: #222;
}
.bs-promo-cp-step.is-reached .bs-promo-cp-reward {
    font-weight: 700;
    color: var(--bs-promo-cp-green);
}
