/* ==========================================================================
   فیلتر سفارشی ویژگی‌های ووکامرس – استایل نسخه 2 (طرح pardeh24)
   - هدر با میله‌ی رنگی
   - نوار افقی اسکرول‌شونده با فلش‌های ناوبری
   - سواچ‌های رنگی گرد (حالت رنگ)
   - کارت‌های تصویری (حالت نوع دوخت / ویژگی تصویری)
   - چیپ‌های فیلترِ انتخاب‌شده + پاک‌کردن همه
   ========================================================================== */

.wc-caf {
    --caf-primary: var(--wd-primary-color, #17b3a6);
    --caf-primary-rgb: var(--wd-primary-color-rgb, 23, 179, 166);
    --caf-text: var(--wd-text-color, #2b2f36);
    --caf-muted: #8a9099;
    --caf-border: var(--wd-form-brd-color, #e6e8ec);
    --caf-card-bg: #ffffff;
    direction: rtl;
    margin: 0 0 26px 0;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.wc-caf *,
.wc-caf *::before,
.wc-caf *::after {
    box-sizing: border-box;
}

/* ---------- هدر بخش ---------- */
.wc-caf-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 16px 0;
}

.wc-caf-bar {
    display: inline-block;
    width: 4px;
    height: 20px;
    border-radius: 4px;
    background: var(--caf-primary);
    flex: 0 0 auto;
}

.wc-caf-title {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--caf-text);
}

/* ---------- محفظه نوار + فلش‌ها ---------- */
.wc-caf-strip-wrap {
    position: relative;
    width: 100%;
}

.wc-caf-strip {
    list-style: none !important;
    margin: 0 !important;
    padding: 2px !important;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Firefox */
}
.wc-caf-strip::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.wc-caf-strip > li { list-style: none !important; }

/* در حالت رنگ روی دسکتاپ هم اسکرول تک‌ردیفه می‌ماند.
   کارت‌ها روی دسکتاپ می‌پیچند (grid) و روی موبایل اسکرول افقی می‌شوند. */

/* ---------- فلش‌های ناوبری ---------- */
.wc-caf-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--caf-border);
    background: #fff;
    color: var(--caf-text);
    display: none;                 /* فقط وقتی اسکرول لازم باشد نمایش داده می‌شود */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    padding: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transition: background .2s ease, transform .1s ease, opacity .2s ease;
}
.wc-caf-nav:hover { background: #f6f7f8; }
.wc-caf-nav:active { transform: translateY(-50%) scale(.94); }
.wc-caf-nav svg { width: 16px; height: 16px; display: block; }
.wc-caf-nav-prev { right: -6px; }   /* سمت راست (RTL: قبلی‌ها) */
.wc-caf-nav-next { left: -6px; }    /* سمت چپ  (RTL: بعدی‌ها) */

.wc-caf-strip-wrap.is-scrollable .wc-caf-nav { display: flex; }
.wc-caf-strip-wrap.at-start .wc-caf-nav-prev { opacity: 0; pointer-events: none; }
.wc-caf-strip-wrap.at-end   .wc-caf-nav-next { opacity: 0; pointer-events: none; }

/* ======================= حالت رنگ (سواچ) ======================= */
.wc-caf-swatch {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    width: 58px;
    text-align: center;
    padding: 0;
    background: none;
    border: 0;
}

.wc-caf-dot {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    position: relative;
    background: var(--caf-swatch, #ddd);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
    transition: box-shadow .2s ease, transform .2s ease;
}
.wc-caf-swatch:hover .wc-caf-dot { transform: translateY(-2px); }

/* رینگ انتخاب */
.wc-caf-swatch.active .wc-caf-dot {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--caf-primary);
}

/* تیک انتخاب */
.wc-caf-dot .wc-caf-check {
    position: absolute;
    top: -4px;
    inset-inline-start: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--caf-primary);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .25);
}
.wc-caf-swatch.active .wc-caf-dot .wc-caf-check { display: flex; }
.wc-caf-dot .wc-caf-check svg { width: 11px; height: 11px; }

