/* ==========================================================
SELETOR DE IDIOMAS
========================================================== */


.language-switcher {
    position: relative;
    flex-shrink: 0;
}

/*
 * Remove o marcador padrão do elemento <summary>.
 */
.language-switcher > summary {
    list-style: none;
}

.language-switcher > summary::-webkit-details-marker {
    display: none;
}

/*
 * Botão principal:
 * mostra somente o idioma atualmente selecionado.
 */
.language-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    height: 34px;
    min-width: 46px;
    padding: 0 7px;

    border: 1px solid rgba(78, 123, 164, 0.28);
    border-radius: 8px;

    background: transparent;
    color: inherit;

    font: inherit;
    cursor: pointer;
    user-select: none;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.language-summary:hover {
    background: rgba(78, 123, 164, 0.10);
    border-color: #4E7BA4;
    transform: translateY(-1px);
}

.language-summary:focus-visible {
    outline: 2px solid #4E7BA4;
    outline-offset: 2px;
}

/*
 * Mantém destaque enquanto o menu estiver aberto.
 */
.language-switcher[open] .language-summary {
    background: rgba(78, 123, 164, 0.16);
    border-color: #4E7BA4;
    box-shadow: 0 0 0 1px rgba(78, 123, 164, 0.10);
}


/* ==========================================================
SETA
========================================================== */

.language-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    transition: transform 0.2s ease;
}

.language-switcher[open] .language-caret {
    transform: rotate(180deg);
}


/* ==========================================================
DROPDOWN DE IDIOMAS
========================================================== */

.language-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;

    min-width: 92px;

    margin: 0;
    padding: 5px;

    list-style: none;

    background: #ffffff;

    border: 1px solid rgba(78, 123, 164, 0.20);
    border-radius: 9px;

    box-shadow:
        0 10px 25px rgba(13, 23, 34, 0.14);

    z-index: 1000;
}

.language-list li {
    margin: 0;
    padding: 0;
}

.language-form {
    display: block;

    width: 100%;

    margin: 0;
    padding: 0;
}


/* ==========================================================
BOTÕES DO DROPDOWN
========================================================== */

.language-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;

    width: 100%;
    height: 34px;

    padding: 0 8px;

    border: none;
    border-radius: 6px;

    background: transparent;
    color: #0D1722;

    font: inherit;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.language-btn:hover {
    background: rgba(78, 123, 164, 0.10);
}

.language-btn:focus-visible {
    outline: 2px solid #4E7BA4;
    outline-offset: 1px;
}


/* ==========================================================
BANDEIRAS
========================================================== */

.language-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    line-height: 1;
}

.language-flag img {
    display: block;

    width: 21px;
    height: 14px;

    object-fit: cover;

    border-radius: 2px;
}

.language-code {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
}


/* ==========================================================
MOBILE
========================================================== */

@media (max-width: 768px) {

    .language-selector {
        position: absolute;
        right: 5em;
    }
    /*
     * No celular o seletor principal vira um botão circular
     * mostrando somente a bandeira.
     */
    .language-summary {
        width: 32px;
        min-width: 32px;
        height: 32px;

        padding: 0;

        border-radius: 50%;
    }

    /*
     * Esconde código e seta somente no botão principal.
     * Dentro do dropdown continuamos mostrando PT / EN / ES.
     */
    .language-summary .language-code,
    .language-summary .language-caret {
        display: none;
    }

    .language-flag img {
        width: 21px;
        height: 14px;
    }

    /*
     * Dropdown continua exibindo bandeira + código.
     */
    .language-list {
        top: calc(100% + 7px);
        right: 0;

        min-width: 82px;
    }

    .language-btn {
        height: 34px;
        padding: 0 8px;
    }

    .language-btn .language-code {
        display: inline;
    }
}