.reset-button {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: #4b5563;
    transition: all 0.2s;
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.reset-button:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.reset-button:active {
    transform: translateY(0);
}

.reset-button-icon {
    font-size: 1.1rem;
}

.sorting-group {
    display: flex;
    gap: 0.5rem;
    padding-right: 1rem;
    border-right: 1px solid #e5e7eb;
}

.desktop-filters {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000; /* High z-index to stay above everything */
    /* Height is now dynamic based on content */
}

.filters-container {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-reviews,
.group-stars {
    flex: 1 1 180px;
    max-width: 220px;
}

.media-group {
    flex: 10 1 300px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.media-group label {
    margin-bottom: 0;
    margin-right: 0.5rem;
}

.group-favorites {
    margin-left: auto;
    align-self: center;
}

.filter-icon {
    font-size: 1.1em;
}

.sort-icon {
    font-size: 1.1em;
    opacity: 0.7;
}

.toggle-label {
    font-size: 0.9em;
    color: #495057;
    font-weight: 500;
}

.filter-group label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.facet-options, .media-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.media-filter-btn {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.3rem;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    color: #333;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.media-filter-btn:hover {
    border-color: #667eea;
    background: #f0e6ff;
    transform: translateY(-1px);
}

.media-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.facet-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.facet-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.facet-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #7c3aed;
}

.facet-count {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Slider for star filter */
.slider-container {
    padding: 0;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    outline: none;
    border-radius: 3px;
    margin: 0.5rem 0;
    cursor: pointer;
}

.slider:hover {
    background: #d1d5db;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #8b5cf6;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 600;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0; width: 0; height: 0;
}

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

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

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

/* Mobile Filters */
.mobile-filter {
    display: none;
}

/* Narrow desktop / tablet landscape: let the filter bar wrap instead of overflowing */
@media (max-width: 1200px) {
    .desktop-filters {
        flex-wrap: wrap;
    }

    .filters-container {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .desktop-filters {
        display: none !important;
    }

    .mobile-filter {
        display: block !important;
        margin: 0.5rem 0.5rem 1rem 0.5rem;
        position: sticky;
        top: 0.5rem;
        z-index: 200;
        background: transparent;
        padding: 0;
        transition: top 0.2s ease;
    }

    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
        border: none;
        padding: 0.875rem 1.25rem;
        width: 100%;
        border-radius: 0.75rem;
        box-shadow: 0 0.25rem 0.5rem rgba(139, 92, 246, 0.3);
        cursor: pointer;
        font-size: 1em;
        font-weight: 700;
        color: white;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
    }

    .mobile-filter-toggle:active {
        transform: translateY(2px);
        box-shadow: 0 0.125rem 0.25rem rgba(139, 92, 246, 0.3);
    }

    .toggle-icon {
        font-size: 1.2em;
        transition: transform 0.3s ease;
    }

    .mobile-filter.collapsed .toggle-icon {
        transform: rotate(180deg);
    }

    .mobile-filters-container {
        background: white;
        border: 2px solid #8b5cf6;
        padding: 1rem 1.25rem;
        border-radius: 0.75rem;
        margin-top: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(139, 92, 246, 0.15);
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        max-height: 2000px;
        overflow: hidden;
        transition: all 0.3s ease-in-out;
        opacity: 1;
    }

    .mobile-filter.collapsed .mobile-filters-container {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        opacity: 0;
        border-width: 0;
        pointer-events: none;
    }

    .mobile-reset-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
        border: none;
        padding: 0.875rem 1.25rem;
        width: calc(100% - 1rem);
        margin: 0.5rem 0.5rem 0 0.5rem;
        border-radius: 0.75rem;
        box-shadow: 0 0.25rem 0.5rem rgba(245, 158, 11, 0.3);
        cursor: pointer;
        font-size: 1em;
        font-weight: 700;
        color: white;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        position: sticky;
        top: 4rem;
        z-index: 199;
    }

    .mobile-filter-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-filter-group.mobile-filter-inline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .mobile-filter-group label {
        font-size: 0.9em;
        font-weight: 600;
        color: #333;
    }

    .mobile-filter-group label strong {
        display: inline-block;
        min-width: 5.5em;
        text-align: left;
    }

    /* Wrap media buttons on mobile */
    .mobile-filter-group .media-filter-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.6rem;
        margin-top: 0.25rem;
    }

    /* 44px minimum touch targets */
    .media-filter-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.9rem;
        font-size: 0.9rem;
    }

    .mobile-stepper {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        justify-content: flex-end;
    }

    .stepper-btn {
        width: 44px;
        height: 44px;
        border: 2px solid #8b5cf6;
        background: white;
        border-radius: 8px;
        font-size: 1.5em;
        font-weight: bold;
        color: #8b5cf6;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }

    .stepper-btn:active {
        background: #8b5cf6;
        color: white;
        transform: scale(0.95);
    }

    .stepper-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

    .stepper-value {
        min-width: 60px;
        text-align: center;
        font-weight: 600;
        font-size: 1em;
        color: #333;
    }

    .mobile-sort-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: white;
        border: 1px solid #ddd;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        font-size: 0.9em;
        font-weight: 700;
        color: #333;
        cursor: pointer;
        width: 100%;
        transition: all 0.2s;
    }

    .mobile-sort-button:active {
        background: #f0f0f0;
        transform: translateY(2px);
    }
}

/* Star filter dimming */
.dimmed {
    opacity: 0.5 !important;
    transition: opacity 0.2s ease;
}

tr.dimmed {
    display: none !important;
}
