/* Botão flutuante e painel de conversa por WhatsApp */

.wa-chat {
    --wa-verde: #25d366;
    --wa-verde-escuro: #00a884;
    --wa-cabecalho: #1f2c34;
    --wa-fundo: #0b141a;
    --wa-balao: #202c33;
    --wa-campo: #2a3942;
    --wa-texto: #e9edef;
    --wa-texto-suave: #8696a0;
    --wa-margem: 20px;

    position: fixed;
    bottom: calc(var(--wa-margem) + env(safe-area-inset-bottom, 0px));
    z-index: 990;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--wa-texto);
}

.wa-chat,
.wa-chat *,
.wa-chat *::before,
.wa-chat *::after {
    box-sizing: border-box;
}

.wa-chat--direita {
    right: calc(var(--wa-margem) + env(safe-area-inset-right, 0px));
}

.wa-chat--esquerda {
    left: calc(var(--wa-margem) + env(safe-area-inset-left, 0px));
}

.wa-chat p {
    margin: 0;
    padding: 0;
}

.wa-chat svg {
    display: block;
    fill: currentColor;
}

.wa-chat__oculto {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* botão redondo */

.wa-chat__botao,
.wa-chat__botao:hover,
.wa-chat__botao:focus {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wa-verde);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    transition: transform .15s ease, box-shadow .15s ease;
}

.wa-chat__botao:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}

.wa-chat__botao:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.wa-chat__icone {
    width: 30px;
    height: 30px;
    transition: transform .2s ease, opacity .2s ease;
}

.wa-chat__icone--fechar {
    position: absolute;
    width: 34px;
    height: 34px;
    opacity: 0;
    transform: rotate(-90deg);
}

.wa-chat--aberto .wa-chat__icone--whatsapp {
    opacity: 0;
    transform: rotate(90deg);
}

.wa-chat--aberto .wa-chat__icone--fechar {
    opacity: 1;
    transform: none;
}

/* etiqueta ao passar o rato */

.wa-chat__dica {
    position: absolute;
    top: 50%;
    padding: 7px 12px;
    border-radius: 6px;
    background: #fff;
    color: #111b21;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity .15s ease, visibility 0s .15s;
}

.wa-chat--direita .wa-chat__dica {
    right: calc(100% + 12px);
}

.wa-chat--esquerda .wa-chat__dica {
    left: calc(100% + 12px);
}

@media (hover: hover) and (pointer: fine) {
    .wa-chat:not(.wa-chat--aberto) .wa-chat__botao:hover .wa-chat__dica {
        opacity: 1;
        visibility: visible;
        transition: opacity .15s ease, visibility 0s;
    }
}

/* painel */

.wa-chat__painel {
    position: absolute;
    bottom: calc(100% + 14px);
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 2 * var(--wa-margem)));
    max-height: min(520px, calc(100vh - 120px));
    max-height: min(520px, calc(100dvh - 120px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: var(--wa-fundo);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.98);
    transition: opacity .18s ease, transform .18s ease, visibility 0s .18s;
}

.wa-chat__painel[hidden] {
    display: none;
}

.wa-chat--direita .wa-chat__painel {
    right: 0;
    transform-origin: bottom right;
}

.wa-chat--esquerda .wa-chat__painel {
    left: 0;
    transform-origin: bottom left;
}

.wa-chat--aberto .wa-chat__painel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .18s ease, transform .18s ease, visibility 0s;
}

.wa-chat__painel:focus {
    outline: none;
}

.wa-chat__cabecalho {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    background: var(--wa-cabecalho);
}

.wa-chat__avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wa-verde);
    color: #fff;
}

.wa-chat__avatar svg {
    width: 24px;
    height: 24px;
}

.wa-chat__identidade {
    flex: 1;
    min-width: 0;
}

.wa-chat .wa-chat__titulo {
    font-size: 15px;
    font-weight: 600;
    color: var(--wa-texto);
}

