/* Demonstração animada do CRM WhatsApp na landing (index.php, seção "CRM WhatsApp"). Substitui o antigo
   images/crm-whatsapp.png. Usa a moldura .kbd- do kanban-demo.css (selo, janela, navegador, balão), que
   precisa estar carregado antes, e desenha o CRM com o tema escuro do whatsapp_crm/index.php. Prefixo .wad-
   pra não brigar com o resto da página. No celular a lista de conversas vira uma coluna só de avatares. */

.wad {
    --wad-fundo: #111b21;
    --wad-barra: #202c33;
    --wad-linha: #2a3942;
    --wad-texto: #e9edef;
    --wad-suave: #8696a0;
    --wad-verde: #00a884;
    --wad-roxo: #7c3aed;
    --wad-vermelho: #ef4444;
}

.wad .kbd-janela {
    border-color: #1f2c34;
    background: var(--wad-fundo);
}

.wad-app {
    display: flex;
    height: 360px;
    background: var(--wad-fundo);
    color: var(--wad-texto);
    text-align: left;
}

/* ---------- lista de conversas ---------- */
.wad-lateral {
    display: flex;
    flex: none;
    flex-direction: column;
    width: 36%;
    max-width: 250px;
    min-width: 0;
    border-right: 1px solid var(--wad-linha);
}

.wad-lat-topo {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    height: 42px;
    padding: 0 10px;
    background: var(--wad-barra);
}

.wad-marca {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.wad-marca i {
    color: #25d366;
    font-size: 16px;
}

.wad-lat-icones {
    display: flex;
    flex: none;
    gap: 9px;
    color: #aebac1;
    font-size: 11px;
}

.wad-busca {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 7px 8px 6px;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--wad-barra);
    color: var(--wad-suave);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
}

.wad-busca i {
    font-size: 9px;
}

.wad-filtros {
    display: flex;
    gap: 4px;
    padding: 0 8px 6px;
    overflow: hidden;
}

.wad-filtro {
    padding: 2px 7px;
    border: 1px solid var(--wad-linha);
    border-radius: 20px;
    color: var(--wad-suave);
    font-size: 9.5px;
    white-space: nowrap;
}

.wad-filtro.wad-ativo {
    border-color: var(--wad-verde);
    background: #0d2b22;
    color: var(--wad-verde);
}

.wad-lista {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    transition: opacity .4s;
}

.wad-conv {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 9px 0 6px;
    border-bottom: 1px solid #1f2c34;
    border-left: 3px solid transparent;
    background: var(--wad-fundo);
    transition: border-color .4s;
}

.wad-conv.wad-ativa {
    background: var(--wad-linha);
}