.wc-caf-swatch .wc-caf-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--caf-text);
    line-height: 1.3;
    white-space: nowrap;
}
.wc-caf-swatch.active .wc-caf-label { color: var(--caf-primary); }

/* دکمه «همه رنگ‌ها» / پالت */
.wc-caf-swatch.wc-caf-reset .wc-caf-dot {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--caf-primary);
    box-shadow: inset 0 0 0 1px var(--caf-border);
}
.wc-caf-swatch.wc-caf-reset .wc-caf-dot svg { width: 20px; height: 20px; }

/* ======================= حالت کارت تصویری ======================= */
.wc-caf-strip.wc-caf-cards { align-items: stretch; }

.wc-caf-card {
    flex: 0 0 auto;
    width: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    background: var(--caf-card-bg);
    border: 1.5px solid var(--caf-border);
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.wc-caf-card:hover {
    border-color: var(--caf-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .07);
    transform: translateY(-3px);
}
.wc-caf-card.active {
    border-color: var(--caf-primary);
    box-shadow: 0 0 0 1px var(--caf-primary), 0 6px 16px rgba(var(--caf-primary-rgb), .18);
}

.wc-caf-card .wc-caf-thumb {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(var(--caf-primary-rgb), .10);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
    transition: transform .3s cubic-bezier(.175, .885, .32, 1.275);
}
.wc-caf-card:hover .wc-caf-thumb { transform: scale(1.08); }

/* آیکون پیش‌فرض وقتی تصویر ندارد */
.wc-caf-card .wc-caf-thumb-fallback {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(var(--caf-primary-rgb), .10);
    color: var(--caf-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wc-caf-card .wc-caf-thumb-fallback svg { width: 30px; height: 30px; }

.wc-caf-card .wc-caf-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--caf-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wc-caf-card.active .wc-caf-label { color: var(--caf-primary); }

/* ---------- چیپ‌های فیلترِ انتخاب‌شده ---------- */
.wc-caf-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.wc-caf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(var(--caf-primary-rgb), .10);
    color: var(--caf-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s ease;
}
.wc-caf-chip:hover { background: rgba(var(--caf-primary-rgb), .18); }
.wc-caf-chip svg { width: 12px; height: 12px; }

.wc-caf-chip-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;
    padding: 6px 4px;
    color: var(--caf-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s ease;
}
.wc-caf-chip-clear:hover { color: #e2484b; }
.wc-caf-chip-clear svg { width: 15px; height: 15px; }

/* ======================= واکنش‌گرا ======================= */

/* دسکتاپ: کارت‌ها گرید چندردیفه (بدون اسکرول افقی و بدون فلش) */
@media (min-width: 769px) {
    .wc-caf-strip.wc-caf-cards {
        flex-wrap: wrap;
        overflow: visible;
    }
    /* روی دسکتاپ فلشِ کارت‌ها لازم نیست */
    .wc-caf-strip-wrap.wc-caf-cards-wrap .wc-caf-nav { display: none !important; }
    .wc-caf-card { width: 132px; }
    .wc-caf-card .wc-caf-thumb,
    .wc-caf-card .wc-caf-thumb-fallback {
        width: 74px;
        height: 74px;
        border-radius: 16px;   /* روی دسکتاپ گوشه‌گرد مثل عکس دوم */
    }
}

/* موبایل و تبلت */
@media (max-width: 768px) {
    .wc-caf-title { font-size: 16px; }
    .wc-caf-card {
        width: 104px;
        padding: 10px 8px;
        border-radius: 12px;
    }
    .wc-caf-card .wc-caf-thumb,
    .wc-caf-card .wc-caf-thumb-fallback {
        width: 56px;
        height: 56px;
    }
    .wc-caf-card .wc-caf-label { font-size: 12px; }

    /* موبایل: مطابق طرح، زیر دایره‌های رنگ متنی نمایش داده نمی‌شود
       (به‌جز دکمه «همه رنگ‌ها» که برای وضوح متنش می‌ماند) */
    .wc-caf-swatch:not(.wc-caf-reset) { width: auto; }
    .wc-caf-swatch:not(.wc-caf-reset) .wc-caf-label { display: none; }
    .wc-caf-swatches { gap: 14px; }
    .wc-caf-dot { width: 44px; height: 44px; }
    .wc-caf-swatch.wc-caf-reset { width: 58px; }
    .wc-caf-swatch.wc-caf-reset .wc-caf-label { font-size: 11.5px; }
    .wc-caf-nav { width: 32px; height: 32px; }
    .wc-caf-nav-prev { right: -4px; }
    .wc-caf-nav-next { left: -4px; }
}

/* ==========================================================================
   سازگاری با قالب (WoodMart و…) — جلوگیری از بازنویسی استایل‌ها
   این بلوک با !important استایل‌های حیاتی را تثبیت می‌کند تا قالب آن‌ها را
   خراب نکند (اندازه تصویر، چیدمان افقی، و ظاهر دکمه‌های فلش).
   ========================================================================== */
.wc-caf .wc-caf-strip {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 2px !important;
}
.wc-caf .wc-caf-strip > li {
    float: none !important;
    margin: 0 !important;
    width: auto;
    max-width: none !important;
    list-style: none !important;
}
.wc-caf .wc-caf-card {
    flex: 0 0 auto !important;
    flex-direction: column !important;
    width: 118px !important;
    min-height: 0 !important;
    max-width: none !important;
}
.wc-caf .wc-caf-card .wc-caf-thumb,
.wc-caf .wc-caf-card .wc-caf-thumb-fallback {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
}
.wc-caf .wc-caf-swatch {
    flex: 0 0 auto !important;
    flex-direction: column !important;
}
.wc-caf .wc-caf-dot {
    width: 42px !important;
    height: 42px !important;
    min-width: 0 !important;
}

/* ریست کاملِ فلش‌ها تا استایل دکمه/لینکِ قالب را نگیرند */
.wc-caf .wc-caf-nav {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: var(--caf-text) !important;
    border: 1px solid var(--caf-border) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1 !important;
    font-size: 0 !important;
}
.wc-caf .wc-caf-nav svg { width: 16px !important; height: 16px !important; }
.wc-caf .wc-caf-nav:hover { background: #f6f7f8 !important; }
.wc-caf .wc-caf-nav-prev { right: -6px !important; left: auto !important; }
.wc-caf .wc-caf-nav-next { left: -6px !important; right: auto !important; }

@media (min-width: 769px) {
    .wc-caf .wc-caf-strip.wc-caf-cards {
        flex-wrap: wrap !important;
        overflow: visible !important;
    }
    .wc-caf .wc-caf-card { width: 132px !important; }
    .wc-caf .wc-caf-card .wc-caf-thumb,
    .wc-caf .wc-caf-card .wc-caf-thumb-fallback {
        width: 74px !important;
        height: 74px !important;
        max-width: 74px !important;
    }
    .wc-caf-strip-wrap.wc-caf-cards-wrap .wc-caf-nav { display: none !important; }
}

@media (max-width: 768px) {
    .wc-caf .wc-caf-card { width: 104px !important; }
    .wc-caf .wc-caf-card .wc-caf-thumb,
    .wc-caf .wc-caf-card .wc-caf-thumb-fallback {
        width: 56px !important;
        height: 56px !important;
        max-width: 56px !important;
    }
    .wc-caf .wc-caf-dot { width: 44px !important; height: 44px !important; }
    .wc-caf .wc-caf-swatch:not(.wc-caf-reset) .wc-caf-label { display: none !important; }
}
