/*
 * Kopfzeile: Knopf „Flagge + Währungscode“ und Fenster „Sprache & Währung“ (Resources/views/locale-modal/modal.twig, locale-modal.js).
 * Das Fenster sitzt im Kopf (<header class="nh-header">) und erbt dessen Farben (--nh-ink, --nh-line, --nh-accent, --nh-tint); der
 * Dunkelmodus (html.nh-dark) rechnet die Farben dieser Datei wie die der Kopfzeile um, Sonderfälle stehen in dark-base.css.
 */

/* ---- Knopf in der Kopfzeile (neben Warenkorb/Anmelden): gleiche Größe wie die übrigen Knöpfe, kein Pfeil ---- */
.nh-header .nh-utility-nav .nh-lm-trigger { position: relative; gap: 7px; cursor: pointer; }
/* Trefferfläche mindestens 44 px hoch, ohne dass der Knopf größer aussieht als seine Nachbarn */
.nh-lm-trigger::after { content: ""; position: absolute; top: -4px; right: 0; bottom: -4px; left: 0; }
.nh-lm-flag { display: block; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.nh-lm-code { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---- Fenster ---- */
.nh-lm-dialog {
    width: min(440px, calc(100vw - 32px));
    max-width: none;
    max-height: none;
    padding: 0;
    margin: auto;
    border: 0;
    background: transparent;
    color: var(--nh-ink, #18253f);
    overflow: visible; /* die Auswahllisten ragen über den Rand der Karte hinaus */
    font-size: 15px;
    line-height: 1.4;
    font-weight: 400;
    text-align: left;
}
.nh-lm-dialog::backdrop { background: rgba(24, 37, 63, .5); }
.nh-lm-dialog[open] { animation: nh-lm-in .16s ease-out; }
@keyframes nh-lm-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.nh-lm-panel {
    border: 1px solid var(--nh-line, #e5e9f0);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(24, 37, 63, .16);
}

/* Kopf: Symbol, Titel, Schließen */
.nh-lm-head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 18px; border-bottom: 1px solid var(--nh-line, #e5e9f0); }
.nh-lm-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; background: var(--nh-tint, #f3f6fb); color: var(--nh-accent, #2558d9); }
.nh-lm-icon svg, .nh-lm-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nh-lm-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--nh-ink, #18253f); }
.nh-lm-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--nh-muted, #5c687c); cursor: pointer; }
.nh-lm-close:hover { background: var(--nh-tint, #f3f6fb); color: var(--nh-ink, #18253f); }

/* Abschnitte */
.nh-lm-body { padding: 18px 18px 20px; }
.nh-lm-section + .nh-lm-section { margin-top: 18px; }
.nh-lm-label { display: block; margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--nh-muted, #5c687c); }

/* Auswahlfeld */
.nh-lm-select { position: relative; }
.nh-lm-field {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px;
    border: 1px solid #cbd3e0; border-radius: 10px; background: #fff; color: var(--nh-ink, #18253f);
    font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.nh-lm-field:hover { border-color: var(--nh-accent, #2558d9); }
.nh-lm-select.is-open .nh-lm-field { border-color: var(--nh-accent, #2558d9); box-shadow: 0 0 0 3px rgba(37, 88, 217, .14); }
.nh-lm-field .nh-lm-flag, .nh-lm-opt .nh-lm-flag { width: 22px; height: 22px; }
.nh-lm-field-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-lm-chev { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: var(--nh-muted, #5c687c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nh-lm-select.is-open .nh-lm-chev { transform: rotate(180deg); }

/* Liste (öffnet nach unten; locale-modal.js setzt is-up und die Höhe, wenn unten zu wenig Platz ist) */
.nh-lm-list {
    position: absolute; z-index: 3; left: 0; right: 0; top: calc(100% + 6px);
    margin: 0; padding: 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; max-height: 380px;
    border: 1px solid var(--nh-line, #e5e9f0); border-radius: 12px; background: #fff; box-shadow: 0 10px 24px rgba(24, 37, 63, .14);
    outline: none;
}
.nh-lm-select.is-up .nh-lm-list { top: auto; bottom: calc(100% + 6px); }
.nh-lm-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--nh-ink, #18253f); font-size: 15px; font-weight: 500; cursor: pointer; }
.nh-lm-opt-text { flex: 1 1 auto; min-width: 0; }
.nh-lm-opt.is-active { background: var(--nh-tint, #f3f6fb); }
.nh-lm-opt[aria-selected="true"] { color: var(--nh-accent, #2558d9); font-weight: 700; }
.nh-lm-check { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.nh-lm-opt[aria-selected="true"] .nh-lm-check { visibility: visible; }
.nh-lm-list:focus-visible { box-shadow: 0 0 0 3px rgba(37, 88, 217, .22), 0 10px 24px rgba(24, 37, 63, .14); }

/* Hinweis unten */
.nh-lm-note { margin: 18px 0 0; font-size: 13px; line-height: 1.5; color: var(--nh-muted, #5c687c); }

/* Tastaturfokus sichtbar */
.nh-lm-trigger:focus-visible, .nh-lm-close:focus-visible, .nh-lm-field:focus-visible { outline: 2px solid var(--nh-accent, #2558d9); outline-offset: 2px; }

/* Seite hinter dem Fenster: nicht rollen; Platz der Rollleiste bleibt erhalten (Wert setzt locale-modal.js), damit nichts springt */
html.nh-lm-open { overflow: hidden; }

@media (max-width: 575.98px) {
    .nh-lm-dialog { width: calc(100vw - 24px); }
    .nh-lm-body { padding: 16px 14px 18px; }
    .nh-lm-head { padding-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .nh-lm-dialog[open] { animation: none; }
    .nh-lm-field, .nh-lm-chev { transition: none; }
}
@media print { .nh-lm { display: none !important; } }
