/**
 * com.on WooCommerce – Produktfilter.
 *
 * Neutral gestaltet, Farben und Radien über CSS-Variablen, die das Theme
 * an :root oder .comon-filter setzt.
 */

.comon-filter,
.comon-filter-ausloeser {
    --comon-filter-text: #1d1d1b;
    --comon-filter-leise: #6b6f6c;
    --comon-filter-linie: #e6e3da;
    --comon-filter-flaeche: #fff;
    --comon-filter-akzent: #184328;
    --comon-filter-akzent-text: #fff;
    --comon-filter-radius: 999px;
    --comon-filter-feld-radius: 8px;

    color: var(--comon-filter-text);
}

.comon-filter__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html.comon-filter-laedt [data-comon-filter-ergebnis] {
    opacity: .45;
    transition: opacity .15s ease;
    pointer-events: none;
}

/* ---------- Kopf, Knopf für das Handy ---------- */

.comon-filter__oeffnen,
.comon-filter__kopf .comon-filter__schliessen {
    display: none;
}

.comon-filter__titel {
    margin: 0 0 10px;
    font-size: 1.4em;
    font-weight: 700;
}

/* ---------- Aktive Filter ---------- */

.comon-filter__aktiv {
    margin: 0 0 18px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--comon-filter-linie);
}

.comon-filter__aktiv-titel {
    margin: 0 0 8px;
    font-size: .8em;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--comon-filter-leise);
}

.comon-filter__aktiv ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

.comon-filter__aktiv li {
    margin: 0;
    padding: 0;
}

.comon-filter__aktiv li::before {
    display: none;
}

.comon-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    border-radius: var(--comon-filter-radius);
    background: var(--comon-filter-akzent);
    color: var(--comon-filter-akzent-text);
    font-size: .85em;
    line-height: 1.2;
    text-decoration: none;
}

.comon-filter__chip:hover,
.comon-filter__chip:focus-visible {
    color: var(--comon-filter-akzent-text);
    filter: brightness(1.15);
}

.comon-filter__zuruecksetzen {
    font-size: .85em;
    color: var(--comon-filter-akzent);
}

/* ---------- Facetten ---------- */

.comon-filter__facette {
    min-width: 0;
    margin: 0 0 6px;
    padding: 0 0 6px;
    border: 0;
    border-bottom: 1px solid var(--comon-filter-linie);
}

.comon-filter__legende {
    width: 100%;
    margin: 0;
    padding: 0;
    float: left; /* legend sonst nicht in voller Breite */
}

.comon-filter__legende + * {
    clear: both;
}

.comon-filter__umschalten {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.comon-filter__umschalten svg {
    flex: 0 0 16px;
    transition: transform .2s ease;
}

.comon-filter__umschalten[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}

.comon-filter__inhalt {
    padding: 0 0 12px;
}

.comon-filter__inhalt[hidden] {
    display: none;
}

/* Liste (Kästchen) */
.comon-filter__liste {
    margin: 0;
    padding: 0;
    list-style: none;
}

.comon-filter__option {
    margin: 0;
    padding: 0 0 0 calc(var(--tiefe, 0) * 16px);
}

.comon-filter__option::before {
    display: none;
}

.comon-filter__option[hidden] {
    display: none;
}

.comon-filter__option label,
.comon-filter__schalter {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    cursor: pointer;
}

.comon-filter__option.is-leer label {
    opacity: .45;
    cursor: default;
}

.comon-filter__option input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--comon-filter-akzent);
}

.comon-filter__text {
    flex: 1;
    min-width: 0;
}

.comon-filter__zahl {
    min-width: 26px;
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--comon-filter-linie);
    color: var(--comon-filter-leise);
    font-size: .78em;
    text-align: center;
}

.comon-filter__mehr {
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--comon-filter-akzent);
    font: inherit;
    font-size: .9em;
    text-decoration: underline;
    cursor: pointer;
}

