/**
 * =============================================================================
 *  MOTOR DE CHAT — Estilos (padrão visual WhatsApp)
 * =============================================================================
 *  Prefixo .fqc- em tudo, para não colidir com o CSS da landing page.
 *
 *  Cores controladas por variáveis, definidas no config.php e injetadas
 *  inline no elemento .fqc-surface:
 *      --fqc-cabecalho        cor da barra superior
 *      --fqc-acao             cor do botão de envio
 *      --fqc-cabecalho-texto  calculada automaticamente pelo PHP
 * =============================================================================
 */

/* =============================================================================
 | 1. SUPERFÍCIE E ISOLAMENTO
 |
 | O widget vive sobre o CSS de temas e page builders que não controlamos.
 | `all: initial` zera a herança; as regras abaixo reconstroem só o necessário.
 ============================================================================*/

.fqc-surface {
    all: initial;

    --fqc-cabecalho:       #f0f2f5;
    --fqc-cabecalho-texto: #111b21;
    --fqc-cabecalho-suave: #667781;
    --fqc-acao:            #00a884;
    --fqc-fundo:           #efeae2;
    --fqc-recebida:        #ffffff;
    --fqc-enviada:         #d9fdd3;
    --fqc-texto:           #111b21;
    --fqc-texto-suave:     #667781;

    position: relative;
    z-index: 2147483000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--fqc-texto);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.fqc-surface,
.fqc-surface *,
.fqc-surface *::before,
.fqc-surface *::after {
    box-sizing: border-box;
}

.fqc-surface button,
.fqc-surface textarea {
    all: unset;
    box-sizing: border-box;
    font: inherit;
}

.fqc-surface button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.fqc-surface img,
.fqc-surface svg {
    display: block;
    max-width: none;
}

.fqc-surface .fqc-honeypot {
    position: fixed !important;
    left: -10000px !important;
    top: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* O selo do reCAPTCHA sobe para não cobrir o botão flutuante. */
.grecaptcha-badge {
    z-index: 2147482999 !important;
    bottom: 96px !important;
}

/* =============================================================================
 | 2. BOTÃO FLUTUANTE
 ============================================================================*/

.fqc-surface .fqc-launcher {
    position: fixed;
    z-index: 2147483001;
    right: 22px;
    bottom: 22px;
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    transition: opacity .2s ease;
}

.fqc-surface.fqc-pos-esquerda .fqc-launcher {
    right: auto;
    left: 22px;
}

.fqc-surface .fqc-launcher-core {
    position: relative;
    display: block;
    width: 64px;
    height: 64px;
    overflow: hidden;
    background: #25d366;
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 50%;
    box-shadow: 0 7px 20px rgba(17, 27, 33, .25);
    transition: box-shadow .2s ease, filter .2s ease;
}

.fqc-surface .fqc-launcher:hover .fqc-launcher-core,
.fqc-surface .fqc-launcher:focus-visible .fqc-launcher-core {
    box-shadow: 0 9px 25px rgba(17, 27, 33, .3);
    filter: brightness(1.03);
}

.fqc-surface .fqc-launcher:focus-visible {
    outline: 3px solid rgba(37, 211, 102, .3);
    outline-offset: 4px;
}

/* Anel que pulsa uma única vez, chamando atenção sem deformar o botão. */
.fqc-surface .fqc-launcher-core::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 2px solid rgba(37, 211, 102, .62);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: fqc-anel 1.25s 1.8s ease-out 1;
}

.fqc-surface .fqc-launcher-icone {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 39px;
    height: 39px;
    color: #fff;
    fill: currentColor;
    transform: translate(-50%, -50%);
}

.fqc-surface .fqc-badge {
    position: absolute;
    top: -2px;
    right: -1px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: #fff;
    background: #e53935;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    transform: translateY(3px);
    animation: fqc-badge-in .28s 1.45s ease forwards;
}

.fqc-surface.is-aberto .fqc-launcher {
    opacity: 0;
    pointer-events: none;
}

/* =============================================================================
 | 3. CONVITE (balão antes de abrir)
 ============================================================================*/

