/**
 * Language picker — flag + name list in the Options « Profil » screen.
 * Rendered by initLanguageDropdown() (index-auth.js) into #profileLanguage.
 *
 * Replaces a 2-line <select>: the language screen is dedicated and mostly
 * empty, so the 8 choices (System + 7 locales) are all exposed at once —
 * one click instead of open-scan-pick.
 *
 * All colors come from the --izi-* tokens (base.css), which swap to dark
 * values under body.theme-dark / prefers-color-scheme with theme-auto.
 */

.lang-list {
    display: grid;
    /* Two columns when the modal is wide enough, one when it is not.
       8 entries in a single column would run past the fold. */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--izi-space-sm);
    margin-top: var(--izi-space-sm);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: var(--izi-space-md);
    width: 100%;
    padding: var(--izi-space-sm) var(--izi-space-md);
    background: var(--izi-bg);
    border: 1px solid var(--izi-border);
    border-radius: var(--izi-radius-md);
    color: var(--izi-text);
    font-family: inherit;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.lang-option:hover {
    background: var(--izi-bg-hover);
    border-color: var(--izi-border-strong);
}

.lang-option:focus-visible {
    outline: 2px solid var(--izi-primary);
    outline-offset: 2px;
}

/* Selected: filled accent rather than a checkmark — the whole row reads as
   "on" at a glance, which a trailing glyph does not. */
.lang-option.is-active {
    background: var(--izi-primary);
    border-color: var(--izi-primary);
    color: var(--izi-on-primary);
    font-weight: 600;
}

.lang-option.is-active:hover {
    background: var(--izi-primary);
    border-color: var(--izi-primary);
}

/* flag-icons draws the flag as a background image on this span, so it needs
   explicit box dimensions and must not be squeezed by the flex row. */
.lang-option-flag {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.125rem;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* The « System » entry uses an emoji globe, not a flag image: center the
   glyph in the same footprint so every row keeps one baseline grid. */
.lang-option-flag-system {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
    box-shadow: none;
}

.lang-option-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
