/* ============================================================
   lang-switcher.css — Sélecteur de langue par drapeaux (i18n)
   Partagé par toutes les pages. Drapeaux SVG embarqués en
   data-URI (aucune ressource externe, compatible file://).
   Le markup est généré par assets/js/i18n.js dans tout élément
   [data-lang-switcher] (pattern repris de Caramel).
   ============================================================ */

/* ---------- Drapeaux ---------- */
.fi {
    display: inline-block;
    width: 1.35em;
    height: 1em;
    flex-shrink: 0;
    background-size: cover;
    background-position: 50%;
    background-repeat: no-repeat;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12) inset;
    vertical-align: -0.1em;
}

.fi-fr {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Cpath fill='%23002395' d='M0 0h1v2H0z'/%3E%3Cpath fill='%23fff' d='M1 0h1v2H1z'/%3E%3Cpath fill='%23ED2939' d='M2 0h1v2H2z'/%3E%3C/svg%3E");
}

.fi-gb {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cpath fill='%23012169' d='M0 0v30h60V0z'/%3E%3Cpath stroke='%23fff' stroke-width='6' d='m0 0 60 30m0-30L0 30'/%3E%3Cpath stroke='%23C8102E' stroke-width='4' d='m0 0 60 30m0-30L0 30' clip-path='url(%23a)'/%3E%3Cpath stroke='%23fff' stroke-width='10' d='M30 0v30M0 15h60'/%3E%3Cpath stroke='%23C8102E' stroke-width='6' d='M30 0v30M0 15h60'/%3E%3C/svg%3E");
}

.fi-de {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3'%3E%3Cpath d='M0 0h5v1H0z'/%3E%3Cpath fill='%23D00' d='M0 1h5v1H0z'/%3E%3Cpath fill='%23FFCE00' d='M0 2h5v1H0z'/%3E%3C/svg%3E");
}

.fi-es {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Cpath fill='%23AA151B' d='M0 0h3v2H0z'/%3E%3Cpath fill='%23F1BF00' d='M0 .5h3v1H0z'/%3E%3C/svg%3E");
}

.fi-it {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Cpath fill='%23009246' d='M0 0h1v2H0z'/%3E%3Cpath fill='%23fff' d='M1 0h1v2H1z'/%3E%3Cpath fill='%23CE2B37' d='M2 0h1v2H2z'/%3E%3C/svg%3E");
}

/* ---------- Sélecteur ---------- */
.language-switcher {
    position: relative;
    display: inline-flex;
}

.language-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid rgba(128, 128, 128, .35);
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    color: inherit;
    transition: background .15s ease, border-color .15s ease;
}

.language-btn:hover {
    background: rgba(128, 128, 128, .12);
    border-color: rgba(128, 128, 128, .55);
}

.language-btn .fi {
    font-size: 1.05em;
}

.language-caret {
    font-size: .65em;
    opacity: .7;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    min-width: 155px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    display: none;
    z-index: 10000;
}

.language-switcher.open .language-dropdown {
    display: block;
}

.language-dropdown li {
    list-style: none;
}

.language-dropdown button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: .95em;
    color: inherit;
    text-align: left;
    white-space: nowrap;
}

.language-dropdown button:hover {
    background: rgba(99, 102, 241, .12);
}

.language-dropdown button.active {
    font-weight: 700;
    background: rgba(99, 102, 241, .16);
}

/* Thème sombre (attribut data-theme d'index + classe legacy .dark-mode) */
[data-theme="dark"] .language-dropdown,
.dark-mode .language-dropdown {
    background: #1e293b;
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, .1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

[data-theme="dark"] .language-dropdown button:hover,
.dark-mode .language-dropdown button:hover {
    background: rgba(129, 140, 248, .18);
}