.fqc-surface .fqc-convite {
    position: fixed;
    z-index: 2147483001;
    right: 22px;
    bottom: 98px;
    display: flex;
    align-items: flex-start;
    width: min(300px, calc(100vw - 34px));
    padding: 5px;
    color: var(--fqc-texto);
    background: #fff;
    border: 1px solid rgba(17, 27, 33, .08);
    border-radius: 13px;
    box-shadow: 0 9px 30px rgba(17, 27, 33, .18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(9px);
    transition: opacity .25s ease, transform .25s ease;
}

.fqc-surface.fqc-pos-esquerda .fqc-convite {
    right: auto;
    left: 22px;
}

.fqc-surface.is-convite .fqc-convite {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.fqc-surface.is-aberto .fqc-convite {
    opacity: 0;
    pointer-events: none;
}

/* Bico do balão apontando para o botão. */
.fqc-surface .fqc-convite::after {
    content: "";
    position: absolute;
    right: 25px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-right: 1px solid rgba(17, 27, 33, .08);
    border-bottom: 1px solid rgba(17, 27, 33, .08);
    transform: rotate(45deg);
}

.fqc-surface.fqc-pos-esquerda .fqc-convite::after {
    right: auto;
    left: 25px;
}

.fqc-surface .fqc-convite-main {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 9px;
    padding: 8px;
    border-radius: 9px;
}

.fqc-surface .fqc-convite-main:hover {
    background: rgba(17, 27, 33, .04);
}

.fqc-surface .fqc-convite-main img,
.fqc-surface .fqc-convite-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.fqc-surface .fqc-convite-avatar {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--fqc-acao);
    font-size: 15px;
    font-weight: 600;
}

.fqc-surface .fqc-convite-main span {
    display: block;
    min-width: 0;
}

.fqc-surface .fqc-convite-main strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.fqc-surface .fqc-convite-main small {
    display: block;
    margin-top: 1px;
    color: var(--fqc-texto-suave);
    font-size: 12px;
    line-height: 1.35;
}

.fqc-surface .fqc-convite-fechar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--fqc-texto-suave);
    border-radius: 50%;
    font-size: 17px;
    line-height: 1;
}

.fqc-surface .fqc-convite-fechar:hover {
    background: rgba(17, 27, 33, .07);
}

/* =============================================================================
 | 4. JANELA DA CONVERSA
 ============================================================================*/

.fqc-surface .fqc-dialogo {
    position: fixed;
    z-index: 2147483002;
    right: 22px;
    bottom: 22px;
    display: flex;
    flex-direction: column;
    width: min(382px, calc(100vw - 34px));
    height: min(638px, calc(100vh - 44px));
    min-height: 430px;
    overflow: hidden;
    background: var(--fqc-fundo);
    border: 1px solid rgba(17, 27, 33, .1);
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(17, 27, 33, .25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .25s cubic-bezier(.2, .75, .3, 1);
}

.fqc-surface.fqc-pos-esquerda .fqc-dialogo {
    right: auto;
    left: 22px;
    transform-origin: bottom left;
}

.fqc-surface .fqc-dialogo.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ---- Cabeçalho ----------------------------------------------------------- */

.fqc-surface .fqc-cabecalho {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
    min-height: 64px;
    padding: 9px 12px 9px 7px;
    color: var(--fqc-cabecalho-texto);
    background: var(--fqc-cabecalho);
    border-bottom: 1px solid rgba(17, 27, 33, .06);
}

.fqc-surface .fqc-voltar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 34px;
    color: inherit;
    border-radius: 6px;
}

.fqc-surface .fqc-voltar:hover {
    background: rgba(17, 27, 33, .06);
}

.fqc-surface .fqc-voltar svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.fqc-surface .fqc-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.fqc-surface .fqc-avatar--inicial {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--fqc-acao);
    font-size: 16px;
    font-weight: 600;
}

.fqc-surface .fqc-identidade {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 1px;
}

