/**
 * assets/css/shop-archive.css
 * صفحات آرشیو فروشگاه (فروشگاه، دسته‌ها، برچسب‌ها، برندها، جستجوی محصول).
 *
 * بخش‌ها:
 *   1. کارت سایدبار + هدر «فیلترها»
 *   2. ویجت‌ها و آکاردئون
 *   3. فیلتر موجودی — سوییچ
 *   4. فیلتر قیمت
 *   5. فیلتر دسته‌بندی — جستجو و چک‌باکس
 *   6. جمع شدن سایدبار (دسکتاپ)
 *   7. نوار بالای محصولات (فیلترها + ترتیب)
 *   8. تبلت و موبایل (تا 1024px)
 *
 * مارک‌آپ هدر سایدبار و نوار ترتیب: inc/shop-archive.php
 * رفتارها (آکاردئون، جمع شدن، قیمت، پنل ترتیب): assets/js/shop-archive.js
 */

/* ─── ۱. کارت سایدبار + هدر «فیلترها» ─────────────────────────────────────── */

.wd-sidebar .widget-area {
    background: #fff;
    border: 1px solid #DCE3EC;
    border-radius: 10px;
    overflow: hidden;
    padding: 0 0 8px !important;
}

.radia-filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 54px;
    padding-inline: 16px 10px;
    border-bottom: 1px solid #E7EBF0;
    margin-bottom: 6px;
}

.radia-filters-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #242B33;
}

.radia-filters-head__title svg {
    width: 20px;
    height: 20px;
    color: #242B33;
    flex-shrink: 0;
}

.wd-sidebar button.radia-filters-head__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    box-shadow: none;
    color: #242B33;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.wd-sidebar button.radia-filters-head__collapse:hover,
.wd-sidebar button.radia-filters-head__collapse:focus-visible {
    background: #E7EDF2;
    color: #1A5071;
}

.radia-filters-head__collapse svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* آیکون ضربدر فقط در پنل کشویی موبایل */
.radia-filters-head__collapse .radia-icon-close {
    display: none;
}

/* ─── ۲. ویجت‌ها و آکاردئون ───────────────────────────────────────────────── */

.wd-sidebar .widget-area > .wd-widget {
    margin: 0 !important;
    padding: 6px 16px !important;
    border: none;
}

.wd-sidebar .widget-area > .wd-widget > .widget-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.6;
    text-transform: none !important;
    color: #242B33 !important;
    margin: 0 0 12px !important;
}

/* عنوان قابل کلیک (کلاس radia-acc را JS اضافه می‌کند؛ بدون JS همه باز می‌مانند) */
.wd-sidebar .widget-area > .wd-widget.radia-acc > .widget-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    margin: 0 !important;
    cursor: pointer;
    user-select: none;
}

.wd-sidebar .widget-area > .wd-widget.radia-acc > .widget-title::after {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23242B33' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform .2s ease;
}

.wd-sidebar .widget-area > .wd-widget.radia-acc.is-open > .widget-title::after {
    transform: rotate(180deg);
}

.wd-sidebar .widget-area > .wd-widget.radia-acc > .widget-title:focus-visible {
    outline: 2px solid #1A5071;
    outline-offset: 2px;
    border-radius: 4px;
}

.wd-sidebar .widget-area > .wd-widget.radia-acc:not(.is-open) > :not(.widget-title) {
    display: none !important;
}

.wd-sidebar .widget-area > .wd-widget.radia-acc.is-open {
    padding-bottom: 14px !important;
}

/* ─── ۳. فیلتر موجودی — سوییچ در انتهای ردیف ─────────────────────────────────
   آیتم‌ها لینک هستند؛ فقط ظاهر ::before (بدنه) و ::after (دکمه) تغییر می‌کند. */

.wd-sidebar .wd-widget-stock-status > .widget-title {
    display: none;
}