/* Knöpfe */
.comon-filter__facette--knoepfe .comon-filter__liste {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comon-filter__facette--knoepfe .comon-filter__option {
    padding: 0;
}

.comon-filter__facette--knoepfe .comon-filter__option label {
    position: relative;
    min-height: 0;
    padding: 6px 12px;
    border: 1px solid var(--comon-filter-linie);
    border-radius: var(--comon-filter-radius);
    background: var(--comon-filter-flaeche);
    font-size: .9em;
}

.comon-filter__facette--knoepfe .comon-filter__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.comon-filter__facette--knoepfe .comon-filter__option input:checked + .comon-filter__text {
    font-weight: 700;
}

.comon-filter__facette--knoepfe .comon-filter__option label:has(input:checked) {
    border-color: var(--comon-filter-akzent);
    background: var(--comon-filter-akzent);
    color: var(--comon-filter-akzent-text);
}

.comon-filter__facette--knoepfe .comon-filter__option label:has(input:focus-visible) {
    outline: 2px solid var(--comon-filter-akzent);
    outline-offset: 2px;
}

.comon-filter__facette--knoepfe .comon-filter__zahl {
    display: none;
}

/* Auswahlliste */
.comon-filter__facette--auswahl select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--comon-filter-linie);
    border-radius: var(--comon-filter-feld-radius);
    background-color: var(--comon-filter-flaeche);
}

/* Schalter */
.comon-filter__schalter input {
    position: absolute;
    opacity: 0;
}

.comon-filter__schalter-spur {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--comon-filter-linie);
    transition: background .15s ease;
}

.comon-filter__schalter-spur::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    content: '';
    transition: transform .15s ease;
}

.comon-filter__schalter input:checked + .comon-filter__schalter-spur {
    background: var(--comon-filter-akzent);
}

.comon-filter__schalter input:checked + .comon-filter__schalter-spur::after {
    transform: translateX(18px);
}

.comon-filter__schalter input:focus-visible + .comon-filter__schalter-spur {
    outline: 2px solid var(--comon-filter-akzent);
    outline-offset: 2px;
}

/* Bereich */
.comon-filter__schieber {
    position: relative;
    height: 28px;
    margin: 4px 9px 10px;
}

.comon-filter__schieber::before,
.comon-filter__schieber::after {
    position: absolute;
    top: 12px;
    height: 4px;
    border-radius: 2px;
    content: '';
}

.comon-filter__schieber::before {
    right: 0;
    left: 0;
    background: var(--comon-filter-linie);
}

.comon-filter__bereich .comon-filter__schieber::after {
    left: var(--von, 0%);
    right: calc(100% - var(--bis, 100%));
    background: var(--comon-filter-akzent);
}

.comon-filter__schieber input[type="range"] {
    position: absolute;
    top: 0;
    left: -9px;
    width: calc(100% + 18px);
    height: 28px;
    margin: 0;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.comon-filter__schieber input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
}

.comon-filter__schieber input[type="range"]::-webkit-slider-thumb {
    position: relative;
    z-index: 2;
    width: 18px;
    height: 18px;
    margin-top: 0;
    border: 2px solid var(--comon-filter-akzent);
    border-radius: 50%;
    background: #fff;
    pointer-events: auto;
    cursor: pointer;
    -webkit-appearance: none;
}

.comon-filter__schieber input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--comon-filter-akzent);
    border-radius: 50%;
    background: #fff;
    pointer-events: auto;
    cursor: pointer;
}

.comon-filter__felder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.comon-filter__felder label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--comon-filter-linie);
    border-radius: var(--comon-filter-feld-radius);
    background: var(--comon-filter-flaeche);
    font-size: .85em;
}

.comon-filter__felder label > span:first-child {
    color: var(--comon-filter-leise);
}

.comon-filter__felder input {
    width: 100%;
    min-width: 0;
    padding: 8px 0;
    border: 0;
    background: transparent;
    font: inherit;
    -moz-appearance: textfield;
}

.comon-filter__felder input::-webkit-outer-spin-button,
.comon-filter__felder input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.comon-filter__felder label:focus-within {
    border-color: var(--comon-filter-akzent);
}

.comon-filter__einheit {
    color: var(--comon-filter-leise);
    white-space: nowrap;
}

/* Fuß: mit JavaScript nur im Handy-Panel */
.comon-filter__fuss {
    margin-top: 16px;
}

.comon-filter.is-js:not(.is-mobil) .comon-filter__fuss {
    display: none;
}

