/* === Filter Component ===
 * Intent: accessible, consistent filters with custom checkbox/radio styling.
 * Note: the open/closed state on mobile is controlled via the `.open` class.
 */
.product-filters {
    background: transparent;
    padding: 0;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.product-filters h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    letter-spacing: -0.02em;
}

.product-filters h4 {
    margin: 1.5rem 0 1rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.filter-section:last-of-type {
    border-bottom: none;
}

/* Custom Toggle Switch for Checkboxes */
.filter-section label {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.filter-section label:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--glass-border);
    transform: translateX(4px);
}

/* Hide default input */
.filter-section input[type='checkbox'],
.filter-section input[type='radio'] {
    /* Custom controls (remove native styling). */
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-section input[type='radio'] {
    border-radius: 50%;
}

/* Checked State */
.filter-section input[type='checkbox']:checked,
.filter-section input[type='radio']:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Checkmark/Dot */
.filter-section input[type='checkbox']:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.filter-section input[type='radio']:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

/* Active Label Style */
.filter-section label:has(input:checked) {
    /* Uses :has() to style the label based on its input state (modern browsers). */
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Select Styling */
.filter-section select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.filter-section select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Buttons */
.btn-filter,
.btn-filter-reset {
    width: 100%;
    padding: 1rem;
    margin-top: 0.8rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.btn-filter {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-filter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-filter-reset {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.btn-filter-reset:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* === Mobile Filter Styles === */
.mobile-filter-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.mobile-filter-header h3 {
    margin: 0;
    font-size: 1.2rem;
    border: none;
    padding: 0;
}

.btn-toggle-filters {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-toggle-filters:hover {
    background: rgba(255, 255, 255, 0.15);
}

.desktop-title {
    display: block;
}

/* === Responsive === */
@media (max-width: 900px) {
    .product-filters {
        background: var(--bg-card);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--glass-border);
        border-radius: 16px;
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .mobile-filter-header {
        display: flex;
        margin-bottom: 0;
        border-bottom: none;
    }

    .product-filters.open .mobile-filter-header {
        margin-bottom: 1.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .filter-content {
        display: none;
        animation: slideDown 0.3s ease-out;
    }

    .product-filters.open .filter-content {
        display: block;
    }

    .desktop-title {
        display: none;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}