.wd-sidebar .widget-area > .wd-widget-stock-status {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.wd-widget-stock-status .wd-checkboxes-on {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.wd-widget-stock-status .wd-checkboxes-on li {
    margin: 0 !important;
}

.wd-widget-stock-status .wd-checkboxes-on li a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 32px;
    padding-inline: 0 46px;
    font-size: 14px;
    color: #242B33;
}

.wd-widget-stock-status .wd-checkboxes-on li a::before {
    content: "" !important;
    position: absolute !important;
    inset-inline-end: 0 !important;
    inset-inline-start: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 34px !important;
    height: 20px !important;
    min-width: 34px !important;
    margin: 0 !important;
    border: 1.5px solid #9AA3AE !important;
    border-radius: 9999px !important;
    background: transparent !important;
    box-sizing: border-box !important;
    transition: background-color .2s ease, border-color .2s ease !important;
    display: block !important;
}

.wd-widget-stock-status .wd-checkboxes-on li a::after {
    content: "" !important;
    position: absolute !important;
    inset-inline-end: 5px !important;
    inset-inline-start: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 10px !important;
    height: 10px !important;
    border: 1.5px solid #9AA3AE !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-sizing: border-box !important;
    transition: inset-inline-end .2s ease, background-color .2s ease !important;
}

.wd-widget-stock-status .wd-checkboxes-on li.wd-active a::before {
    background: #1A5071 !important;
    border-color: #1A5071 !important;
}

.wd-widget-stock-status .wd-checkboxes-on li.wd-active a::after {
    inset-inline-end: 19px !important;
    border-color: #fff !important;
    background: #fff !important;
}

/* ─── ۴. فیلتر قیمت ───────────────────────────────────────────────────────── */

.widget_price_filter .price_slider_wrapper {
    padding: 14px 12px 0;
}

.widget_price_filter .price_slider.ui-widget-content {
    background: #DCE3EC !important;
    border: none !important;
    height: 4px !important;
    border-radius: 4px !important;
    margin: 0 !important;
}

.widget_price_filter .ui-slider-range.ui-widget-header {
    background: #1A5071 !important;
    border-radius: 4px !important;
}

.widget_price_filter .ui-slider-handle {
    width: 26px !important;
    height: 18px !important;
    top: 50% !important;
    margin-top: -9px !important;
    margin-left: -13px !important;
    background-color: #1A5071 !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 12px 12px !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 3px rgba(26, 80, 113, .35) !important;
    outline: none !important;
    cursor: grab;
    z-index: 3 !important;
}

.widget_price_filter .ui-slider-handle::before,
.widget_price_filter .ui-slider-handle::after {
    display: none !important;
}

.widget_price_filter .ui-slider-handle:focus-visible {
    box-shadow: 0 0 0 3px rgba(26, 80, 113, .3) !important;
}

/* فلش رو به داخل (کلاس سمت هر دسته را JS اضافه می‌کند) */
.widget_price_filter .ui-slider-handle.radia-handle-left {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

.widget_price_filter .ui-slider-handle.radia-handle-right {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* کادرهای اصلی ووکامرس و دکمه مخفی می‌شوند و کادرهای قالب‌دار جایشان می‌آیند
   (فقط وقتی JS فعال است؛ اینپوت‌های اصلی همچنان با فرم ارسال می‌شوند). */
.widget_price_filter .radia-price-form .price_slider_amount {
    display: none !important;
}

/* بدون JS: چیدمان ساده‌ی کادرها و دکمه */
.widget_price_filter .price_slider_amount {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.widget_price_filter .price_slider_amount .price_label,
.widget_price_filter .price_slider_amount .clear {
    display: none;
}

.widget_price_filter .radia-price-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.radia-price-field__label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 500;
    color: #242B33;
}

.radia-price-field__box {
    display: flex;
    align-items: center;
    height: 48px;
    padding-inline: 14px 12px;
    background: #fff;
    border: 1px solid #DCE3EC;
    border-radius: 8px;
    transition: border-color .15s ease;
}

.radia-price-field__box:focus-within {
    border-color: #1A5071;
}

.radia-price-field__box input.radia-price-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #242B33;
    direction: rtl;
    text-align: right;
}

.radia-price-field__box input.radia-price-input:focus {
    outline: none;
    box-shadow: none;
}

.radia-price-field__unit {
    flex-shrink: 0;
    margin-inline-start: 8px;
    font-size: 12px;
    color: #69727C;
}

/* ─── ۵. فیلتر دسته‌بندی — جستجو و چک‌باکس ───────────────────────────────── */

.wd-sidebar .wd-filter-search {
    margin-bottom: 10px;
}

.wd-sidebar .wd-filter-search input {
    height: 42px !important;
    padding-inline: 40px 12px !important;
    background-color: #F5F7FA !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2369727C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px 18px !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 13px !important;
    color: #242B33 !important;
}

.wd-sidebar .wd-filter-search input:focus {
    border-color: #DCE3EC !important;
    background-color: #fff !important;
}

.wd-sidebar .wd-filter-search input::placeholder {
    color: #9AA3AE;
}

/* آیکون ذره‌بین پیش‌فرض قالب (در صورت وجود) */
.wd-sidebar .wd-filter-search::before {
    display: none !important;
}

.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li {
    margin: 0 !important;
}

.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    font-size: 14px;
    color: #242B33;
}

.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li > a::before {
    content: "" !important;
    display: block !important;
    flex-shrink: 0;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    border: 1.5px solid #242B33 !important;
    border-radius: 6px !important;
    background: #fff !important;
    box-sizing: border-box !important;
    font-size: 0 !important;
    transition: background-color .15s ease, border-color .15s ease !important;
}

.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li > a:hover::before {
    border-color: #1A5071 !important;
}

.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li.wd-active > a::before,
.wd-sidebar .wd-product-category-filter .wd-checkboxes-on li.chosen > a::before {
    background-color: #1A5071 !important;
    border-color: #1A5071 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 12px 12px !important;
}

/* زیردسته‌ها */
.wd-sidebar .wd-product-category-filter ul.children {
    padding-inline-start: 14px;
}

/* ─── ۶. جمع شدن سایدبار (دسکتاپ) ─────────────────────────────────────────── */

@media (min-width: 1025px) {
    body.radia-filters-collapsed .wd-content-layout > .wd-sidebar {
        display: none;
    }

    body.radia-filters-collapsed .wd-content-layout > .wd-content-area {
        --wd-col-lg: 12 !important;
    }

    body.radia-filters-collapsed .wd-content-area .wd-products {
        --wd-col-lg: 5 !important;
    }
}

/* ─── ۷. نوار بالای محصولات (فیلترها + ترتیب) ─────────────────────────────── */

/* ابزارهای پیش‌فرض قالب که جایگزین شده‌اند (مسیر صفحه باقی می‌ماند) */
.shop-loop-head .woocommerce-result-count,
.shop-loop-head .wd-show-sidebar-btn,
.shop-loop-head .wd-products-per-page,
.shop-loop-head .wd-products-shop-view,
.shop-loop-head .woocommerce-ordering {
    display: none !important;
}

/* قالب خروجی woocommerce_before_shop_loop را داخل ستون ابزارهای کنار مسیر صفحه
   چاپ می‌کند؛ این ستون به ردیف دوم (زیر مسیر صفحه) و تمام‌عرض می‌رود. */
.shop-loop-head > .wd-shop-tools:has(.radia-shopbar) {
    flex: 1 1 100%;
    margin-top: 14px;
}

.radia-shopbar {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
}

.shop-loop-head .radia-shopbar {
    flex: 1 1 100%;
    margin-bottom: 0;
}

.radia-shopbar button.radia-shopbar__filter {
    display: none;
    align-items: center;
    gap: 10px;
    height: 52px;
    min-height: 0;
    padding: 0 18px;
    margin: 0;
    background: #fff;
    border: 1px solid #DCE3EC;
    border-radius: 10px;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #242B33;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.radia-shopbar button.radia-shopbar__filter:hover,
.radia-shopbar button.radia-shopbar__filter:focus-visible {
    border-color: #1A5071;
    color: #1A5071;
}

.radia-shopbar__filter svg,
.radia-sortbar__toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

body.radia-filters-collapsed .radia-shopbar button.radia-shopbar__filter {
    display: flex;
}

.radia-sortbar {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 52px;
    padding: 0 18px;
    background: #E7EDF2;
    border-radius: 10px;
}

/* دسکتاپ: دکمه فقط نقش عنوان را دارد */
.radia-sortbar button.radia-sortbar__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #242B33;
    text-transform: none;
    pointer-events: none;
    flex-shrink: 0;
}

.radia-sortbar__current {
    display: none;
}

.radia-sortbar__sheet {
    flex: 1 1 auto;
    min-width: 0;
}

.radia-sortbar__sheet-head {
    display: none;
}

.radia-sortbar__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.radia-sortbar__list li {
    margin: 0;
    padding: 0;
}

.radia-sortbar__list a {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    font-weight: 400;
    color: #69727C;
    white-space: nowrap;
    transition: color .15s ease;
}

.radia-sortbar__list a:hover {
    color: #1A5071;
}

.radia-sortbar__list a.is-active {
    font-weight: 700;
    color: #1A5071;
}

.radia-sortbar__count {
    flex-shrink: 0;
    margin-inline-start: auto;
    font-size: 13px;
    color: #69727C;
    white-space: nowrap;
}

.radia-sortbar__backdrop {
    display: none;
}

/* اسپینر کوچک قالب هنگام فیلتر AJAX؛ لودر تمام‌صفحه‌ی سایت جایش نمایش داده می‌شود
   (shop-archive.js بخش ۵). */
.wd-content-loader {
    display: none !important;
}

/* ─── ۸. تبلت و موبایل (تا 1024px) ────────────────────────────────────────── */

@media (max-width: 1024px) {

    /* سایدبار داخل پنل کشویی قالب */
    .wd-sidebar .widget-area {
        border: none;
        border-radius: 0;
        /* این عنصر در پنل کشویی ظرف اسکرول قالب است */
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* سربرگ «بستن» قالب جایش را به هدر «فیلترها» می‌دهد */
    .wd-sidebar:has(.radia-filters-head) > .wd-heading {
        display: none !important;
    }

    .wd-sidebar .radia-filters-head {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #fff;
    }

    .radia-filters-head__collapse .radia-icon-collapse {
        display: none;
    }

    .radia-filters-head__collapse .radia-icon-close {
        display: block;
    }

    /* نوار بالا: دو دکمه + تعداد */
    .radia-shopbar {
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
    }

    .radia-shopbar button.radia-shopbar__filter,
    body.radia-filters-collapsed .radia-shopbar button.radia-shopbar__filter {
        display: flex;
        height: 42px;
        padding: 0 14px;
        gap: 8px;
        font-size: 13px;
        border-radius: 8px;
    }

    .radia-sortbar {
        gap: 8px;
        min-height: 0;
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    .radia-sortbar button.radia-sortbar__toggle {
        height: 42px;
        padding: 0 14px;
        gap: 8px;
        background: #fff;
        border: 1px solid #DCE3EC;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 700;
        pointer-events: auto;
        cursor: pointer;
        min-width: 0;
        flex-shrink: 1;
    }

    .radia-sortbar button.radia-sortbar__toggle:focus-visible {
        border-color: #1A5071;
        outline: none;
    }

    .radia-sortbar__label {
        display: none;
    }

    .radia-sortbar__current {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .radia-shopbar__filter svg,
    .radia-sortbar__toggle svg {
        width: 18px;
        height: 18px;
    }

    .radia-sortbar__count {
        font-size: 12px;
    }

    /* پنل ترتیب از پایین صفحه */
    .radia-sortbar__sheet {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 100001;
        max-height: 80vh;
        overflow-y: auto;
        padding: 0 16px calc(16px + env(safe-area-inset-bottom));
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .12);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s ease;
    }

    .radia-sortbar.is-open .radia-sortbar__sheet {
        transform: translateY(0);
        visibility: visible;
    }

    .radia-sortbar__sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 56px;
        border-bottom: 1px solid #E7EBF0;
        font-size: 15px;
        font-weight: 700;
        color: #242B33;
    }

    .radia-sortbar__sheet-head button.radia-sortbar__close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        min-height: 0;
        padding: 0;
        margin: 0;
        background: transparent;
        border: none;
        border-radius: 8px;
        box-shadow: none;
        color: #69727C;
        cursor: pointer;
    }

    .radia-sortbar__close svg {
        width: 18px;
        height: 18px;
        pointer-events: none;
    }

    .radia-sortbar__list {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0;
    }

    .radia-sortbar__list li + li {
        border-top: 1px solid #F0F3F6;
    }

    .radia-sortbar__list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 50px;
        padding: 0 4px;
        font-size: 14px;
        color: #242B33;
    }

    .radia-sortbar__list a.is-active::after {
        content: "";
        width: 16px;
        height: 16px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A5071' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-size: contain;
    }

    .radia-sortbar__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100000;
        background: rgba(0, 0, 0, .4);
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease, visibility .25s ease;
    }

    .radia-sortbar.is-open .radia-sortbar__backdrop {
        opacity: 1;
        visibility: visible;
    }

    body.radia-sort-open {
        overflow: hidden;
    }

    /* دکمه‌ی چت پشتیبانی روی پنل ترتیب نیفتد */
    body.radia-sort-open #radya-chat-btn {
        visibility: hidden;
    }
}

@media (max-width: 380px) {
    .radia-shopbar button.radia-shopbar__filter,
    .radia-sortbar button.radia-sortbar__toggle {
        padding: 0 10px;
    }

    .radia-sortbar__count {
        display: none;
    }
}