.ff-product-filter {
    position: sticky;
    top: 1rem;
}

.ff-product-filter__section {
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: .75rem;
}

.ff-product-filter__section > summary,
.ff-product-filter__categories details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
}

.ff-product-filter__section > summary::-webkit-details-marker,
.ff-product-filter__categories details > summary::-webkit-details-marker {
    display: none;
}

/* Lucide chevron-down */
.ff-product-filter__section > summary::after,
.ff-product-filter__categories details > summary::after,
.ff-product-filter__toggle::after {
    content: "";
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-left: .75rem;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform .15s;
}

.ff-product-filter__section:not([open]) > summary::after,
.ff-product-filter__categories details:not([open]) > summary::after,
.ff-product-filter__toggle.collapsed::after {
    transform: rotate(-90deg);
}

.ff-product-filter__parent {
    appearance: none;
    width: fit-content;
    padding: .25rem .5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    cursor: pointer;
    font: inherit;
    line-height: 1.25;
    transition: background-color .15s ease, color .15s ease;
}

.ff-product-filter__parent:hover,
.ff-product-filter__parent:focus-visible {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.ff-product-filter__parent[hidden] {
    display: none !important;
}

.ff-product-filter__terms {
    max-height: 13rem;
    overflow: auto;
}

.ff-product-filter__pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: .8rem;
    line-height: 1.25;
    cursor: pointer;
}

.ff-product-filter__pill:hover {
    background: var(--bs-secondary-bg);
}

.ff-product-filter__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .3rem;
    margin-left: auto;
    border-radius: 999px;
    background: var(--bs-primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
}

.ff-product-results {
    transition: opacity .15s;
}

.ff-product-results.is-loading {
    opacity: .45;
    pointer-events: none;
}

.ff-price-slider {
    position: relative;
    height: 1.5rem;
    --ff-range-start: 0%;
    --ff-range-end: 100%;
}

.ff-price-slider::before,
.ff-price-slider::after {
    content: "";
    position: absolute;
    top: .7rem;
    height: .25rem;
    border-radius: 1rem;
}

.ff-price-slider::before {
    inset-inline: 0;
    background: var(--bs-secondary-bg);
}

.ff-price-slider::after {
    left: var(--ff-range-start);
    right: calc(100% - var(--ff-range-end));
    background: var(--bs-primary);
}

.ff-price-slider__handle {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 1.5rem;
    margin: 0;
    background: transparent;
    pointer-events: none;
}

.ff-price-slider__handle::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--bs-primary);
    border-radius: 50%;
    background: var(--bs-body-bg);
    cursor: grab;
    pointer-events: auto;
}

.ff-price-slider__handle::-moz-range-thumb {
    width: .8rem;
    height: .8rem;
    border: 2px solid var(--bs-primary);
    border-radius: 50%;
    background: var(--bs-body-bg);
    cursor: grab;
    pointer-events: auto;
}

.ff-price-slider__handle::-webkit-slider-runnable-track,
.ff-price-slider__handle::-moz-range-track {
    background: transparent;
}

.ff-product-filter__choices {
    display: grid;
    grid-template-columns: repeat(var(--ff-filter-columns, 4), minmax(0, 1fr));
    gap: .5rem;
    max-height: none;
    overflow: visible;
}

.ff-product-filter__choice {
    min-width: 0;
}

.ff-product-filter__choice > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ff-product-filter__choice > label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: .35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}

.ff-product-filter__choice > input:focus-visible + label {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.ff-product-filter__choice > input:checked + label {
    border-color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
    box-shadow: inset 0 0 0 1px var(--bs-primary);
}

.ff-product-filter__choice-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ff-product-filter__choice-count {
    color: var(--bs-secondary-color);
    font-size: .75em;
    margin-left: .25rem;
}

.ff-product-filter__choices--pills {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    max-height: none;
    overflow: visible;
}

.ff-product-filter__choices--pills .ff-product-filter__choice > label {
    min-height: 0;
    border-radius: 999px;
    padding: .3rem .7rem;
}

.ff-product-filter__choices--color .ff-product-filter__choice > label {
    min-height: 0;
    padding: .2rem;
    border: 0;
    background: none;
    box-shadow: none;
}

.ff-product-filter__color-swatch {
    display: block;
    width: 2rem;
    aspect-ratio: 1;
    border: 1px solid color-mix(in srgb, #000 20%, transparent);
    border-radius: 50%;
    background: var(--ff-filter-color, #ddd);
}

.ff-product-filter__choices--color .ff-product-filter__choice > input:checked + label .ff-product-filter__color-swatch {
    outline: 2px solid var(--bs-primary);
    outline-offset: 3px;
}

.ff-product-filter__choices--image .ff-product-filter__choice > label {
    display: grid;
    gap: .3rem;
    align-content: center;
    aspect-ratio: 1;
    padding: .25rem;
}

.ff-product-filter__image {
    width: 100%;
    min-height: 0;
    aspect-ratio: 1;
    object-fit: cover;
}

.ff-product-filter__image-fallback {
    display: grid;
    width: 100%;
    aspect-ratio: 1;
    place-items: center;
    background: var(--bs-tertiary-bg);
}

.ff-attribute-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.ff-attribute-range label {
    display: grid;
    gap: .25rem;
    font-size: .8rem;
}

@media (max-width: 991.98px) {
    .ff-product-filter {
        position: static;
    }

    .ff-product-filter > .card-body {
        padding-top: 1rem;
    }
}