.fqc-surface .fqc-identidade strong {
    overflow: hidden;
    color: var(--fqc-cabecalho-texto);
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fqc-surface .fqc-identidade span {
    color: var(--fqc-cabecalho-suave);
    font-size: 12px;
}

.fqc-surface .fqc-identidade span.is-digitando {
    color: var(--fqc-acao);
    font-style: italic;
}

.fqc-surface .fqc-menu {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
}

.fqc-surface .fqc-menu i {
    width: 3px;
    height: 3px;
    background: var(--fqc-cabecalho-suave);
    border-radius: 50%;
}

/* ---- Área das mensagens -------------------------------------------------- */

.fqc-surface .fqc-conversa {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 13px 13px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--fqc-fundo);
    /* Textura discreta desenhada em SVG: nenhuma imagem para baixar. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23dbd4c9' stroke-width='1' stroke-linecap='round' opacity='.34'%3E%3Cpath d='M8 14h8M12 10v8'/%3E%3Ccircle cx='42' cy='16' r='4'/%3E%3Cpath d='M30 42h10M34 38l-4 4 4 4'/%3E%3Cpath d='M12 40l5-5 5 5'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 112px auto;
    scroll-behavior: smooth;
}

.fqc-surface .fqc-conversa::-webkit-scrollbar {
    width: 5px;
}

.fqc-surface .fqc-conversa::-webkit-scrollbar-thumb {
    background: rgba(17, 27, 33, .18);
    border-radius: 10px;
}

.fqc-surface .fqc-dia {
    align-self: center;
    margin: 0 0 5px;
    padding: 5px 11px;
    color: #54656f;
    background: rgba(255, 255, 255, .9);
    border-radius: 7px;
    box-shadow: 0 1px 1px rgba(17, 27, 33, .08);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .2px;
    text-transform: uppercase;
}

/* ---- Balões -------------------------------------------------------------- */

.fqc-surface .fqc-balao {
    position: relative;
    align-self: flex-start;
    max-width: 84%;
    padding: 7px 8px 6px 9px;
    color: var(--fqc-texto);
    background: var(--fqc-recebida);
    border-radius: 7.5px;
    box-shadow: 0 1px 1px rgba(17, 27, 33, .13);
    font-size: 13px;
    line-height: 1.38;
    overflow-wrap: anywhere;
    animation: fqc-balao-in .18s ease both;
}

.fqc-surface .fqc-balao.is-enviado {
    align-self: flex-end;
    background: var(--fqc-enviada);
}

/* Bico do balão. */
.fqc-surface .fqc-balao::before {
    content: "";
    position: absolute;
    top: 0;
    left: -7px;
    width: 0;
    height: 0;
    border-top: 8px solid var(--fqc-recebida);
    border-left: 8px solid transparent;
}

.fqc-surface .fqc-balao.is-enviado::before {
    right: -7px;
    left: auto;
    border-top-color: var(--fqc-enviada);
    border-right: 8px solid transparent;
    border-left: 0;
}

.fqc-surface .fqc-balao-texto {
    white-space: pre-wrap;
}

.fqc-surface .fqc-balao-hora {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    float: right;
    min-height: 11px;
    margin: 5px 0 0 9px;
    color: var(--fqc-texto-suave);
    font-size: 9px;
    line-height: 1;
}

/* Confirmação de leitura: cinza ao enviar, azul ao "ler". */
.fqc-surface .fqc-check {
    width: 15px;
    height: 9px;
    color: #8696a0;
    fill: currentColor;
    transition: color .25s ease;
}

.fqc-surface .fqc-check.is-lido {
    color: #53bdeb;
}

/* =============================================================================
 | 5. COMPOSER (área de resposta)
 ============================================================================*/

.fqc-surface .fqc-composer {
    flex: 0 0 auto;
    padding: 8px 9px 7px;
    background: #f0f2f5;
    border-top: 1px solid rgba(17, 27, 33, .05);
}

.fqc-surface .fqc-linha {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

.fqc-surface .fqc-campo {
    display: flex;
    align-items: flex-end;
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 0 13px 0 14px;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 21px;
}

.fqc-surface .fqc-campo:focus-within {
    border-color: rgba(17, 27, 33, .1);
}

.fqc-surface .fqc-campo textarea {
    flex: 1;
    max-height: 96px;
    min-height: 22px;
    padding: 10px 0;
    overflow-y: auto;
    color: var(--fqc-texto);
    font-size: 14px;
    line-height: 1.35;
    resize: none;
}

.fqc-surface .fqc-campo textarea::placeholder {
    color: #8696a0;
}

.fqc-surface .fqc-enviar {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    color: #fff;
    background: var(--fqc-acao);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(17, 27, 33, .15);
    transition: filter .16s ease;
}

.fqc-surface .fqc-enviar:hover,
.fqc-surface .fqc-enviar:focus-visible {
    filter: brightness(.94);
    outline: none;
}

.fqc-surface .fqc-enviar svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
    transform: translateX(1px);
}

/* ---- Opções (escolha única e múltipla) ----------------------------------- */

.fqc-surface .fqc-opcoes {
    display: none;
    flex-direction: column;
    gap: 6px;
    max-height: 210px;
    overflow-y: auto;
}

/* Quando há opções, o campo de texto sai de cena. */
.fqc-surface .fqc-composer.is-opcoes .fqc-linha {
    display: none;
}

.fqc-surface .fqc-composer.is-opcoes .fqc-opcoes {
    display: flex;
}

.fqc-surface .fqc-opcao {
    position: relative;
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 9px 34px 9px 12px;
    color: #008069;
    background: #fff;
    border: 1px solid rgba(17, 27, 33, .09);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(17, 27, 33, .05);
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.fqc-surface .fqc-opcao::after {
    content: "\203A";
    position: absolute;
    top: 50%;
    right: 13px;
    color: #8696a0;
    font-size: 18px;
    transform: translateY(-52%);
}

.fqc-surface .fqc-opcao:hover,
.fqc-surface .fqc-opcao:focus-visible {
    background: #f7f9fa;
    outline: none;
}

.fqc-surface .fqc-opcao:disabled {
    opacity: .55;
    cursor: wait;
}

/* Múltipla escolha: caixas à esquerda, texto alinhado, botão de confirmar. */
.fqc-surface .fqc-composer.is-multipla .fqc-opcao {
    padding-right: 42px;
    text-align: left;
}

.fqc-surface .fqc-composer.is-multipla .fqc-opcao::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 1.5px solid #8696a0;
    border-radius: 4px;
    transform: translateY(-50%);
}

.fqc-surface .fqc-composer.is-multipla .fqc-opcao.is-marcada {
    color: #006b59;
    background: #e7f8f3;
    border-color: #7bd3bd;
}

.fqc-surface .fqc-composer.is-multipla .fqc-opcao.is-marcada::after {
    content: "\2713";
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--fqc-acao);
    border-color: var(--fqc-acao);
    font-size: 11px;
    font-weight: 700;
}