.wa-chat .wa-chat__subtitulo {
    margin-top: 2px;
    font-size: 12px;
    color: var(--wa-texto-suave);
}

.wa-chat__fechar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--wa-texto-suave);
    cursor: pointer;
}

.wa-chat__fechar:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--wa-texto);
}

.wa-chat__fechar:focus-visible {
    outline: 2px solid var(--wa-verde);
    outline-offset: 1px;
}

.wa-chat__fechar svg {
    width: 20px;
    height: 20px;
}

.wa-chat__corpo {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 15px 50%;
}

.wa-chat__balao {
    position: relative;
    max-width: 85%;
    padding: 8px 12px 9px;
    border-radius: 0 10px 10px 10px;
    background: var(--wa-balao);
}

.wa-chat__balao::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    border-top: 0 solid transparent;
    border-right: 8px solid var(--wa-balao);
    border-bottom: 10px solid transparent;
}

.wa-chat .wa-chat__remetente {
    margin-bottom: 2px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--wa-verde);
}

.wa-chat .wa-chat__texto {
    font-size: 14px;
    color: var(--wa-texto);
}

/* composição */

.wa-chat__form {
    flex: none;
    margin: 0;
    padding: 10px 12px 12px;
    background: var(--wa-cabecalho);
}

.wa-chat__contexto {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-left: 4px solid var(--wa-verde);
    border-radius: 6px;
    background: rgba(0, 0, 0, .25);
}

.wa-chat .wa-chat__contexto-etiqueta {
    font-size: 12px;
    font-weight: 600;
    color: var(--wa-verde);
}

.wa-chat .wa-chat__contexto-nome {
    font-size: 13.5px;
    color: var(--wa-texto);
    overflow-wrap: anywhere;
}

.wa-chat .wa-chat__contexto-ref {
    font-size: 12px;
    color: var(--wa-texto-suave);
    overflow-wrap: anywhere;
}

.wa-chat .wa-chat__contexto-nota {
    margin-top: 4px;
    font-size: 11.5px;
    font-style: italic;
    color: var(--wa-texto-suave);
}

.wa-chat__composicao {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.wa-chat .wa-chat__campo {
    flex: 1;
    min-width: 0;
    height: 42px;
    max-height: 120px;
    margin: 0;
    padding: 11px 14px;
    border: 0;
    border-radius: 21px;
    background: var(--wa-campo);
    color: var(--wa-texto);
    font: inherit;
    font-size: 15px;
    line-height: 20px;
    resize: none;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.wa-chat .wa-chat__campo::placeholder {
    color: var(--wa-texto-suave);
    opacity: 1;
}

.wa-chat .wa-chat__campo:focus {
    box-shadow: 0 0 0 2px rgba(37, 211, 102, .45);
}

.wa-chat__enviar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0 0 0 3px;
    border: 0;
    border-radius: 50%;
    background: var(--wa-verde-escuro);
    color: #fff;
    cursor: pointer;
    transition: background-color .15s ease;
}

.wa-chat__enviar:hover {
    background: #06cf9c;
}

.wa-chat__enviar:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.wa-chat__enviar svg {
    width: 20px;
    height: 20px;
}

/* ecrãs pequenos */

@media (max-width: 575.98px) {
    .wa-chat {
        --wa-margem: 14px;
    }

    .wa-chat__botao,
    .wa-chat__botao:hover,
    .wa-chat__botao:focus {
        width: 52px;
        height: 52px;
    }

    .wa-chat__painel {
        bottom: calc(100% + 10px);
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
    }

    .wa-chat .wa-chat__campo {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-chat__botao,
    .wa-chat__icone,
    .wa-chat__painel,
    .wa-chat__dica {
        transition: none !important;
    }

    .wa-chat__painel {
        transform: none;
    }
}

@media print {
    .wa-chat {
        display: none !important;
    }
}
