/* ========================================
   WooCommerce Custom Filter Styles
   مسیر: your-theme/css/product-filter.css
   ======================================== */

#cpf-filter-form {
    direction: rtl;
    font-family: inherit;
    border: 1px solid var(--gray-4);
    border-radius: 24px;
}


/* هدر فرم */
.cpf-sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background: var(--light-blue);
    border-radius: 24px 24px 0 0;
    padding: 1rem;

}

.cpf-sidebar-header h3 {
    font-size: 16px;
    font-weight: normal;
    margin: 0;
    color: var(--text);
}

.cpf-clear-all {
    color: #e44c4c;
    text-decoration: none;
    border: 1px solid #e44c4c;
    width: 38%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: background 0.2s;
    display: block;
    text-align: center;
}

.cpf-clear-all:hover {
    background: #e44c4c;
    color: #fff;
}

/* هر گروه فیلتر */
.cpf-filter-group {
    margin: 0 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-4);
}

.cpf-filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
}

.cpf-filter-group-items {
    max-height: 200px;
    overflow-y: auto;
}

.cpf-group-title {
    font-size: 16px;
    font-weight: normal;
    margin: 0 0 14px 0;
}

/* ---- Toggle Switch ---- */
.cpf-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpf-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    justify-content: space-between;
}

.cpf-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cpf-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cpf-toggle-track {
    position: absolute;
    inset: 0;
    background: var(--gray-4);
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.cpf-toggle-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cpf-toggle-input:checked + .cpf-toggle-track {
    background: var(--main);
}

.cpf-toggle-input:checked + .cpf-toggle-track::after {
    transform: translateX(20px);
    background: var(--second);
}

.cpf-toggle-text {
    font-size: 16px;


}

/* ---- Checkbox ---- */
.cpf-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    padding-left: 0.5rem;
}

.cpf-checkbox {
    display: none;
}

.cpf-checkbox-text::before {
    content: "";
    width: 20px;
    height: 20px;
    background-color: var(--gray-4);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    transition: all 0.2s ease;
}

/* حالت فعال */
.cpf-checkbox:checked + .cpf-checkbox-text::before {
    content: "✔";
    background-color: var(--main);
}

.cpf-checkbox-text {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}


.cpf-count {
    font-size: 11px;
    color: #999;
}

/* ---- Price Slider ---- */
#cpf-price-slider {
    margin: 8px 4px 16px;
    direction: ltr;
}

#cpf-price-slider.ui-slider {
    height: 4px;
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
}

#cpf-price-slider .ui-slider-range {
    background: var(--second);
    border-radius: 4px;
}

#cpf-price-slider .ui-slider-handle {
    width: 18px;
    height: 18px;
    top: -7px;
    border-radius: 4px;
    background: var(--second);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: grab;
    outline: none;
    transition: transform 0.1s;
}

#cpf-price-slider .ui-slider-handle:hover,
#cpf-price-slider .ui-slider-handle:active {
    transform: scale(1.2);
    cursor: grabbing;
}

.cpf-price-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    direction: rtl;
}

.cpf-price-display {
    font-size: 13px;
    color: #444;
    font-weight: 500;
}

.cpf-price-separator {
    color: #aaa;
}

/* دکمه اعمال */
.cpf-submit-btn {
    width: 38%;
    padding: 8px 12px;
    background: var(--second);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: background 0.2s;
    display: block;
}

.cpf-submit-btn:hover {
    background: #00AFEF;
}

/* اگر فرم داخل سایدبار تم قرار داشت */
.widget #cpf-filter-form {
    padding: 0;
}

/* زیردسته‌های تاشو */
.cpf-cat-children {
    display: none;
    margin-top: 4px;
}

.cpf-cat-children.is-open {
    display: block;
}

.cpf-cat-toggle {
    display: inline-block;
    width: 16px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.cpf-cat-toggle.is-open {
    transform: rotate(90deg);
}

.cpf-cat-toggle-placeholder {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

.cpf-cat-item {
    margin-bottom: 4px;
}

span.ui-slider-handle.ui-corner-all.ui-state-default:after {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    content: '\e02c';
    font-family: 'Iconly';
    font-size: 16px;
    line-height: 1;
    transform: translate(-50%, -50%);
    color: white;
}

span.ui-slider-handle.ui-corner-all.ui-state-default:last-of-type::after {
    content: '\e02b';
}


.cpf-filter-group-items {
    max-height: 200px;
    overflow-y: auto;
    padding-left: 4px;

    /* اسکرول‌بار */
    scrollbar-width: thin;
    scrollbar-color: var(--second) transparent;
}

/* کروم / سافاری */
.cpf-filter-group-items::-webkit-scrollbar {
    width: 4px;
}

.cpf-filter-group-items::-webkit-scrollbar-track {
    background: transparent;
}

.cpf-filter-group-items::-webkit-scrollbar-thumb {
    background-color: var(--second);
    border-radius: 999px;
}

.cpf-filter-group-items::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}