.wad-conv.wad-golpe {
    border-left-color: var(--wad-vermelho);
    background: linear-gradient(90deg, #2a1010 0%, var(--wad-fundo) 75%);
}

.wad-conv.wad-golpe.wad-ativa {
    background: linear-gradient(90deg, #3a1414 0%, var(--wad-linha) 75%);
}

.wad-avatar {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2a3942;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    transition: box-shadow .4s;
}

.wad-c-azul { background: #0369a1; }
.wad-c-rosa { background: #a21caf; }
.wad-c-laranja { background: #b45309; }
.wad-c-verde { background: #047857; }
.wad-c-indigo { background: #4338ca; }

.wad-tipo {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 11px;
    height: 11px;
    border: 2px solid var(--wad-fundo);
    border-radius: 50%;
    background: var(--wad-verde);
}

.wad-tipo.wad-lead {
    background: #f59e0b;
}

.wad-ponto-golpe {
    position: absolute;
    top: -4px;
    right: -4px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: 2px solid var(--wad-fundo);
    border-radius: 50%;
    background: var(--wad-vermelho);
    font-size: 7px;
}

.wad-conv-corpo {
    flex: 1;
    min-width: 0;
}

.wad-conv-nome {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wad-conv-previa {
    display: block;
    margin-top: 2px;
    color: var(--wad-suave);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wad-alerta {
    display: none;
    align-items: center;
    gap: 3px;
    margin-right: 4px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--wad-vermelho);
    color: #fff;
    font-size: 8.5px;
    font-weight: 700;
    vertical-align: 1px;
}

.wad-golpe .wad-alerta {
    display: inline-flex;
    animation: wadSurge .5s cubic-bezier(.3, 1.6, .5, 1);
}

.wad-conv-meta {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.wad-hora {
    color: var(--wad-suave);
    font-size: 9px;
}

.wad-ia {
    padding: 0 5px;
    border-radius: 10px;
    background: var(--wad-roxo);
    font-size: 8.5px;
}

/* ---------- conversa aberta ---------- */
.wad-chat {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    background-color: #0b141a;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23182229' fill-opacity='0.6'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.wad-chat::before {
    content: '';
    position: absolute;
    inset: 42px 0 40px;
    background: url('images/favicon.png') center / 90px no-repeat;
    opacity: .06;
    pointer-events: none;
}

.wad-chat-topo {
    position: relative;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 10px;
    background: var(--wad-barra);
}

.wad-chat-id {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
    transition: opacity .3s;
}

.wad-chat-id .wad-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.wad-chat-info {
    min-width: 0;
}

.wad-chat-nome {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wad-chat-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--wad-suave);
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
}

.wad-colab {
    padding: 0 6px;
    border: 1px solid #1a5272;
    border-radius: 20px;
    background: #0d2d3a;
    color: #53bdeb;
    font-size: 8.5px;
    font-weight: 600;
}

.wad-acoes {
    display: flex;
    flex: none;
    gap: 9px;
    font-size: 9.5px;
    white-space: nowrap;
}

.wad-acao {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #aebac1;
}

.wad-azul { color: #60a5fa; }
.wad-verde { color: var(--wad-verde); }
.wad-laranja { color: #f59e0b; }

.wad-msgs {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    padding: 8px 12px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
    transition: opacity .3s;
}

.wad-chat.wad-trocando .wad-msgs,
.wad-chat.wad-trocando .wad-chat-id,
.wad-app.wad-reiniciando .wad-msgs,
.wad-app.wad-reiniciando .wad-chat-id,
.wad-app.wad-reiniciando .wad-lista {
    opacity: 0;
}

.wad-rolo {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 5px;
}

.wad-divisor {
    align-self: center;
    margin: 2px 0;
    padding: 2px 9px;
    border-radius: 6px;
    background: #182229;
    color: var(--wad-suave);
    font-size: 9px;
}

.wad-msg {
    position: relative;
    max-width: 84%;
    padding: 5px 9px 14px;
    border-radius: 7px;
    font-size: 11px;
    line-height: 1.38;
    overflow-wrap: break-word;
}

.wad-msg-cliente {
    align-self: flex-start;
    border-top-left-radius: 2px;
    background: var(--wad-barra);
    transform-origin: left bottom;
}

.wad-msg-equipe {
    align-self: flex-end;
    border-top-right-radius: 2px;
    background: #005c4b;
    transform-origin: right bottom;
}

.wad-msg-ia {
    align-self: flex-end;
    border: 1px solid rgba(124, 58, 237, .4);
    border-top-right-radius: 2px;
    background: #1a1a2e;
    color: #d6ccff;
    transform-origin: right bottom;
}

.wad-remetente {
    margin-bottom: 1px;
    color: var(--wad-verde);
    font-size: 9.5px;
    font-weight: 700;
}

.wad-msg-hora {
    position: absolute;
    right: 8px;
    bottom: 3px;
    color: var(--wad-suave);
    font-size: 8.5px;
}

.wad-chave {
    padding: 0 1px;
    border-radius: 3px;
    transition: background-color .5s, box-shadow .5s, color .5s;
}

.wad-marcado .wad-chave {
    background: rgba(239, 68, 68, .3);
    box-shadow: inset 0 -2px 0 var(--wad-vermelho);
    color: #fff;
}

.wad-analise {
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    margin: 2px 0;
    padding: 4px 11px;
    border: 1px solid rgba(124, 58, 237, .55);
    border-radius: 999px;
    background: #1d1638;
    color: #c4b5fd;
    font-size: 9.5px;
    font-weight: 600;
    text-align: center;
    transition: background-color .4s, border-color .4s, color .4s;
}

.wad-analise i {
    flex: none;
    animation: wadGira .9s linear infinite;
}

.wad-analise.wad-risco {
    border-color: var(--wad-vermelho);
    background: #3a0d0d;
    color: #fecaca;
    animation: wadPulso 1.4s ease-out 2;
}

.wad-analise.wad-risco i {
    color: #f87171;
    animation: none;
}

.wad-digitando {
    padding-bottom: 7px;
}

.wad-pontos {
    display: flex;
    gap: 3px;
    padding: 3px 0 1px;
}

.wad-pontos span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a78bfa;
    animation: wadPula 1s ease-in-out infinite;
}

.wad-pontos span:nth-child(2) { animation-delay: .15s; }
.wad-pontos span:nth-child(3) { animation-delay: .3s; }

.wad-rodape {
    position: relative;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 10px;
    background: var(--wad-barra);
    color: #aebac1;
    font-size: 12px;
}

.wad-campo {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--wad-linha);
    color: var(--wad-suave);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wad-enviar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--wad-verde);
    color: #fff;
    font-size: 10px;
}

@keyframes wadGira {
    to { transform: rotate(360deg); }
}

@keyframes wadPulso {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); }
    100% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

@keyframes wadPula {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-3px); opacity: 1; }
}

@keyframes wadSurge {
    0% { transform: scale(.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Tamanhos: o quadro olha a largura dele mesmo, não a da tela. */
@container (min-width: 700px) {
    .wad-app { height: 380px; }
    .wad-msg { max-width: 72%; }
}

@container (max-width: 479px) {
    .wad-app { height: 410px; }
    .wad-lateral { width: 50px; }
    .wad-lat-topo { justify-content: center; padding: 0; }
    .wad-marca span,
    .wad-busca,
    .wad-filtros,
    .wad-conv-corpo,
    .wad-conv-meta { display: none; }
    .wad-conv { justify-content: center; height: 50px; padding: 0; }
    .wad-golpe .wad-avatar { box-shadow: 0 0 0 2px var(--wad-vermelho); }
    .wad-golpe .wad-ponto-golpe { display: flex; animation: wadSurge .5s cubic-bezier(.3, 1.6, .5, 1); }
    .wad-msgs { padding: 8px 9px; }
    .wad-msg { max-width: 88%; }
}

@container (max-width: 380px) {
    .wad-app { height: 430px; }
    .wad-msg { font-size: 10.5px; }
    .wad-analise { padding: 4px 9px; border-radius: 12px; font-size: 9px; }
    .wad-rodape { gap: 8px; }
}

@container (max-width: 340px) {
    .wad-seg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .wad-analise i,
    .wad-analise.wad-risco,
    .wad-golpe .wad-alerta,
    .wad-golpe .wad-ponto-golpe,
    .wad-pontos span { animation: none; }
}
