/* ==========================================================
   ABZ Sale Filter - Stylesheet v2.1
   ابزارسرا | فیلتر فروش ویژه
   ========================================================== */

:root {
    --abz-primary:    #e63312;
    --abz-bg:         #ffffff;
    --abz-bg-soft:    #f7f7f7;
    --abz-border:     #e0e0e0;
    --abz-text:       #2d2d2d;
    --abz-muted:      #888;
    --abz-radius:     8px;
    --abz-shadow:     0 2px 12px rgba(0,0,0,.08);
    --abz-transition: .2s ease;
}

/* ── Wrapper ── */
.abz-sale-filter-wrap {
    direction: rtl;
    font-family: inherit;
    margin-bottom: 32px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;   /* هیچ چیزی از viewport بیرون نرود */
}

/* ── Filter Bar ── */
.abz-filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;           /* موبایل: wrap می‌شه */
    gap: 12px;
    background: var(--abz-bg);
    border: 1px solid var(--abz-border);
    border-radius: var(--abz-radius);
    padding: 16px;
    box-shadow: var(--abz-shadow);
    margin-bottom: 24px;
    box-sizing: border-box;
    width: 100%;
}

/* ── Filter Group ── */
.abz-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 160px;          /* حداقل ۱۶۰px، بعد grow */
    min-width: 0;
    box-sizing: border-box;
}

.abz-filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--abz-text);
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    white-space: nowrap;
}

/* ── Select ── */
.abz-select-wrap {
    position: relative;
    width: 100%;
}

.abz-filter-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: var(--abz-bg-soft);
    border: 1px solid var(--abz-border);
    border-radius: var(--abz-radius);
    padding: 0 12px 0 36px;  /* padding افقی — ارتفاع با height کنترل میشه */
    height: 44px;             /* ارتفاع ثابت — متن فارسی کامل نمایش داده میشه */
    line-height: 44px;        /* عمودی وسط‌چین */
    font-size: 14px;
    color: var(--abz-text);
    cursor: pointer;
    font-family: inherit;
    direction: rtl;
    box-sizing: border-box;
    transition: border-color var(--abz-transition);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
}

.abz-filter-select:focus {
    outline: none;
    border-color: var(--abz-primary);
    box-shadow: 0 0 0 3px rgba(230,51,18,.12);
}

.abz-select-arrow {
    position: absolute;
    left: 10px;           /* در RTL فلش سمت چپ = انتهای select */
    top: 50%;
    transform: translateY(-50%);
    color: var(--abz-muted);
    pointer-events: none;
    font-size: 11px;
    line-height: 1;
}

/* ── Actions ── */
.abz-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
    padding-top: 20px;   /* تراز با label+select */
}

.abz-btn-reset {
    background: none;
    border: 1px solid var(--abz-border);
    border-radius: var(--abz-radius);
    padding: 8px 14px;
    font-size: 13px;
    color: var(--abz-muted);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all var(--abz-transition);
}

.abz-btn-reset:hover {
    border-color: var(--abz-primary);
    color: var(--abz-primary);
}

.abz-result-count {
    font-size: 13px;
    color: var(--abz-muted);
    white-space: nowrap;
}

.abz-result-count strong { color: var(--abz-primary); }

/* ── Products Container ── */
.abz-products-container {
    min-height: 200px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    transition: opacity var(--abz-transition);
}

.abz-products-container.is-loading {
    opacity: .5;
    pointer-events: none;
}

/* ── fix product items ── */
.abz-products-container ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
    box-sizing: border-box !important;
}

/* ── Loading ── */
.abz-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--abz-muted);
    font-size: 14px;
}

.abz-spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--abz-border);
    border-top-color: var(--abz-primary);
    border-radius: 50%;
    animation: abzSpin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes abzSpin { to { transform: rotate(360deg); } }

/* ── No Result ── */
.abz-no-result {
    text-align: center;
    padding: 60px 20px;
    color: var(--abz-muted);
}

.abz-no-result-icon { display: block; font-size: 40px; margin-bottom: 12px; }
.abz-no-result p { font-size: 15px; margin: 0; }

/* ── Pagination ── */
.abz-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 28px;
    direction: ltr;   /* اعداد از چپ به راست */
    padding: 0 8px;
}

.abz-page-btn {
    min-width: 34px; height: 34px;
    padding: 0 8px;
    background: var(--abz-bg-soft);
    border: 1px solid var(--abz-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--abz-text);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--abz-transition);
}

.abz-page-btn:hover,
.abz-page-btn.active {
    background: var(--abz-primary);
    border-color: var(--abz-primary);
    color: #fff;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */

/* tablet */
@media (max-width: 768px) {
    .abz-filter-bar {
        gap: 10px;
    }
    .abz-filter-group {
        flex: 1 1 140px;
    }
    .abz-filter-actions {
        padding-top: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

/* mobile */
@media (max-width: 480px) {
    .abz-filter-bar {
        padding: 12px;
        gap: 8px;
    }
    .abz-filter-group {
        flex: 1 1 100%;    /* هر dropdown تمام عرض */
    }
    .abz-filter-select {
        font-size: 13px;
    }
    .abz-filter-actions {
        width: 100%;
        justify-content: space-between;
    }
    .abz-page-btn {
        min-width: 30px; height: 30px;
        font-size: 12px;
    }
}

/* ── Featured Brand Options ── */
#abz-filter-brand option[data-featured="1"] {
    font-weight: 700;
}
