
/* =========================================================
   TSV – Allgemeine Filterelemente
   ========================================================= */

.tsv-filter-wrapper {
    margin-bottom: 1.5rem;
}


/* =========================================================
   Filterkopf
   ========================================================= */

.tsv-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}


/* =========================================================
   Filter-Button
   ========================================================= */

.tsv-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    cursor: pointer;
}


/* Pfeil */

/* =========================================================
   Pfeil hinter dem Filter-Button
   ========================================================= */

.tsv-filter-toggle-arrow {
    display: inline-block;

    width: 9px;
    height: 9px;

    flex-shrink: 0;

    margin-left: 0.5rem;

    border-right: 2px solid #777;
    border-bottom: 2px solid #777;

    transform: rotate(45deg);

    transition: transform 0.25s ease;

    position: relative;
    top: -2px;
}


/* =========================================================
   Pfeil nach oben bei geöffnetem Filter
   ========================================================= */

.tsv-filter-wrapper:has(.tsv-filter-container.is-open)
.tsv-filter-toggle-arrow {

    transform: rotate(225deg);

    top: 2px;
}

/* =========================================================
   Filterbereich
   ========================================================= */

.tsv-filter-container {
    max-height: 0;
    opacity: 0;

    overflow: hidden;

    margin-top: 0;
    padding: 0;

    background-color: #f8f9fa;

    border: 0 solid #e5e5e5;
    border-radius: 6px;

    transition:
        max-height 0.4s ease,
        opacity 0.3s ease,
        margin-top 0.4s ease,
        padding 0.4s ease,
        border-width 0.4s ease;
}

.tsv-filter-container > form {
    min-height: 0;
}


/* Geöffnet */

.tsv-filter-container.is-open {
    max-height: 2000px;
    opacity: 1;

    overflow: visible;

    margin-top: 1rem;
    padding: 0.75rem;

    border-width: 1px;
}

/* Pfeil drehen */

.tsv-filter-wrapper:has(.tsv-filter-container.is-open)
.tsv-filter-toggle-arrow {
    transform: rotate(225deg);
}


/* =========================================================
   Mehrfachauswahl
   ========================================================= */

.tsv-multi-select {
    position: relative;
    width: 100%;
}


/* Auswahlfeld */

.tsv-multi-select-toggle {
    width: 100%;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0.35rem 0.65rem;

    background: #fff;
    color: #444;

    border: 1px solid #ccc;
    border-radius: 3px;

    font-size: 0.9rem;
    text-align: left;

    cursor: pointer;
}

.tsv-multi-select-toggle:hover {
    border-color: #999;
}

.tsv-multi-select.open .tsv-multi-select-toggle {
    border-color: #999;
}


/* Pfeil */

.tsv-multi-select-arrow {
    width: 8px;
    height: 8px;
    margin-left: 1rem;

    border-right: 2px solid #777;
    border-bottom: 2px solid #777;

    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.tsv-multi-select.open .tsv-multi-select-arrow {
    transform: rotate(225deg);
}


/* Dropdown */

.tsv-multi-select-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;

    z-index: 1000;

    display: none;

    max-height: calc(5 * 36px);
    overflow-y: auto;

    padding: 0;

    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.tsv-multi-select.open .tsv-multi-select-dropdown {
    display: block;
}


/* Einzelne Auswahl */

.tsv-multi-option {
    display: flex;
    align-items: center;

    box-sizing: border-box;
    height: 25px;

    margin: 0;
    padding: 0 0.65rem;

    cursor: pointer;
    font-size: 0.9rem;
    color: #444;
}

.tsv-multi-option:hover {
    background: #f5f5f5;
}


/* Checkbox */

.tsv-multi-option input {
    width: 16px;
    height: 16px;
    margin: 0 0.75rem 0 0 !important;
    accent-color: #c00000;
    cursor: pointer;
}


/* =========================================================
   Normale Select-Felder
   ========================================================= */

.tsv-filter-control .form-select {
    width: 100%;
    height: 38px;

    padding: 0.35rem 2.25rem 0.35rem 0.65rem;

    background-color: #fff;
    color: #444;

    border: 1px solid #ccc;
    border-radius: 3px;

    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: none;
}

.tsv-filter-control .form-select:hover {
    border-color: #999;
}

.tsv-filter-control .form-select:focus {
    border-color: #999;
    outline: none;
    box-shadow: none;
}


/* =========================================================
   Sortierauswahl
   ========================================================= */

.tsv-sort-select {
    width: 230px;
    height: 38px;

    padding: 0.35rem 2.25rem 0.35rem 0.65rem;

    background-color: #fff;
    color: #444;

    border: 1px solid #ccc;
    border-radius: 3px;

    cursor: pointer;
    box-shadow: none;
}

.tsv-sort-select:hover {
    border-color: #999;
}

.tsv-sort-select:focus {
    border-color: #999;
    outline: none;
    box-shadow: none;
}


/* =========================================================
   Abstände
   ========================================================= */

.tsv-filter-space {
    margin-top: 0.75rem;
}


/* =========================================================
   TSV Switch
   ========================================================= */

.tsv-switch {
    position: relative;

    display: inline-flex;
    align-items: center;

    gap: 0.65rem;

    cursor: pointer;
    user-select: none;
}


/* Versteckte Checkbox */

.tsv-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}


/* Schalter */

.tsv-switch-slider {
    position: relative;

    width: 42px;
    height: 24px;

    flex-shrink: 0;

    background-color: #ccc;
    border-radius: 24px;

    transition: background-color 0.2s ease;
}


/* Kreis */

.tsv-switch-slider::before {
    content: "";

    position: absolute;

    width: 18px;
    height: 18px;

    left: 3px;
    top: 3px;

    background-color: #fff;
    border-radius: 50%;

    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);

    transition: transform 0.2s ease;
}


/* Aktiv */

.tsv-switch input:checked + .tsv-switch-slider {
    background-color: #c00000;
}

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


/* Tastatur-Fokus */

.tsv-switch input:focus-visible + .tsv-switch-slider {
    outline: 2px solid #999;
    outline-offset: 2px;
}


/* Text */

.tsv-switch-text {
    line-height: 1.5 !important;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

/* Such-Button */

.tsv-filter-form button[type="submit"] {
    background-color: #c00000;
    border-color: #c00000;
    color: #fff;
}

/* Hover-Effekt */

.tsv-filter-form button[type="submit"]:hover {
    background-color: #a00000;
    border-color: #a00000;
}

/* Tastatur-Fokus */

.tsv-filter-form button[type="submit"]:focus {
    background-color: #a00000;
    border-color: #a00000;
    box-shadow: 0 0 0 0.2rem rgba(192, 0, 0, 0.25);
}

/* =========================================================
   Smartphone
   ========================================================= */

@media (max-width: 767px) {

    .tsv-filter-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tsv-sort-select {
        order: 1;
        width: 100%;
        height: 40px;
    }

    .tsv-filter-toggle {
        order: 2;
    }

    .tsv-filter-control .form-select {
        height: 40px;
        font-size: 0.95rem;
    }

    .tsv-multi-select-toggle {
        height: 40px;
        font-size: 0.95rem;
    }

    .tsv-multi-option {
        padding: 0.55rem 0.65rem;
        font-size: 0.95rem;
    }
}


/* =========================================================
   Druck
   ========================================================= */

@media print {
    .tsv-filter-wrapper {
        display: none !important;
    }
}
