/* ============================================
   ANIMATED CART WIDGET
   Shopping trolley slides in → headphones drop → "Add to Basket" appears
   Positioned in the empty space beside the rating rows
   ============================================ */

/* Flex zone: ratings on left, cart animation on right */
.rating-cart-zone {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin-bottom: 2px;
}
.rating-cart-zone .rating-col {
    flex: 1;
    min-width: 0;
}

/* Widget container */
.cart-anim-widget {
    width: 100px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border-radius: 10px;
    transition: background 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    margin-left: -10px;
}
.cart-anim-widget:active {
    background: rgba(255, 255, 255, 0.06);
}

/* The scene contains the cart */
.cart-anim-scene {
    position: relative;
    width: 80px;
    height: 64px;
}

/* ── SHOPPING TROLLEY ── single looping animation: slide in → bounce → stay → slide out → pause → repeat */
.cart-anim-trolley {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(80px);
    opacity: 0;
    animation: trolleyLoop 7s ease 0.15s infinite;
}

/*  0-9%   = slide in from right  (0.63s)
    9-13%  = bounce squish         (0.28s)
   13-50%  = hold visible          (~2.6s)
   50-60%  = slide out left        (0.7s)
   60-100% = offscreen pause       (~2.8s) then restart */
@keyframes trolleyLoop {
    0%   { transform: translateX(80px); opacity: 0; }
    5%   { opacity: 1; }
    9%   { transform: translateX(-50%); opacity: 1; }
    10%  { transform: translateX(-50%) scaleY(0.92); }
    12%  { transform: translateX(-50%) scaleY(1.04); }
    13%  { transform: translateX(-50%) scaleY(1); }
    50%  { transform: translateX(-50%); opacity: 1; }
    55%  { opacity: 0.6; }
    60%  { transform: translateX(-140px); opacity: 0; }
    100% { transform: translateX(80px); opacity: 0; }
}

/* ── "ADD TO BASKET" LABEL ── fades up after first trolley arrival */
.cart-anim-label {
    font-family: 'Anton SC', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    margin-top: 3px;
    transform: translateY(6px);
    animation: labelSlideUp 0.4s ease 0.7s forwards;
}
@keyframes labelSlideUp {
    0%   { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── "Click Here" sub-label ── */
.cart-anim-sub {
    font-family: 'Anton SC', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    opacity: 0;
    animation: labelSlideUp 0.3s ease 0.95s forwards;
}

/* ── ADDED-TO-CART FEEDBACK ── */
.cart-anim-widget.added .cart-anim-label,
.cart-anim-widget.added .cart-anim-sub {
    color: #4ade80;
}

/* Already-in-cart state */
.cart-anim-widget.in-cart .cart-anim-label,
.cart-anim-widget.in-cart .cart-anim-sub {
    color: #4ade80;
}

/* ── CART TOAST ── */
.cart-anim-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    width: min(320px, calc(100vw - 28px));
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(18, 18, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translate(-50%, -18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 2147483647;
}

.cart-anim-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.cart-anim-toast-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: #f5f5f5;
    margin-bottom: 4px;
}

.cart-anim-toast-copy {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
}

/* ── ACCESSIBILITY: Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .cart-anim-trolley,
    .cart-anim-label,
    .cart-anim-sub {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
    .cart-anim-scene {
        animation: none !important;
    }
    .cart-anim-toast {
        transition: none !important;
    }
}