.fqc-surface .fqc-confirmar {
    display: block;
    width: 100%;
    min-height: 40px;
    margin-top: 6px;
    padding: 9px 12px;
    color: #fff;
    background: var(--fqc-acao);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.fqc-surface .fqc-confirmar[hidden] {
    display: none;
}

.fqc-surface .fqc-confirmar:hover {
    filter: brightness(.94);
}

/* ---- Erro e consentimento ------------------------------------------------ */

.fqc-surface .fqc-erro {
    display: block;
    margin-top: 7px;
    padding: 7px 10px;
    color: #b42318;
    background: rgba(217, 45, 32, .07);
    border-radius: 7px;
    font-size: 11.5px;
    line-height: 1.4;
    animation: fqc-balao-in .18s ease both;
}

.fqc-surface .fqc-erro[hidden] {
    display: none;
}

.fqc-surface .fqc-consentimento {
    display: block;
    margin-top: 7px;
    color: #8696a0;
    font-size: 10px;
    line-height: 1.45;
    text-align: center;
}

/* =============================================================================
 | 6. AÇÃO FINAL
 ============================================================================*/

.fqc-surface .fqc-final {
    flex: 0 0 auto;
    padding: 11px 12px 13px;
    background: #f0f2f5;
    border-top: 1px solid rgba(17, 27, 33, .05);
    text-align: center;
    animation: fqc-final-in .22s ease both;
}

.fqc-surface .fqc-final[hidden] {
    display: none;
}

.fqc-surface .fqc-final-botao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 46px;
    padding: 11px 16px;
    color: #fff;
    background: #25d366;
    border-radius: 9px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, .32);
    font-size: 14px;
    font-weight: 600;
    transition: filter .16s ease;
}

.fqc-surface .fqc-final-botao:hover,
.fqc-surface .fqc-final-botao:focus-visible {
    filter: brightness(.95);
    outline: none;
}

.fqc-surface .fqc-final-botao svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.fqc-surface .fqc-final > small {
    display: block;
    margin-top: 8px;
    color: var(--fqc-texto-suave);
    font-size: 11px;
    line-height: 1.45;
}

/* =============================================================================
 | 7. ANIMAÇÕES
 ============================================================================*/

@keyframes fqc-anel {
    0%   { opacity: .9; transform: scale(1); }
    100% { opacity: 0;  transform: scale(1.45); }
}

@keyframes fqc-badge-in {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fqc-balao-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fqc-final-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
 | 8. MOBILE
 |
 | Em telas pequenas a conversa ocupa a tela inteira, como um app.
 ============================================================================*/

@media (max-width: 600px) {
    .fqc-surface .fqc-dialogo,
.fqc-surface.fqc-pos-esquerda .fqc-dialogo {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .fqc-surface .fqc-cabecalho {
        padding-top: max(9px, env(safe-area-inset-top));
    }

    .fqc-surface .fqc-composer,
.fqc-surface .fqc-final {
        padding-bottom: max(7px, env(safe-area-inset-bottom));
    }

    .fqc-surface .fqc-launcher,
.fqc-surface.fqc-pos-esquerda .fqc-launcher {
        right: 16px;
        bottom: 16px;
    }

    .fqc-surface.fqc-pos-esquerda .fqc-launcher {
        right: auto;
        left: 16px;
    }

    .fqc-surface .fqc-convite {
        bottom: 92px;
    }

    /* Fonte < 16px faz o iOS dar zoom ao focar o campo. */
    .fqc-surface .fqc-campo textarea {
        font-size: 16px;
    }
}

/* =============================================================================
 | 9. ACESSIBILIDADE
 ============================================================================*/

@media (prefers-reduced-motion: reduce) {
    .fqc-surface *,
.fqc-surface *::before,
.fqc-surface *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .fqc-surface .fqc-conversa {
        scroll-behavior: auto;
    }
}