/* ============================================================
   Card de chat no canto do site (estilo Tawk.to)
   Mesma identidade do site: escuro, Montserrat, vermelho #ff0000,
   cantos retos. Tudo prefixado com ws-chat para não colidir com o
   templatemo-style.css (que tem regras globais em a, h1, h3, p...).
   ============================================================ */

.ws-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990; /* abaixo do banner de cookies (9999), acima do resto */
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    transition: bottom .25s ease;
}

.ws-chat *,
.ws-chat *::before,
.ws-chat *::after { box-sizing: border-box; }

/* ===================== Bolha ===================== */

.ws-chat-bolha {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: #ff0000;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, background .2s ease;
}

.ws-chat-bolha:hover { transform: scale(1.07); background: #e00000; }
.ws-chat-bolha:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ws-chat-bolha.ws-ativo { background: #1c1c1c; }

/* Bolinha de online/offline na própria bolha */
.ws-chat-bolha .ws-chat-ponto {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 3px solid #101010;
    background: #666;
}

.ws-chat-ponto.sup-online { background: #2ecc71; }
.ws-chat-ponto.sup-offline { background: #e74c3c; }

.ws-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #fff;
    color: #ff0000;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

/* Etiqueta "Fale com a gente" ao passar o mouse */
.ws-chat-dica {
    position: absolute;
    right: 74px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #1c1c1c;
    border-left: 3px solid #ff0000;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    padding: 8px 13px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, transform .2s, visibility .2s;
    pointer-events: none;
}

.ws-chat-bolha:hover .ws-chat-dica { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }
.ws-chat-bolha.ws-ativo .ws-chat-dica { display: none; }

/* ===================== Card ===================== */

.ws-chat-card {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #141414;
    border: 1px solid #2a2a2a;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wsChatEntrar .22s ease;
}

.ws-chat-card[hidden] { display: none; }

@keyframes wsChatEntrar {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- Topo ----- */

.ws-chat-topo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1c1c1c;
    border-left: 6px solid #ff0000;
    padding: 14px 14px 14px 16px;
}

.ws-chat-topo-info { flex: 1; min-width: 0; }

.ws-chat-titulo {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.ws-chat-status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
    color: #bbb;
    font-size: 12px;
    line-height: 1.35;
}

.ws-chat-status .ws-chat-ponto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #666;
}

.ws-chat-fechar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
}

.ws-chat-fechar:hover { color: #fff; }

/* ----- Corpo ----- */

.ws-chat-corpo {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Tela do formulário */
.ws-chat-form {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 14px;
}

.ws-chat-form[hidden] { display: none; }

.ws-chat-intro {
    color: #ccc;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 0 0 16px;
}

.ws-chat-campo { margin-bottom: 11px; }

.ws-chat-campo input,
.ws-chat-campo textarea,
.ws-chat-envio textarea {
    width: 100%;
    background: #0d0d0d;
    border: 2px solid #2a2a2a;
    border-radius: 0;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
}

.ws-chat-campo textarea { min-height: 92px; resize: vertical; line-height: 1.55; }

.ws-chat-campo input::placeholder,
.ws-chat-campo textarea::placeholder,
.ws-chat-envio textarea::placeholder { color: #666; }

.ws-chat-campo input:focus,
.ws-chat-campo textarea:focus,
.ws-chat-envio textarea:focus { border-color: #ff0000; }

/* Campo-isca: fora da tela, não display:none (alguns robôs ignoram o oculto) */
.ws-chat-isca { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ws-chat-erro {
    background: #2a1414;
    border: 1px solid #5a2020;
    color: #e0a0a0;
    font-size: 12.5px;
    line-height: 1.5;
    padding: 9px 12px;
    margin-bottom: 11px;
}

.ws-chat-erro[hidden] { display: none; }

.ws-chat-botao {
    width: 100%;
    background: #ff0000;
    border: 2px solid #ff0000;
    border-radius: 0;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 12px;
    cursor: pointer;
    transition: background .2s;
}

.ws-chat-botao:hover { background: #d00000; border-color: #d00000; }
.ws-chat-botao:disabled { opacity: .6; cursor: wait; }

.ws-chat-letras {
    color: #666;
    font-size: 11px;
    line-height: 1.5;
    margin: 10px 0 0;
    text-align: center;
}

.ws-chat-letras a { color: #999; font-size: 11px; line-height: inherit; text-decoration: underline; }

/* Tela da conversa */
.ws-chat-conversa {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ws-chat-conversa[hidden] { display: none; }

.ws-chat-faixa {
    flex-shrink: 0;
    background: #101010;
    border-bottom: 1px solid #2a2a2a;
    color: #999;
    font-size: 11.5px;
    line-height: 1.45;
    padding: 8px 14px;
}

.ws-chat-faixa strong { color: #ddd; font-weight: 600; }

/* Foto de quem está atendendo (Etapa 6A) */
.ws-chat-faixa-foto {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin: -3px 8px 0 0;
    border: 1px solid #333;
}

.ws-chat-msgs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 14px 6px;
    overscroll-behavior: contain;
}

.ws-msg { display: flex; flex-direction: column; margin-bottom: 11px; }
.ws-msg-visitante { align-items: flex-end; }
.ws-msg-atendente { align-items: flex-start; }

.ws-msg-balao {
    max-width: 84%;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.ws-msg-visitante .ws-msg-balao { background: #2a1414; border: 1px solid #5a2020; color: #f2e2e2; }
.ws-msg-atendente .ws-msg-balao { background: #222; border: 1px solid #333; color: #e6e6e6; }

.ws-msg-meta { color: #6a6a6a; font-size: 10.5px; margin-top: 4px; }

.ws-msg-sistema { align-items: center; }

.ws-msg-sistema .ws-msg-balao {
    max-width: 92%;
    background: transparent;
    border: 1px dashed #333;
    color: #888;
    font-size: 11.5px;
    text-align: center;
}

.ws-chat-envio {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border-top: 1px solid #2a2a2a;
    padding: 10px;
    background: #141414;
}

.ws-chat-envio[hidden] { display: none; }

.ws-chat-envio textarea {
    flex: 1;
    min-height: 42px;
    max-height: 120px;
    resize: none;
    line-height: 1.45;
}

.ws-chat-enviar {
    flex-shrink: 0;
    width: 44px;
    height: 42px;
    border: none;
    border-radius: 0;
    background: #ff0000;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.ws-chat-enviar:hover { background: #d00000; }
.ws-chat-enviar:disabled { opacity: .6; cursor: wait; }

.ws-chat-encerrado {
    flex-shrink: 0;
    border-top: 1px solid #2a2a2a;
    padding: 14px;
    text-align: center;
    color: #999;
    font-size: 12.5px;
    line-height: 1.5;
}

.ws-chat-encerrado[hidden] { display: none; }

/* Atendimento finalizado: a conversa sai da tela, fica só este aviso (Etapa 6C2) */
/* Setores no formulário (Etapa 7A) */
.ws-chat-setores[hidden] { display: none; }
.ws-chat-setores { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ws-chat-setores-titulo { color: #ddd; font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.ws-chat-setor { display: block; width: 100%; text-align: left; background: #101010; border: 1px solid #2a2a2a; color: #ccc;
                 padding: 9px 11px; cursor: pointer; font-family: inherit; transition: border-color .15s, background .15s; }
.ws-chat-setor:hover { border-color: #555; }
.ws-chat-setor strong { display: block; color: #fff; font-size: 13px; }
.ws-chat-setor span { display: block; color: #888; font-size: 11.5px; margin-top: 2px; line-height: 1.4; }
.ws-chat-setor.ativo { border-color: #ff0000; background: #1a0d0d; }

.ws-chat-finalizado {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    line-height: 1.6;
    padding: 28px 12px;
}
.ws-chat-finalizado i { display: block; font-size: 30px; color: #1e7e34; margin-bottom: 10px; }
.ws-chat-finalizado strong { display: block; color: #fff; font-size: 14px; margin-bottom: 6px; }
.ws-chat-finalizado p { margin: 0; }

/* Avaliação do atendimento (Etapa 6F) */
.ws-chat-avaliar { margin: 4px 12px 16px; padding: 16px 14px; border: 1px solid #2a2a2a; background: #141414; text-align: center; }
.ws-chat-avaliar strong { display: block; color: #fff; font-size: 13.5px; margin-bottom: 8px; }
.ws-chat-avaliar p { margin: 6px 0 0; color: #aaa; font-size: 12.5px; }
.ws-chat-estrelas { display: inline-flex; gap: 4px; }
.ws-chat-estrelas button { background: none; border: none; padding: 0 2px; font-size: 28px; line-height: 1; color: #444; cursor: pointer; transition: color .12s, transform .12s; }
.ws-chat-estrelas button.on { color: #ffb400; }
.ws-chat-estrelas button:hover { transform: scale(1.12); }
.ws-chat-avaliar textarea { width: 100%; margin-top: 10px; background: #0d0d0d; border: 1px solid #333; color: #eee; padding: 8px 10px; font-family: inherit; font-size: 13px; resize: none; }
.ws-chat-avaliar textarea[hidden] { display: none; }
.ws-chat-avaliar-enviar { margin-top: 10px; background: transparent; border: 2px solid #fff; color: #fff; font-family: inherit; font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 8px 14px; cursor: pointer; }
.ws-chat-avaliar-enviar:hover:not(:disabled) { background: #ff0000; border-color: #ff0000; }
.ws-chat-avaliar-enviar:disabled { opacity: .4; cursor: default; }
.ws-chat-avaliar-erro { color: #e0a0a0; font-size: 12px; min-height: 0; margin-top: 6px; }
.ws-chat-estrelas-lidas { color: #ffb400; font-size: 24px; letter-spacing: 3px; }

.ws-chat-encerrado button {
    margin-top: 10px;
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 9px 16px;
    cursor: pointer;
}

.ws-chat-encerrado button:hover { background: #ff0000; border-color: #ff0000; }

/* ----- WhatsApp no rodapé do card ----- */

.ws-chat-whats {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid #2a2a2a;
    background: #101010;
    color: #9ad8a8;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    padding: 11px 14px;
    text-decoration: none;
    transition: background .2s, color .2s;
}

.ws-chat-whats i { font-size: 17px; }

.ws-chat-whats:hover,
.ws-chat-whats:focus { background: #13291a; color: #c6f0d0; text-decoration: none; }

/* Fora do horário o WhatsApp vira o destaque do card */
.ws-chat-whats.ws-destaque {
    background: #00a035;
    color: #fff;
    font-size: 13.5px;
    padding: 14px;
}

.ws-chat-whats.ws-destaque:hover { background: #008a2d; color: #fff; }

/* ===================== Celular ===================== */

@media (max-width: 480px) {
    .ws-chat { right: 14px; bottom: 14px; }

    .ws-chat-bolha { width: 56px; height: 56px; font-size: 23px; }
    .ws-chat-dica { display: none; }

    /* Card vira painel quase de tela cheia, ancorado embaixo */
    .ws-chat-card {
        position: fixed;
        right: 8px;
        left: 8px;
        bottom: 78px;
        width: auto;
        max-width: none;
        height: auto;
        top: 12px;
        max-height: none;
    }

    /* Evita o zoom automático do iPhone ao focar campo com fonte < 16px */
    .ws-chat-campo input,
    .ws-chat-campo textarea,
    .ws-chat-envio textarea { font-size: 16px; }
}
