/* SwebLang - Styles front-office */

.sweblang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--wp--preset--font-size--medium);
}

.sweblang-switcher--buttons {
    flex-wrap: wrap;
}

.sweblang-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--wp--preset--color--muted);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    background: transparent;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}

.sweblang-switcher__btn:hover {
    background: rgba(0,0,0,.06);
    border-color: rgba(0,0,0,.35);
    text-decoration: none;
}

.sweblang-switcher__btn--active {
    font-weight: 700;
}

img.sweblang-flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    object-position: center;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    flex-shrink: 0;
    display: block;
}

/* Label - pas en gras par défaut */
.sweblang-switcher__label {
    vertical-align: middle;
    font-weight: 400;
}

/* Label et ISO en gras sur l'élément actif */
.sweblang-switcher__btn--active  .sweblang-switcher__label,
.sweblang-switcher__btn--active  .sweblang-switcher__iso,
.sweblang-switcher__item--active .sweblang-switcher__label,
.sweblang-switcher__item--active .sweblang-switcher__iso {
    font-weight: 700;
}

/* Code ISO court (ex : FR, EN) */
.sweblang-switcher__iso {
    font-size: .82em;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* -------- Responsive : mobile = ISO / desktop = libellé -------- */

/* Mobile (< 768px) : ISO visible, libellé masqué */
@media (max-width: 767px) {
    .sweblang-switcher__label { display: none; }
    .sweblang-switcher__iso   { display: inline; }
}

/* Desktop (≥ 768px) : libellé visible, ISO masqué */
@media (min-width: 768px) {
    .sweblang-switcher__label { display: inline; }
    .sweblang-switcher__iso   { display: none; }
}

/* -------- Forçage via [LANG_SWITCHER text=label|iso] -------- */

.sweblang-switcher--text-label .sweblang-switcher__label { display: inline !important; }
.sweblang-switcher--text-label .sweblang-switcher__iso   { display: none   !important; }

.sweblang-switcher--text-iso   .sweblang-switcher__label { display: none   !important; }
.sweblang-switcher--text-iso   .sweblang-switcher__iso   { display: inline !important; }

.sweblang-flag-emoji {
    font-size: 1.2em;
    line-height: 1;
}

.sweblang-switcher--dropdown {
    position: relative;
    display: inline-block;
}

.sweblang-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 20px;
    border: 1px solid var(--wp--preset--color--muted);
    border-radius: 20px;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
}

.sweblang-switcher__toggle:hover {
    background: rgba(0,0,0,.06);
}

.sweblang-switcher__arrow {
    flex-shrink: 0;
    transition: transform .2s ease;
}

.sweblang-switcher--dropdown.is-open .sweblang-switcher__arrow {
    transform: rotate(180deg);
}

.sweblang-switcher__list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--wp--preset--color--muted);
    border-radius: 16px;
    z-index: 100;
    min-width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.sweblang-switcher--dropdown.is-open .sweblang-switcher__list {
    display: block;
}

.sweblang-switcher__item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    transition: background .15s;
}

.sweblang-switcher__item:hover {
    background: rgba(0,0,0,.06);
    text-decoration: none;
}

.sweblang-switcher__item--active {
    font-weight: 700;
}
