/* Redwave — add-to-cart feedback (button + header cart icon + fly-to-cart) */

:root {
    --rw-atc-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --rw-atc-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --rw-atc-accent: #ff4545;
    --rw-atc-accent-glow: rgba(255, 69, 69, 0.55);
}

/* Product card / listing cart button */
.rw-card-cart-btn.is-atc-loading {
    pointer-events: none;
    opacity: 0.82;
}

.rw-card-cart-btn.is-atc-loading .rw-card-cart-btn__icon {
    animation: rw-atc-spin 0.75s linear infinite;
}

.rw-card-cart-btn.is-atc-success {
    border-color: rgba(76, 217, 100, 0.85) !important;
    background: rgba(76, 217, 100, 0.14) !important;
    color: #6ee78a !important;
    animation: rw-atc-pop 0.45s var(--rw-atc-spring);
}

.rw-card-cart-btn.is-atc-success .rw-card-cart-btn__icon,
.rw-card-cart-btn.is-atc-success .rw-card-cart-btn__icon i,
.rw-card-cart-btn.is-atc-success .rw-card-cart-btn__label {
    color: #6ee78a !important;
}

.rw-card-cart-btn.is-atc-success.is-added {
    border-color: rgba(255, 69, 69, 0.75) !important;
    background: rgba(255, 69, 69, 0.14) !important;
    color: #ff6b6b !important;
}

.rw-card-cart-btn.is-atc-success.is-added .rw-card-cart-btn__icon,
.rw-card-cart-btn.is-atc-success.is-added .rw-card-cart-btn__icon i,
.rw-card-cart-btn.is-atc-success.is-added .rw-card-cart-btn__label {
    color: #ff6b6b !important;
}

/* Modal / offcanvas / PDP buttons */
.add-to-cart.adding,
.buy-now.adding,
.rw-pd-mobile-atc-btn.adding {
    pointer-events: none;
    opacity: 0.78;
}

.add-to-cart.added-success,
.buy-now.added-success,
.rw-pd-mobile-atc-btn.added-success {
    background-color: rgba(76, 217, 100, 0.18) !important;
    border-color: rgba(76, 217, 100, 0.75) !important;
    color: #6ee78a !important;
    animation: rw-atc-pop 0.45s var(--rw-atc-spring);
}

/* Source flash — where the item came from */
.redwave-product-media.rw-fly-source-flash,
.product-card-image-link.rw-fly-source-flash {
    box-shadow:
        0 0 0 3px rgba(255, 69, 69, 0.85),
        0 0 28px rgba(255, 69, 69, 0.45) !important;
    transition: box-shadow 0.35s var(--rw-atc-ease);
}

/* Fly-to-cart shell (moves as one unit) */
.rw-fly-to-cart-shell {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10060;
    pointer-events: none;
    will-change: transform, opacity;
    transform-origin: center center;
}

.rw-fly-to-cart__glow {
    position: absolute;
    inset: -14px;
    border-radius: 18px;
    background: radial-gradient(circle, var(--rw-atc-accent-glow) 0%, transparent 72%);
    opacity: 0.85;
    animation: rw-fly-glow-pulse 0.55s ease-in-out infinite alternate;
}

.rw-fly-to-cart {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.55),
        0 0 0 3px rgba(255, 69, 69, 0.75),
        0 0 32px rgba(255, 69, 69, 0.42);
    background: #111;
}

.rw-fly-to-cart img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rw-fly-to-cart--dot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
}

.rw-fly-to-cart--dot i {
    font-size: 1.65rem;
    color: var(--rw-atc-accent);
}

/* Landing ring on cart icon */
.rw-cart-landing-ring {
    position: fixed;
    z-index: 10059;
    width: 56px;
    height: 56px;
    margin-left: -28px;
    margin-top: -28px;
    border-radius: 50%;
    border: 3px solid var(--rw-atc-accent);
    box-shadow: 0 0 24px var(--rw-atc-accent-glow);
    opacity: 0;
    transform: scale(0.35);
    pointer-events: none;
}

.rw-cart-landing-ring.is-active {
    animation: rw-cart-landing-pop 0.65s var(--rw-atc-ease) forwards;
}

/* Header cart icon bump + landing glow */
.nav-cart-box.is-cart-bump,
.header3-mobile-cart-link.is-cart-bump,
.header3-mobile-cart-icon.is-cart-bump {
    animation: rw-cart-bump 0.65s var(--rw-atc-spring);
}

.nav-cart-box.is-cart-landing,
.header3-mobile-cart-link.is-cart-landing,
.header3-mobile-cart-icon.is-cart-landing {
    filter: drop-shadow(0 0 12px var(--rw-atc-accent-glow));
}

.nav-cart-box.is-cart-bump .cart-count,
.nav-cart-box.is-cart-bump .cart-count-mobile-badge,
.header3-mobile-cart-link.is-cart-bump .cart-count-mobile-badge {
    animation: rw-cart-badge-pop 0.65s var(--rw-atc-spring);
}

@keyframes rw-fly-glow-pulse {
    from {
        opacity: 0.55;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1.04);
    }
}

@keyframes rw-cart-landing-pop {
    0% {
        opacity: 0.95;
        transform: scale(0.35);
    }
    70% {
        opacity: 0.55;
        transform: scale(1.35);
    }
    100% {
        opacity: 0;
        transform: scale(1.65);
    }
}

@keyframes rw-atc-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rw-atc-pop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes rw-cart-bump {
    0%,
    100% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.2);
    }
    65% {
        transform: scale(0.94);
    }
}

@keyframes rw-cart-badge-pop {
    0%,
    100% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.45);
    }
}

@media (prefers-reduced-motion: reduce) {
    .rw-card-cart-btn.is-atc-loading .rw-card-cart-btn__icon,
    .rw-card-cart-btn.is-atc-success,
    .add-to-cart.added-success,
    .buy-now.added-success,
    .rw-pd-mobile-atc-btn.added-success,
    .nav-cart-box.is-cart-bump,
    .nav-cart-box.is-cart-bump .cart-count,
    .nav-cart-box.is-cart-bump .cart-count-mobile-badge,
    .rw-fly-to-cart__glow,
    .rw-cart-landing-ring.is-active {
        animation: none !important;
    }

    .redwave-product-media.rw-fly-source-flash,
    .product-card-image-link.rw-fly-source-flash {
        box-shadow: none !important;
    }

    .rw-card-cart-btn.is-atc-loading .rw-card-cart-btn__icon {
        opacity: 0.55;
    }
}
