/* ==========================================================================
   Cambio lingua (views/partials/_lingue.twig): bandiera + pannello delle
   lingue in griglia, come DoYouSpain. Caricato solo col multilingua acceso
   (LinguaSito::iniettaHead).
   ========================================================================== */

.ke-lingue {
    --ke-lingue-attiva: #fde68a;
    --ke-lingue-bordo: #e5e7eb;
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.ke-lingue--chiaro { color: #ffffff; }
.ke-lingue--scuro { color: #1f2937; }

.ke-lingue-bottone {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 35%, transparent);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ke-lingue-bottone:hover,
.ke-lingue-bottone[aria-expanded="true"] {
    background: color-mix(in srgb, currentColor 12%, transparent);
}

.ke-lingue-bottone:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.ke-lingue--topbar .ke-lingue-bottone {
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
}

.ke-lingue-bandiera {
    display: block;
    width: 21px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.ke-lingue-freccia {
    width: 0.9rem;
    height: 0.9rem;
    transition: transform 0.15s ease;
}

.ke-lingue-bottone[aria-expanded="true"] .ke-lingue-freccia {
    transform: rotate(180deg);
}

/* ─── Pannello ─────────────────────────────────────────────────────────── */

.ke-lingue-pannello {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1000;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    text-align: left;
}

.ke-lingue-pannello[hidden] {
    display: none;
}

.ke-lingue-testa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.ke-lingue-chiudi {
    display: inline-flex;
    padding: 0.2rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
}

.ke-lingue-chiudi:hover { background: #f3f4f6; color: #111827; }
.ke-lingue-chiudi svg { width: 1.1rem; height: 1.1rem; }

.ke-lingue-elenco {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ke-lingue-voce {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--ke-lingue-bordo);
    border-radius: 0.4rem;
    color: #1f2937;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ke-lingue-voce:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.ke-lingue-voce.is-attiva {
    background: var(--ke-lingue-attiva);
    border-color: var(--ke-lingue-attiva);
    font-weight: 600;
}

.ke-lingue-nome {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ke-lingue-voce img {
    flex-shrink: 0;
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.ke-lingue-codice {
    flex-shrink: 0;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    background: #f3f4f6;
    font-size: 0.7rem;
    font-weight: 700;
    color: #4b5563;
}

/* Telefono: il pannello si apre a tutta larghezza sotto la barra */
@media (max-width: 639px) {
    .ke-lingue-pannello {
        position: fixed;
        top: 3.5rem;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-height: calc(100dvh - 5rem);
        overflow-y: auto;
    }
}
