/**
 * Webup Woo - Filters Styles
 */

/* Filters container */
.webup-woo-filters {
    background-color: var(--webup-woo-card-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

/* Filters without border */
.webup-woo-filters.no-border {
    border: none;
    border-radius: 0;
}

/* Filter group */
.webup-woo-filter-group {
    border-bottom: 1px solid var(--webup-woo-border, #e0e0e0);
}

.webup-woo-filter-group:last-child {
    border-bottom: none;
}

/* Filter group without title border */
.webup-woo-filters.no-title-border .webup-woo-filter-group {
    border-bottom: none;
}

/* Filter header/toggle */
.webup-woo-filter-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--webup-woo-text, #333333);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease;
}

.webup-woo-filter-toggle-header:hover {
    background-color: var(--webup-woo-bg-alt, #f9f9f9);
}

.webup-woo-filter-toggle-header svg {
    transition: transform 0.3s ease;
    color: var(--webup-woo-light-text, #666666);
}

.webup-woo-filter-toggle-header[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}

/* Filter content */
.webup-woo-filter-content {
    padding: 0 20px 20px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.webup-woo-filter-group.collapsed .webup-woo-filter-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Filter options (checkboxes) */
.webup-woo-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.webup-woo-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
}

.webup-woo-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Custom checkbox */
.webup-woo-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    background-color: var(--webup-woo-bg, #ffffff);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.webup-woo-filter-option:hover .webup-woo-checkbox {
    border-color: var(--webup-woo-primary, #333333);
}

.webup-woo-filter-option input[type="checkbox"]:checked + .webup-woo-checkbox {
    background-color: var(--webup-woo-primary, #333333);
    border-color: var(--webup-woo-primary, #333333);
}

.webup-woo-filter-option input[type="checkbox"]:checked + .webup-woo-checkbox::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.webup-woo-filter-label {
    flex: 1;
    font-size: 14px;
    color: var(--webup-woo-text, #333333);
    line-height: 1.3;
}

.webup-woo-filter-count {
    font-size: 12px;
    color: var(--webup-woo-light-text, #666666);
}

/* Nested filters (children) */
.webup-woo-filter-children {
    margin-left: 28px;
    margin-top: 5px;
    padding-left: 10px;
    border-left: 2px solid var(--webup-woo-border, #e0e0e0);
}

/* Color filter */
.webup-woo-filter-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.webup-woo-filter-color {
    cursor: pointer;
}

.webup-woo-filter-color input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.webup-woo-color-swatch {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--webup-woo-border, #e0e0e0);
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 2px var(--webup-woo-bg, #ffffff);
}

.webup-woo-filter-color:hover .webup-woo-color-swatch {
    transform: scale(1.1);
}

.webup-woo-filter-color input[type="checkbox"]:checked + .webup-woo-color-swatch {
    border-color: var(--webup-woo-primary, #333333);
    box-shadow: inset 0 0 0 2px var(--webup-woo-bg, #ffffff), 0 0 0 2px var(--webup-woo-primary, #333333);
}

/* Image filter */
.webup-woo-filter-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.webup-woo-filter-image {
    cursor: pointer;
}

.webup-woo-filter-image input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.webup-woo-image-swatch {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid var(--webup-woo-border, #e0e0e0);
    background-size: cover;
    background-position: center;
    transition: all 0.2s ease;
}

.webup-woo-filter-image:hover .webup-woo-image-swatch {
    transform: scale(1.05);
}

.webup-woo-filter-image input[type="checkbox"]:checked + .webup-woo-image-swatch {
    border-color: var(--webup-woo-primary, #333333);
    box-shadow: 0 0 0 2px var(--webup-woo-primary, #333333);
}

/* Range filter (price) */
.webup-woo-filter-range {
    padding: 10px 0;
}

.webup-woo-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.webup-woo-range-min,
.webup-woo-range-max {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
    color: var(--webup-woo-text, #333333);
    text-align: center;
}

.webup-woo-range-min:focus,
.webup-woo-range-max:focus {
    outline: none;
    border-color: var(--webup-woo-primary, #333333);
}

.webup-woo-range-separator {
    color: var(--webup-woo-light-text, #666666);
}

/* Range slider */
.webup-woo-range-slider {
    position: relative;
    height: 6px;
    margin: 0 8px;
}

.webup-woo-range-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--webup-woo-border, #e0e0e0);
    border-radius: 3px;
}

.webup-woo-range-progress {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: var(--webup-woo-primary, #333333);
    border-radius: 3px;
}

.webup-woo-range-input {
    position: absolute;
    top: -6px;
    width: 100%;
    height: 18px;
    background: none;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
}

.webup-woo-range-input::-webkit-slider-thumb {
    pointer-events: all;
    width: 18px;
    height: 18px;
    background-color: var(--webup-woo-primary, #333333);
    border: 2px solid var(--webup-woo-bg, #ffffff);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.webup-woo-range-input::-moz-range-thumb {
    pointer-events: all;
    width: 14px;
    height: 14px;
    background-color: var(--webup-woo-primary, #333333);
    border: 2px solid var(--webup-woo-bg, #ffffff);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Toggle filter */
.webup-woo-filter-toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 5px 0;
}

.webup-woo-filter-toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.webup-woo-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--webup-woo-border, #e0e0e0);
    border-radius: 12px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.webup-woo-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: var(--webup-woo-bg, #ffffff);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.webup-woo-filter-toggle-switch input[type="checkbox"]:checked + .webup-woo-toggle-slider {
    background-color: var(--webup-woo-primary, #333333);
}

.webup-woo-filter-toggle-switch input[type="checkbox"]:checked + .webup-woo-toggle-slider::before {
    transform: translateX(20px);
}

.webup-woo-toggle-label {
    font-size: 14px;
    color: var(--webup-woo-text, #333333);
}

/* Filter actions */
.webup-woo-filter-actions {
    padding: 15px 20px;
    border-top: 1px solid var(--webup-woo-border, #e0e0e0);
}

.webup-woo-filter-clear {
    width: 100%;
    padding: 12px 20px;
    background-color: transparent;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--webup-woo-text, #333333);
    cursor: pointer;
    transition: all 0.2s ease;
}

.webup-woo-filter-clear:hover {
    border-color: var(--webup-woo-text, #333333);
    background-color: var(--webup-woo-bg-alt, #f9f9f9);
}

/* Top filters layout */
.webup-woo-filters-top {
    margin-bottom: 25px;
}

.webup-woo-filters-top .webup-woo-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
}

.webup-woo-filters-top .webup-woo-filter-group {
    flex: 0 0 auto;
    border: none;
    position: relative;
}

.webup-woo-filters-top .webup-woo-filter-toggle-header {
    padding: 10px 15px;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    font-size: 13px;
}

.webup-woo-filters-top .webup-woo-filter-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 250px;
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--webup-woo-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 15px;
    margin-top: 5px;
    display: none;
}

.webup-woo-filters-top .webup-woo-filter-group.open .webup-woo-filter-content {
    display: block;
}

.webup-woo-filters-top .webup-woo-filter-actions {
    display: flex;
    gap: 10px;
    border: none;
    padding: 0;
    margin-left: auto;
}

.webup-woo-filters-top .webup-woo-filter-clear {
    width: auto;
    padding: 10px 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .webup-woo-filter-toggle-header {
        padding: 12px 15px;
    }

    .webup-woo-filter-content {
        padding: 0 15px 15px;
    }

    .webup-woo-filter-actions {
        padding: 12px 15px;
    }

    .webup-woo-color-swatch {
        width: 28px;
        height: 28px;
    }

    .webup-woo-image-swatch {
        width: 36px;
        height: 36px;
    }
}
