/* --------------------------------------------------------------------------
   Sprachumschalter (Login-Seite + Dashboard-Header)
   Komponente: nativer Select, optisch als Pille mit Globus-Icon.
   Die Funktions-Attribute (data-language-select, onchange) bleiben
   unveraendert, i18n.js synchronisiert weiter alle Umschalter.
   -------------------------------------------------------------------------- */

.sf-lang-switch {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    display: inline-block;
    min-width: 118px;
    padding: 8px 34px 8px 38px;

    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;

    background-color: rgba(255, 255, 255, 0.08);
    /* Landesflagge der eingestellten Sprache (via data-lang gesetzt),
       rechts der Auswahl-Pfeil */
    background-image:
        var(--sf-lang-flag, none),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat, no-repeat;
    background-position: left 12px center, right 12px center;
    background-size: 18px 12px, 12px 12px;

    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;

    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Landesflaggen (data-lang wird von i18n.js/syncSelects gepflegt) */
.sf-lang-switch[data-lang="de"] {
    --sf-lang-flag: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'><rect width='24' height='16' fill='%23000'/><rect y='5.33' width='24' height='5.34' fill='%23dd0000'/><rect y='10.67' width='24' height='5.33' fill='%23ffce00'/></svg>");
}

.sf-lang-switch[data-lang="en"] {
    --sf-lang-flag: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'><rect width='24' height='16' fill='%23012169'/><path d='M0 0L24 16 M24 0L0 16' stroke='%23ffffff' stroke-width='3'/><path d='M0 0L24 16 M24 0L0 16' stroke='%23c8102e' stroke-width='1.4'/><path d='M12 0V16 M0 8H24' stroke='%23ffffff' stroke-width='5'/><path d='M12 0V16 M0 8H24' stroke='%23c8102e' stroke-width='2.6'/></svg>");
}

.sf-lang-switch:hover {
    background-color: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.45);
}

.sf-lang-switch:focus-visible {
    outline: none;
    border-color: var(--sf-primary, #0080ff);
    box-shadow: 0 0 0 3px var(--sf-primary-ring, rgba(79, 70, 229, 0.16));
}

/*
 | Aufklapp-Liste immer hell rendern: der native Popup-Dialog uebernimmt
 | sonst die dunkle Vordergrundfarbe und bleibt weisse Schrift auf
 | weissem Grund.
 */
.sf-lang-switch option {
    color: #1f2937;
    background: #ffffff;
}

/* --------------------------------------------------------------------------
   Helle Variante (Login / Register / Forgot Password)
   -------------------------------------------------------------------------- */

.sf-lang-switch--light {
    width: 100%;
    background-color: #ffffff;
    border-color: #d7dce5;
    color: #1f2937;
    background-image:
        var(--sf-lang-flag, none),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.sf-lang-switch--light:hover {
    background-color: #ffffff;
    border-color: #4f46e5;
}

.sf-lang-switch--light:focus-visible {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

/* --------------------------------------------------------------------------
   Ausrichtung im Dashboard-Header: ganz rechts, vertikal zentriert
   (Header ist position:relative, Mandant-Switcher sitzt per absolute links)
   -------------------------------------------------------------------------- */

.dashboard-language-switcher {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

/* Schmal: absolute Position wuerde die Seitentitel-Zeile ueberlagern —
   dann wieder im normalen Fluss hinter dem Titel */
@media (max-width: 700px) {
    .dashboard-language-switcher {
        position: static;
        transform: none;
        margin-left: 12px;
    }
}
