/* ============================================================
   Chat do agente de IA do site. Tema claro + accent azul (igual ao site).
   Launcher flutuante acima do WhatsApp, painel ancorado no canto.
   ============================================================ */

.tg-chat-launch {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: var(--accent, #1283c4);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(18, 131, 196, .38);
    transition: opacity .3s ease, transform .3s ease, box-shadow .2s ease, visibility .3s ease;
}

/* Home no mobile: escondido na 1ª dobra, o chat.js tira o is-hidden quando a
   tela desce depois do pin do hero. */
.tg-chat-launch.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(.9);
    pointer-events: none;
}

.tg-chat-launch:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(18, 131, 196, .5);
}

.tg-chat-launch svg {
    width: 28px;
    height: 28px;
}

.tg-chat-launch .tg-chat-dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #25d366;
    box-shadow: 0 0 0 3px var(--accent, #1283c4);
}

.tg-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 40px));
    background: var(--light, #fff);
    border: 1px solid var(--line, rgba(0, 0, 0, .1));
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.98);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    font-family: var(--font-body, sans-serif);
}

.tg-chat-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.tg-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--dark, #0d0d0d);
    color: #fff;
}

.tg-chat-head-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent, #1283c4);
    font-family: var(--font-display, sans-serif);
    font-weight: 700;
}

.tg-chat-head-info {
    flex: 1;
    line-height: 1.3;
}

.tg-chat-head-info strong {
    display: block;
    font-size: 15px;
    font-family: var(--font-display, sans-serif);
}

.tg-chat-head-info span {
    font-size: 12px;
    color: rgba(255, 255, 255, .7);
}

.tg-chat-wpp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #25d366;
    background: rgba(37, 211, 102, .14);
    transition: background .15s ease;
}

.tg-chat-wpp:hover { background: rgba(37, 211, 102, .26); }
.tg-chat-wpp svg { width: 19px; height: 19px; }

.tg-chat-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .8);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}

.tg-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg, #f4f4f4);
}

.tg-chat-msg {
    max-width: 84%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tg-chat-msg a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* links nas mensagens do agente: cor de destaque + sublinhado (clicáveis) */
.tg-chat-msg.is-bot a,
.tg-chat-link {
    color: var(--accent, #1283c4);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tg-chat-msg.is-bot a:hover,
.tg-chat-link:hover {
    color: var(--accent-deep, #0a5a8a);
}

.tg-chat-msg.is-bot {
    align-self: flex-start;
    background: var(--light, #fff);
    color: var(--dark, #0d0d0d);
    border: 1px solid var(--line, rgba(0, 0, 0, .08));
    border-bottom-left-radius: 4px;
}

.tg-chat-msg.is-user {
    align-self: flex-end;
    background: var(--accent, #1283c4);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tg-chat-typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 4px;
    padding: 12px 14px;
    background: var(--light, #fff);
    border: 1px solid var(--line, rgba(0, 0, 0, .08));
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.tg-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted, #808080);
    animation: tg-chat-bounce 1.2s infinite ease-in-out;
}

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

@keyframes tg-chat-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

.tg-chat-foot {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--line, rgba(0, 0, 0, .1));
    background: var(--light, #fff);
}

.tg-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--line, rgba(0, 0, 0, .15));
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14.5px;
    max-height: 110px;
    color: var(--dark, #0d0d0d);
    background: var(--bg, #f4f4f4);
}

.tg-chat-input:focus {
    outline: none;
    border-color: var(--accent, #1283c4);
}

.tg-chat-send {
    flex: 0 0 auto;
    width: 44px;
    border: none;
    border-radius: 12px;
    background: var(--accent, #1283c4);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.tg-chat-send:hover { background: var(--accent-deep, #0a5a8a); }
.tg-chat-send:disabled { opacity: .5; cursor: default; }
.tg-chat-send svg { width: 20px; height: 20px; }

@media (max-width: 480px) {
    .tg-chat-panel {
        right: 8px;
        bottom: 8px;
        height: min(72vh, 560px);
    }
    .tg-chat-launch { right: 16px; bottom: 16px; }
}