.comon-filter__anwenden {
    width: 100%;
}

/* ---------- Handy: Knopf + Panel ---------- */

.comon-filter-ausloeser {
    margin: 0 0 20px;
}

.comon-filter-ausloeser[hidden],
.comon-filter.is-mobil.hat-ausloeser .comon-filter__oeffnen {
    display: none;
}

.comon-filter.hat-ausloeser .comon-filter__oeffnen + .comon-filter__panel {
    margin: 0;
}

.comon-filter-ausloeser__knopf,

.comon-filter.is-mobil .comon-filter__oeffnen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 18px;
    border: 1px solid var(--comon-filter-akzent);
    border-radius: var(--comon-filter-radius);
    background: var(--comon-filter-flaeche);
    color: var(--comon-filter-akzent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.comon-filter__anzahl-aktiv {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--comon-filter-akzent);
    color: var(--comon-filter-akzent-text);
    font-size: .8em;
    line-height: 20px;
    text-align: center;
}

.comon-filter.is-mobil .comon-filter__panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    width: min(400px, 92vw);
    background: var(--comon-filter-flaeche);
    box-shadow: 10px 0 30px rgba(0, 0, 0, .15);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
    outline: 0;
}

.comon-filter.is-mobil.is-offen .comon-filter__panel {
    transform: none;
    visibility: visible;
    transition: transform .25s ease, visibility 0s;
}

.comon-filter.is-mobil.is-offen::before {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, .45);
    content: '';
}

html.comon-filter-panel-offen {
    overflow: hidden;
}

.comon-filter.is-mobil .comon-filter__kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--comon-filter-linie);
}

.comon-filter.is-mobil .comon-filter__titel {
    margin: 0;
}

.comon-filter.is-mobil .comon-filter__kopf .comon-filter__schliessen {
    display: inline-flex;
    padding: 6px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.comon-filter.is-mobil .comon-filter__form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 20px 0;
}

.comon-filter.is-mobil .comon-filter__fuss {
    position: sticky;
    bottom: 0;
    margin: auto -20px 0;
    padding: 14px 20px;
    border-top: 1px solid var(--comon-filter-linie);
    background: var(--comon-filter-flaeche);
}

@media (prefers-reduced-motion: reduce) {
    .comon-filter.is-mobil .comon-filter__panel,
    .comon-filter__umschalten svg,
    .comon-filter__schalter-spur,
    .comon-filter__schalter-spur::after {
        transition: none;
    }
}

/* ---------- Schutz gegen Theme-Stile ----------
   Viele Themes verstecken Kästchen und zeichnen eigene über „input + span“.
   Der Filter bringt eigene Bedienelemente mit; diese Regeln sind bewusst
   spezifischer als typische Theme-Regeln (.content input[type=checkbox]). */

.comon-filter .comon-filter__option input[type="checkbox"] {
    position: static;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    opacity: 1;
    -webkit-appearance: checkbox;
    appearance: auto;
}

.comon-filter .comon-filter__option input[type="checkbox"] + span,
.comon-filter .comon-filter__schalter input[type="checkbox"] + span {
    float: none;
    margin: 0;
}

.comon-filter .comon-filter__option input[type="checkbox"] + span::before,
.comon-filter .comon-filter__schalter input[type="checkbox"] + span::before,
.comon-filter .comon-filter__option input[type="checkbox"] + span::after,
.comon-filter .comon-filter__schalter input[type="checkbox"] + span::after {
    display: none;
}

.comon-filter .comon-filter__schalter input[type="checkbox"] + .comon-filter__schalter-spur::after {
    display: block;
}

.comon-filter.comon-filter .comon-filter__facette--knoepfe .comon-filter__option input[type="checkbox"],
.comon-filter.comon-filter .comon-filter__schalter input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.comon-filter .comon-filter__liste,
.comon-filter .comon-filter__aktiv ul {
    margin-left: 0;
    padding-left: 0;
}

.comon-filter .comon-filter__liste li,
.comon-filter .comon-filter__aktiv li {
    margin-left: 0;
    margin-bottom: 0;
}

.comon-filter .comon-filter__facette--knoepfe .comon-filter__liste li {
    margin: 0;
}
