/* ========================================
   Archive Shared Filters Sidebar
   ======================================== */

.filters-sidebar {
    position: sticky;
    top: 80px;
    height: 70vh;
    width: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0;
}


.filters-container {
    width: 100%;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 15px;
}

/* ========================================
   Filters Header - Green Box Style
   ======================================== */

.filters-header {
    width: 100%;
    flex-shrink: 0;
    padding: 18px 20px;
    background: linear-gradient(135deg, #0f4f59 0%, #0f4f59 100%);
    border-radius: 20px 20px 0 0;
    margin: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    min-height: 60px;
}

.filters-header h3 {
    position: absolute;
    bottom: -15px;
    right: 15px;
    left: 15px;
    background-color: #e8f5f3;
    padding: 15px 20px;
    font-size: 14px;
    color: #0f4f59;
    margin: 0;
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    flex-direction: row;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.filters-header-icon {
    width: 18px;
    height: 18px;
    color: #0f4f59;
}

.filters-collapse-btn {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.filters-collapse-btn svg {
    width: 22px;
    height: 22px;
    color: #333;
    transition: transform 0.3s ease;
}

.filters-collapse-btn:hover svg {
    transform: translateX(-3px);
}

/* ========================================
   Product Filters Form
   ======================================== */

.product-filters {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 15px;
    width: 100%;
}

/* ========================================
   Accordion Filter Groups
   ======================================== */

.filter-group {
    width: 100%;
    overflow: hidden;
    margin-bottom: 15px;
}

.filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.filter-group-header:hover {
    color: #0f4f59;
}

.filter-group-title {
    font-size: 14px;
    font-weight: 400;
    color: #000;
    margin: 0;
}

.filter-group-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: #666;
}

.filter-group-icon svg {
    width: 16px;
    height: 16px;
    color: #0f4f59;
}

.filter-group.open .filter-group-icon {
    transform: rotate(180deg);
}

.filter-group-content {
    /* نمایش/پنهان با jQuery slideToggle کنترل می‌شود */
    display: none;
    padding: 0;
}

.filter-group.open .filter-group-content {
    display: block;
    padding: 10px 0 15px 0;
}

/* اسکرول داخلی وقتی بیش از ۵ آیتم باشد */
.filter-group-content .filter-options {
    max-height: none;
    overflow-y: visible;
}

.filter-group-content .filter-options.has-scroll {
    max-height: 220px;
    overflow-y: auto;
    padding-left: 6px;
}

/* ========================================
   Toggle Switch for Stock Filter
   ======================================== */

.stock-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 12px 0;
}

.stock-toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #0f4f59;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #0f4f59;
}

/* ========================================
   Search Box in Filter
   ======================================== */

.filter-search-box {
    margin-bottom: 12px;
}

.filter-search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    transition: all 0.3s ease;
}

.filter-search-box input:focus {
    outline: none;
    border-color: #0f4f59;
    background: #fff;
}

.filter-search-box input::placeholder {
    color: #999;
}

/* ========================================
   Filter Checkboxes with Border
   ======================================== */

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-checkbox {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-checkbox:hover {
    background: #f0f0f0;
    border-color: #0f4f59;
}

.filter-checkbox.checked {
    background: #e8f5f3;
    border-color: #0f4f59;
    border-right: 3px solid #0f4f59;
}

.filter-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.filter-checkbox input[type="checkbox"]:checked + .filter-checkbox-content .checkbox-custom {
    background: #0f4f59;
    border-color: #0f4f59;
}

.filter-checkbox input[type="checkbox"]:checked + .filter-checkbox-content .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.filter-checkbox-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.filter-checkbox-label {
    font-size: 14px;
    color: #555;
    flex: 1;
}

.filter-brand-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.filter-checkbox.kh-unavailable { display: none; }
.filter-group.kh-empty-group    { display: none; }

.filter-checkbox.checked .filter-checkbox-label {
    color: #0f4f59;
    font-weight: 500;
}

/* ========================================
   Price Range Slider
   ======================================== */

.prs-wrap { padding: 2px 0 4px; }

.prs-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 11.5px;
    color: #374151;
}

.prs-labels b {
    color: #0f4f59;
    font-weight: 700;
}

.prs-unit {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 10px;
}

.prs-track-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    padding: 0 2px;
}

.prs-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #dde3e8;
    border-radius: 2px;
}

.prs-fill {
    position: absolute;
    height: 100%;
    background: #0f4f59;
    border-radius: 2px;
}

.prs-thumb {
    position: absolute;
    width: 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
}

.prs-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0f4f59;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(15, 79, 89, 0.35);
    cursor: pointer;
    pointer-events: all;
}

.prs-thumb::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0f4f59;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(15, 79, 89, 0.35);
    cursor: pointer;
    pointer-events: all;
}

.prs-thumb::-webkit-slider-runnable-track { background: transparent; }
.prs-thumb::-moz-range-track { background: transparent; }

/* ========================================
   Filter Actions
   ======================================== */

.filter-actions {
    width: 100%;
    flex-shrink: 0;
    margin: 0;
    padding: 20px 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-apply-filters,
.btn-clear-filters {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-apply-filters {
    background: #0f4f59;
    color: #fff;
    border: none;
}

.btn-apply-filters:hover {
    background: #0a3a42;
}

.btn-clear-filters {
    background: transparent;
    color: #0f4f59;
    border: 1px solid #0f4f59;
}

.btn-clear-filters:hover {
    background: #f5f5f5;
}


/* ========================================
   Sorting Bar
   ======================================== */

.sorting-bar {
    position: sticky;
    top: 80px;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 10px 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    z-index: 100;
}

.sorting-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.sorting-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #0f4f59;
    white-space: nowrap;
}

.sorting-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-option {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-option:hover {
    background: #e8f5f3;
    border-color: #0f4f59;
    color: #0f4f59;
}

.sort-option.active {
    background: #0f4f59;
    border-color: #0f4f59;
    color: #e8f5f3;
    font-weight: 600;
}

.sort-option.active:hover {
    color: #e8f5f3;
}

.results-count {
    font-size: 14px;
    color: #0f4f59;
    font-weight: 500;
    white-space: nowrap;
    margin-right: auto;
}
