/* =============================================
   Smart Product Filter - Frontend CSS
   ============================================= */

/* ========== Sort Bar ========== */
#spf-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    direction: rtl;
}

.spf-sort-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.spf-sort-label {
    font-size: 13px;
    color: #666;
    margin-left: 4px;
}

.spf-sort-btn {
    background: transparent;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.spf-sort-btn:hover {
    border-color: #333;
    color: #000;
}

.spf-sort-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.spf-mobile-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

.spf-active-count {
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========== Loader ========== */
#spf-loader {
    display: none;
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

/* ========== Sidebar ========== */
#spf-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    direction: rtl;
}

.spf-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.spf-sidebar-header span {
    font-size: 15px;
    font-weight: 700;
}

.spf-btn-reset {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.spf-btn-reset:hover {
    text-decoration: underline;
}

/* ========== Filter Sections ========== */
.spf-filter-section {
    border-bottom: 1px solid #f0f0f0;
    padding: 14px 0;
}

.spf-filter-section:last-of-type {
    border-bottom: none;
}

.spf-filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
    color: #222;
}

.spf-arrow {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.spf-arrow.open {
    transform: rotate(180deg);
}

.spf-filter-options {
    padding-top: 10px;
}

/* ========== Checkboxes ========== */
.spf-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
}

.spf-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #000;
    flex-shrink: 0;
}

.spf-option-name {
    flex: 1;
    color: #333;
}

.spf-option-count {
    color: #aaa;
    font-size: 11px;
}

.spf-option:hover .spf-option-name {
    color: #000;
}

/* ========== Color Options ========== */
.spf-color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.spf-color-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: border-color 0.15s;
    font-size: 12px;
}

.spf-color-option input {
    display: none;
}

.spf-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    display: inline-block;
    flex-shrink: 0;
}

.spf-color-option {
    border: none !important;
}

.spf-color-option.selected .spf-color-swatch {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}
/* ========== Price Filter ========== */
.spf-price-slider-wrap {
    padding: 4px 0;
    direction: rtl;
}

#spf-price-slider {
    margin: 16px 8px 24px;
    height: 2px;
    background: #e8e8e8;
    border: none;
    border-radius: 2px;
}

#spf-price-slider .ui-slider-range {
    background: #e8003d;
    border-radius: 2px;
}

#spf-price-slider .ui-slider-handle {
    width: 14px;
    height: 14px;
    background: #e8003d;
    border: none;
    border-radius: 50%;
    top: -6px;
    cursor: grab;
    outline: none;
}

#spf-price-slider .ui-slider-handle:hover,
#spf-price-slider .ui-slider-handle:active {
    background: #c4002f;
}

.spf-price-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.spf-price-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.spf-price-input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.spf-price-input-group label::after {
    content: 'تومان';
    font-size: 12px;
    font-weight: 400;
    color: #666;
}

.spf-price-input-group input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    text-align: left;
    direction: ltr;
    outline: none;
    padding: 8px 12px;
    color: #333;
    -moz-font-feature-settings: "ss02";
        -webkit-font-feature-settings: "ss02";
        font-feature-settings: "ss02";
}

.spf-price-input-group input:focus {
    border-color: #e8003d;
}

.spf-price-input-group span {
    display: none;
}

/* ========== Apply Button (mobile only) ========== */
.spf-btn-apply {
    width: 100%;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}

.spf-btn-apply:hover {
    background: #222;
}

/* ========== No Products ========== */
.spf-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    font-size: 15px;
    width: 100%;
    grid-column: 1 / -1;
}

/* ========== Modal (Mobile) ========== */
#spf-filter-modal .modal-dialog {
    margin: 0 0 0 auto;
    height: 100%;
    max-height: 100%;
    max-width: 320px;
}

#spf-filter-modal .modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
    direction: rtl;
}

#spf-filter-modal .modal-header {
    border-bottom: 1px solid #eee;
    padding: 16px;
}

#spf-filter-modal .modal-body {
    overflow-y: auto;
    padding: 0 16px;
}

#spf-filter-modal .modal-footer {
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
    padding: 12px 16px;
}

.spf-btn-apply-modal {
    flex: 1;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    cursor: pointer;
}

.spf-btn-reset-modal {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    color: #e74c3c;
}

/* ========== Responsive ========== */
@media (max-width: 767px) {
    #spf-sidebar {
        display: none;
    }
}

@media (min-width: 768px) {
    #spf-filter-modal {
        display: none !important;
    }

    .spf-mobile-filter-btn {
        display: none !important;
    }

    .spf-btn-apply {
        display: none !important;
    }
}
/* ========== Edits ========== */
.spf-color-swatch-wrap {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.spf-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    display: block;
}

.spf-color-check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
}

.spf-color-option.selected .spf-color-swatch {
    border: 2px solid #333;
}
.spf-search-box {
    margin-bottom: 8px;
}

.spf-term-search {
    width: 100%;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    direction: rtl;
}

.spf-term-search:focus {
    border-color: #999;
}

.spf-terms-list {
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(0, 0, 0, .025);
    padding-left: 8px;
}

.spf-terms-list::-webkit-scrollbar {
    width: 3px;
}

.spf-terms-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, .025);
    border-radius: 0;
}

.spf-terms-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 0;
}

.spf-terms-list::-webkit-scrollbar-button {
    width: 0;
    height: 0;
    display: none;
}

.spf-terms-list::-webkit-scrollbar-corner {
    background: transparent;
}
@media (max-width: 767px) {
    #spf-sort-bar {
        flex-direction: column;
        gap: 8px;
    }

    .spf-sort-label {
        display: none;
    }

    .spf-sort-buttons {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .spf-sort-buttons::-webkit-scrollbar {
        display: none;
    }

    .spf-sort-btn {
        white-space: nowrap;
        flex-shrink: 0;
        background: #fff;
        margin-left:2px;
    }

    .spf-mobile-filter-btn {
        width: 100%;
        justify-content: center;
        background: #fff;
    }
}
#spf-filter-modal .modal-dialog {
    margin: 0 0 0 auto;
    height: 100%;
    max-height: 100%;
    max-width: 320px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

#spf-filter-modal.show .modal-dialog {
    transform: translateX(0);
}

#spf-filter-modal .modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
}
.filter_modal .modal-header .btn-close {
    margin: 0;
    padding: 0;
}
#spf-sidebar, .spf-term-search, 
#spf-modal-body,
#spf-sort-bar {
    -moz-font-feature-settings: "ss02";
    -webkit-font-feature-settings: "ss02";
    font-feature-settings: "ss02";
}