/* ====================================================
     استایل‌های صفحه علاقه‌مندی‌ها
     ساختار مشابه صفحه سبد خرید با تغییرات مناسب برای علاقه‌مندی‌ها
================================================== */

/* 🎨 تعریف رنگ‌های اصلی (Theme Colors) */
:root {
    --red: #a35c40;
    --primary: #47b59e;
    --deep: #336633;
    --dark: #343a32;
    --light: #e0dfdd;
    --greenlight: #8fa271;
    --radius: 1.2rem;
    --padding: 1.2rem;
    --gap: 1rem;
}

/* ---------- فونت‌ها ---------- */
@font-face {
    font-family: 'IranSans';
    src: url('../fonts/AbarLow-SemiBold.woff2') format('woff2');
    font-weight: 400;
}

@font-face {
    font-family: 'IranSans';
    src: url('../fonts/AbarLow-ExtraBold.woff2') format('woff2');
    font-weight: 500;
}

@font-face {
    font-family: 'IranSans';
    src: url('../fonts/AbarLow-Black.woff2') format('woff2');
    font-weight: 700;
}

/* 🖱️ استایل اسکرول‌بار مرورگر */
::-webkit-scrollbar {
    width: 8px
}

::-webkit-scrollbar-track {
    background: var(--greenlight)
}

::-webkit-scrollbar-thumb {
    background: var(--deep);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark)
}

/* 📜 تنظیمات کلی صفحه */
html {
    scroll-behavior: smooth
}

/* اسکرول نرم */
body {
    font-family: 'IranSans', sans-serif;
    background: var(--deep);
    color: #333;
    overflow-x: hidden;
    font-size: 1rem;
    /* اندازه پایه متن */
    line-height: 1.6;
}


/* ---------- تنظیمات پایه ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IranSans', sans-serif;
    color: #333;
    overflow-x: hidden;
    font-size: 1rem;
    line-height: 1.6;
}

/* بکگراند برای صفحه علاقه‌مندی‌ها */
body.wishlist-page {
    background-image: linear-gradient(rgba(3, 17, 0, 0.856), rgba(3, 48, 0, 0.623)), url('../images/backgrand-images/wishlist.jpg');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

@media (min-width: 920px) {
    body.wishlist-page {
        background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('../images/backgrand-images/cart-desktop.jpg');
    }
}


/* ---------- پایه صفحه ---------- */
.wishlist-container {
    max-width: 1200px;
    margin: 100px auto 30px;
    padding: 20px;
}

.wishlist-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* ---------- سازگاری با کارت‌های قدیمی (cart-item) ---------- */
/* کارت پایه (از صفحه سبد) — استفاده شده برای ورود/خروج و placeholder */
.cart-item,
.wishlist-item {
    background: var(--dark);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    gap: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all .3s ease;
    align-items: center;
}

/* hover عمومی */
.cart-item:hover,
.wishlist-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* تصویر محصول */
.item-image {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--greenlight), var(--primary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
    overflow: hidden;
}

/* جزئیات محصول */
.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light);
    text-align: right;
}

.item-price {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
    text-align: right;
}

/* اکشن‌ها و کنترل‌ها */
.item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

.add-to-cart-btn {
    flex: 1 1 auto;
    /* دکمه بزرگ می‌شود و فضای خالی را پر می‌کند */
    min-width: 140px;
    /* حداقل عرض معقول */
    max-width: calc(100% - 60px);
    /* از پهنای کارت کم می‌کند تا حذف جا داشته باشد */
    padding: 12px 18px;
    text-align: center;
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    gap: 12px;
    flex: 1 1 auto;
    /* مهم: گروه کنترل منعطف شود */
    justify-content: flex-start;
}

/* دکمه افزودن به سبد */
.add-to-cart-btn,
.add-to-cart-btn:focus {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
    font-weight: 600;
    outline: none;
}

.add-to-cart-btn:hover {
    background: #3a9a85;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(71, 181, 158, 0.3);
}

/* دکمه حذف (سازگار با کلاس remove-btn و remove-from-wishlist-btn) */
.remove-from-wishlist-btn,
.remove-btn {
    background: var(--red);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    outline: none;
    flex: 0 0 36px;
    margin-inline-start: 12px;
}

.rtl .remove-btn {
    margin-inline-start: 0;
    margin-inline-end: 12px;
}

.remove-from-wishlist-btn svg,
.remove-btn svg {
    width: 25px;
    height: 25px;
}

.remove-from-wishlist-btn:hover,
.remove-btn:hover {
    background: #ff5252;
    transform: scale(1.05);
}

/* حالت loading برای دکمه حذف */
.remove-btn.loading,
.remove-from-wishlist-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* ---------- حالت‌های خالی و خطا ---------- */
.empty-wishlist,
.wl-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--dark);
    border-radius: 1rem;
}

.empty-wishlist svg {
    width: 100px;
    height: 100px;
    color: var(--greenlight);
    margin-bottom: 20px;
}

.empty-wishlist h2 {
    color: var(--light);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-wishlist p {
    color: #999;
    margin-bottom: 30px;
}

.continue-shopping,
.wl-continue,
.continue-shopping {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all .3s;
}

.continue-shopping:hover,
.wl-continue:hover {
    background: #3a9a85;
    transform: translateY(-2px);
}

/* ---------- placeholder و حالت حذف اپتیمیسیتیک ---------- */
/* placeholder که جایگزین کارت می‌شود */
.cart-item.placeholder,
.wishlist-placeholder,
.wl-placeholder {
    transition: opacity 220ms ease, height 220ms ease;
    overflow: hidden;
    opacity: 0.6;
}

/* کلاس کمکی برای حالت removing (اختیاری برای جلوهٔ بیشتر) */
.cart-item.removing,
.wishlist-item.removing {
    opacity: 0.6;
}

/* ---------- انیمیشن ورود/خروج کارت (هماهنگ با کد JS) ---------- */
/* کارت پایه با transition برای transform و opacity */
.cart-item {
    opacity: 1;
    transform: none;
    transition: transform 360ms cubic-bezier(.2, .9, .3, 1), opacity 320ms ease;
    will-change: transform, opacity;
}

/* حالت اولیه قبل از ورود */
.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;
}

/* کاهش حرکت برای کاربران با prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {

    .cart-item,
    .cart-item.enter,
    .cart-item.enter-start,
    .cart-item.exit,
    .wishlist-item,
    .wishlist-placeholder {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ---------- واکنش‌گرایی ---------- */
@media(max-width: 480px) {

    .wishlist-item,
    .cart-item {
        flex-direction: column;
        text-align: center;
    }

    .item-image {
        width: 50%;
        height: auto;
        margin: 0 auto;
    }

    .item-actions {
        flex-direction: column;
        gap: 12px;
    }

    .add-to-cart-btn,
    .remove-from-wishlist-btn,
    .remove-btn {
        width: 100%;
    }

    .wishlist-container {
        margin-top: 110px;
    }
}

@media(min-width: 769px) {
    .header-buttons {
        top: 0.5rem;
    }
}

/* ---------- دسترس‌پذیری و فوکوس ---------- */
.cart-item:focus,
.wishlist-item:focus {
    outline: 3px solid rgba(255, 255, 255, 0.06);
    outline-offset: 4px;
}

/* ---------- کلاس‌های کمکی کوچک ---------- */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error {
    color: #f66;
    text-align: center;
    padding: 12px;
}