/* ====================================================
   ✅ پس‌زمینه صفحه سبد خرید
   ==================================================== */

body.cart-page {
    background-image: linear-gradient(rgba(3, 17, 0, 0.85), rgba(3, 48, 0, 0.65)),
                      url('../images/backgrand-images/cart.jpg');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

@media (min-width: 920px) {
    body.cart-page {
        background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
                          url('../images/backgrand-images/cart-desktop.jpg');
    }
}


/* ====================================================
   ✅ ساختار اصلی
   ==================================================== */

.cart-container {
    max-width: 1200px;
    margin: 100px auto 40px;
    padding: 20px;
}

.cart-container h1 {
    color: var(--light);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: right;
}

.cart-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 920px) {
    .cart-content {
        grid-template-columns: 2fr 1fr;
    }
}


/* ====================================================
   ✅ آیتم‌های سبد خرید
   ==================================================== */

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    background: var(--dark);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    opacity: 1;
    transform: none;
    transition: transform 360ms cubic-bezier(.2,.9,.3,1), opacity 320ms ease;
    will-change: transform, opacity;
}

.item-image img {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    object-fit: cover;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-name {
    color: var(--light);
    font-size: 1.2rem;
    font-weight: 600;
}

.item-price {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: bold;
}


/* ====================================================
   ✅ بخش رنگ + تعداد + حذف (هم‌راستا)
   ==================================================== */

.item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-top: 10px;
}


/* ✅ کنترل تعداد */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--greenlight);
    padding: 6px 10px;
    border-radius: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--dark);
    border-radius: 6px;
    transition: 0.2s;
}

.qty-btn:hover {
    background: rgba(0,0,0,0.1);
}

.qty-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.qty-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--dark);
}


/* ✅ دکمه حذف */
.remove-btn {
    background: var(--red);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.remove-btn svg {
    color: var(--light);
}
.remove-btn svg:hover {
    transform: scale(1.05);
}
.remove-btn:hover {
    background: #ff4d4d;
    transform: scale(1.05);
}


/* ====================================================
   ✅ خلاصه سفارش
   ==================================================== */

.cart-summary {
    background: var(--dark);
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    height: fit-content;
    /* FIX: position:sticky با -webkit-sticky برای iOS Safari */
    position: -webkit-sticky;
    position: sticky;
    top: 100px;
}

.cart-summary h2 {
    color: var(--light);
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    color: var(--light);
}

.summary-item.total {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: bold;
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: 0.2s;
}

.checkout-btn:hover {
    background: #3a9a85;
    transform: translateY(-2px);
}


/* ====================================================
   ✅ سبد خالی
   ==================================================== */

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: var(--dark);
    border-radius: 14px;
}

.empty-cart img {
    width: 100px;
    margin-bottom: 20px;
}

.empty-cart p {
    color: #ccc;
    margin-bottom: 20px;
}

.continue-shopping {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 30px;
    border-radius: 8px;
    transition: 0.2s;
}

.continue-shopping:hover {
    background: #3a9a85;
}


/* ====================================================
   ✅ ریسپانسیو
   ==================================================== */

@media (max-width: 480px) {
    .cart-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .item-meta {
        flex-direction: column;
        gap: 15px;
    }
}

.cart-item.placeholder { transition: opacity 220ms ease, height 220ms ease; overflow: hidden; }
.cart-item.removing { opacity: 0.6; }
.remove-btn.loading { pointer-events: none; opacity: 0.6; }

.cart-item.enter-start {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
}

.cart-item.enter {
    opacity: 1;
    transform: none;
}

.cart-item.exit {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
    transition: transform 280ms cubic-bezier(.2,.9,.3,1), opacity 240ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .cart-item, .cart-item.enter, .cart-item.enter-start, .cart-item.exit {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

.animated-price {
    display: inline-block;
    transition: color 220ms ease, transform 260ms cubic-bezier(.2,.9,.3,1);
    will-change: transform, color;
}

.animated-price.pulse {
    transform: scale(1.06);
}

.animated-price.pulse-decrease {
    transform: scale(0.98);
}

@keyframes price-pop {
    from { transform: scale(0.96); opacity: 0.6; }
    to   { transform: scale(1); opacity: 1; }
}
.animated-price.pop {
    animation: price-pop 260ms cubic-bezier(.2,.9,.3,1);
}

@media (prefers-reduced-motion: reduce) {
    .animated-price, .animated-price.pulse, .animated-price.pop {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

/* ====================================================
   ✅ نمایش رنگ در سبد خرید
   FIX: همه تعریف‌های تکراری .cart-color ادغام شدند
   ==================================================== */

.cart-color {
    position: relative;
    display: inline-block;
}

.color-display {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.active-color {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    position: relative;
}

.color-options {
    position: absolute;
    bottom: 44px;
    right: 0;
    background: var(--greenlight);
    padding: 8px 10px 22px 10px;
    border-radius: 16px;
    display: none;
    flex-direction: column;
    gap: 25px;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

.color-options.active {
    display: flex;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-option.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--dark), 0 0 0 4px white;
}

.color-code {
    position: absolute;
    bottom: -23px;
    font-size: 0.7rem;
    color: #ddd;
    white-space: nowrap;
}

/* ✅ رنگ pill */
.color-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px 12px;
    border-radius: 20px;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}

.color-label-text {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
}
