/* ============================================================
   Auswahlfelder (static/scripts/auswahlfeld.js)
   ------------------------------------------------------------
   Ersetzt <select data-auswahlfeld> durch einen Knopf mit
   durchscheinender Liste – im selben Glas-Stil wie die Menüs
   der Navigationsleiste. Ohne JavaScript bleibt das <select>.
   ============================================================ */

.auswahlfeld {
    position: relative;
    min-width: 0;
}

.auswahlfeld-original {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.auswahlfeld-knopf {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;

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

    font: inherit;
    font-size: 15px;
    line-height: 1.3;
    text-align: left;
    color: var(--farbe-text);

    background-color: var(--farbe-oberflaeche);
    border: 1px solid var(--farbe-rahmen-stark);
    border-radius: var(--radius-normal);

    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auswahlfeld-knopf:hover {
    border-color: var(--farbe-text-dezent);
}

.auswahlfeld-knopf:focus-visible,
.auswahlfeld.offen .auswahlfeld-knopf {
    outline: none;
    border-color: var(--farbe-primaer);
    box-shadow: 0 0 0 3px var(--farbe-primaer-hell);
}

.auswahlfeld-wert {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auswahlfeld-knopf .symbol {
    flex: 0 0 auto;
    color: var(--farbe-text-sekundaer);
    transition: transform 0.2s ease;
}

.auswahlfeld.offen .auswahlfeld-knopf .symbol {
    transform: rotate(180deg);
}

.auswahlfeld-liste {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 70;

    width: max(100%, 240px);
    max-width: calc(100vw - 24px);
    max-height: 340px;
    padding: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;

    display: none;
    flex-direction: column;

    background-color: var(--glas-hintergrund-dicht);
    -webkit-backdrop-filter: var(--glas-blur);
    backdrop-filter: var(--glas-blur);
    border: 1px solid var(--farbe-rahmen-stark);
    border-radius: var(--radius-gross);
    box-shadow: var(--schatten-gross);
    outline: none;
}

.auswahlfeld-liste.auswahlfeld-breit {
    width: max(100%, 340px);
}

.auswahlfeld-liste.auswahlfeld-rechts {
    left: auto;
    right: 0;
}

.auswahlfeld.offen .auswahlfeld-liste {
    display: flex;
    animation: menue-einblenden 0.16s ease-out;
}

.auswahlfeld-gruppe {
    padding: 10px 12px 4px;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--farbe-text-sekundaer);
}

.auswahlfeld-option {
    padding: 9px 12px;

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

    font-size: 15px;
    line-height: 1.35;
    color: var(--farbe-text);

    border-radius: var(--radius-normal);
    cursor: pointer;
}

.auswahlfeld-option.markiert {
    background-color: var(--farbe-oberflaeche-dezent);
}

.auswahlfeld-option .symbol {
    flex: 0 0 auto;
    color: var(--farbe-link);
    visibility: hidden;
}

.auswahlfeld-option[aria-selected="true"] {
    font-weight: 700;
}

.auswahlfeld-option[aria-selected="true"] .symbol {
    visibility: visible;
}

.auswahlfeld-option[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

@keyframes menue-einblenden {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
