/* ==========================================================================
   Donuz Chat — widget flutuante de WhatsApp
   Todas as classes usam o prefixo .wa- para não colidir com o CSS do site.
   ========================================================================== */

:root {
    --wa-green: #25D366;
    --wa-green-dark: #1DA851;
    --wa-header: #075E54;
    --wa-bg: #ECE5DD;
    --wa-bubble-bot: #FFFFFF;
    --wa-bubble-user: #DCF8C6;
    --wa-text: #111b21;
    --wa-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* --------------------------------------------------------------------------
   Botão flutuante
   -------------------------------------------------------------------------- */
.wa-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--wa-green);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.wa-launcher:hover {
    transform: scale(1.08);
}

.wa-launcher:focus-visible {
    outline: 3px solid #0b7a3e;
    outline-offset: 3px;
}

.wa-launcher svg {
    width: 34px;
    height: 34px;
    fill: #fff;
    pointer-events: none;
}

/* ondas de radar */
.wa-launcher::before,
.wa-launcher::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--wa-green);
    z-index: -1;
    animation: wa-radar 2.4s ease-out infinite;
}

.wa-launcher::after {
    animation-delay: 1.2s;
}

@keyframes wa-radar {
    0% {
        transform: scale(1);
        opacity: .6;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Balão de chamada (preview message)
   -------------------------------------------------------------------------- */
.wa-preview {
    position: fixed;
    right: 24px;
    bottom: 98px;
    z-index: 9997;
    max-width: 280px;
    padding: 12px 34px 12px 14px;
    background: #fff;
    color: var(--wa-text);
    font-family: var(--wa-font);
    font-size: 14px;
    line-height: 1.45;
    border-radius: 12px;
    border-bottom-right-radius: 3px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.wa-preview.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.wa-preview-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8696a0;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
}

.wa-preview-close:hover {
    background: #f0f2f5;
}

/* --------------------------------------------------------------------------
   Janela do chat
   -------------------------------------------------------------------------- */
.wa-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9999;
    width: 360px;
    height: 480px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 130px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: var(--wa-bg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .3);
    font-family: var(--wa-font);
    color: var(--wa-text);
    opacity: 0;
    transform: translateY(16px) scale(.97);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.wa-window.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* Cabeçalho */
.wa-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--wa-header);
    color: #fff;
    flex: 0 0 auto;
}

.wa-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    padding: 2px;
}

.wa-header-info {
    min-width: 0;
    flex: 1;
}

.wa-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.wa-name svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.wa-status {
    font-size: 12px;
    opacity: .85;
    margin-top: 2px;
}

.wa-close {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
}

.wa-close:hover {
    background: rgba(255, 255, 255, .15);
}

/* Área de mensagens */
.wa-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wa-bubble {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
    animation: wa-msg-in .25s ease;
}

.wa-bubble--bot {
    align-self: flex-start;
    background: var(--wa-bubble-bot);
    border-top-left-radius: 2px;
}

.wa-bubble--user {
    align-self: flex-end;
    background: var(--wa-bubble-user);
    border-top-right-radius: 2px;
}

@keyframes wa-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Digitando… */
.wa-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: var(--wa-bubble-bot);
    border-radius: 10px;
    border-top-left-radius: 2px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

.wa-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aa0a6;
    animation: wa-typing 1.2s infinite ease-in-out;
}

.wa-typing span:nth-child(2) {
    animation-delay: .15s;
}

.wa-typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes wa-typing {

    0%,
    100% {
        transform: translateY(0);
        opacity: .5;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Botões de resposta rápida */
.wa-choices {
    align-self: flex-start;
    width: 82%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    animation: wa-msg-in .25s ease;
}

.wa-choice {
    flex: 1 1 100%;
    padding: 11px 8px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: var(--wa-green-dark);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
    transition: background .15s ease;
}

.wa-choices--grid .wa-choice {
    flex: 1 1 calc(33.33% - 6px);
}

.wa-choice:hover {
    background: #f5f6f6;
}

.wa-choice:active {
    background: #e9edef;
}

.wa-choice:focus-visible {
    outline: 2px solid var(--wa-green-dark);
    outline-offset: 2px;
}

/* Botão de CTA final (quando o pop-up é bloqueado) */
.wa-cta {
    align-self: center;
    margin-top: 4px;
    padding: 12px 18px;
    border: 0;
    border-radius: 24px;
    background: var(--wa-green);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    animation: wa-msg-in .25s ease;
}

.wa-cta:hover {
    background: var(--wa-green-dark);
    color: #fff;
}

/* Barra de digitação */
.wa-composer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f0f0f0;
}

.wa-composer.is-hidden {
    display: none;
}

.wa-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 20px;
    background: #fff;
    font-family: inherit;
    font-size: 16px;
    /* 16px evita o zoom automático do iOS */
    color: var(--wa-text);
}

.wa-input:focus {
    outline: 0;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, .4);
}

.wa-send {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--wa-green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-send:hover {
    background: var(--wa-green-dark);
}

.wa-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    pointer-events: none;
}

.wa-send:focus-visible {
    outline: 2px solid #0b7a3e;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Mobile: tela cheia
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .wa-launcher {
        bottom: 16px;
        right: 16px;
    }

    .wa-preview {
        right: 16px;
        bottom: 90px;
        max-width: calc(100vw - 90px);
    }

    .wa-window {
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-width: 100%;
        max-height: none;
        border-radius: 0;
    }

    body.wa-open {
        overflow: hidden;
    }

    body.wa-open .wa-launcher,
    body.wa-open .wa-preview {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   Acessibilidade
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

    .wa-launcher::before,
    .wa-launcher::after,
    .wa-typing span {
        animation: none;
    }

    .wa-bubble,
    .wa-choices,
    .wa-cta {
        animation: none;
    }

    .wa-window,
    .wa-preview,
    .wa-launcher {
        transition: none;
    }
}
