/* Chatbot Widget — Nehood */

:root {
    --chatbot-primary: #e63946;
    --chatbot-primary-dark: #c1121f;
    --chatbot-bg: #ffffff;
    --chatbot-surface: #f7f7f7;
    --chatbot-text: #1a1a1a;
    --chatbot-muted: #666;
    --chatbot-border: #e0e0e0;
    --chatbot-shadow: 0 8px 32px rgba(0,0,0,0.18);
    --chatbot-radius: 16px;
}

/* Floating button */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(230,57,70,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(230,57,70,0.5);
}
.chatbot-fab svg {
    width: 26px;
    height: 26px;
}
.chatbot-fab.hidden {
    display: none;
}

/* Chat window */
.chatbot-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--chatbot-primary);
    color: #fff;
}
.chatbot-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chatbot-header__avatar svg {
    width: 20px;
    height: 20px;
    color: #fff;
}
.chatbot-header__info {
    flex: 1;
    min-width: 0;
}
.chatbot-header__name {
    font-weight: 600;
    font-size: 0.95rem;
}
.chatbot-header__status {
    font-size: 0.75rem;
    opacity: 0.85;
}
.chatbot-header__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.chatbot-header__close:hover {
    opacity: 1;
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--chatbot-surface);
}

.chatbot-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-wrap: break-word;
}
.chatbot-msg--user {
    align-self: flex-end;
    background: var(--chatbot-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chatbot-msg--bot {
    align-self: flex-start;
    background: var(--chatbot-bg);
    color: var(--chatbot-text);
    border: 1px solid var(--chatbot-border);
    border-bottom-left-radius: 4px;
}
.chatbot-msg--bot a {
    color: var(--chatbot-primary);
    font-weight: 500;
}
.chatbot-msg--typing {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
}
.chatbot-msg--typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chatbot-muted);
    animation: chatDot 1.2s infinite ease-in-out;
}
.chatbot-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Feedback buttons */
.chatbot-feedback {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.chatbot-feedback button {
    background: none;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 0.72rem;
    color: var(--chatbot-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.chatbot-feedback button:hover {
    background: var(--chatbot-primary);
    color: #fff;
    border-color: var(--chatbot-primary);
}

/* Input area */
.chatbot-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--chatbot-border);
    background: var(--chatbot-bg);
}
.chatbot-input input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.chatbot-input input:focus {
    border-color: var(--chatbot-primary);
}
.chatbot-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.chatbot-input button:hover {
    background: var(--chatbot-primary-dark);
}
.chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .chatbot-fab {
        bottom: 16px;
        right: 16px;
    }
}

/* Chatbot V2 — Quick Reply Opcoes */
.chatbot-opcoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-opcao-btn {
    background: var(--chatbot-bg);
    color: var(--chatbot-primary);
    border: 1px solid var(--chatbot-primary);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.chatbot-opcao-btn:hover {
    background: var(--chatbot-primary);
    color: #fff;
    transform: translateY(-1px);
}

.chatbot-opcao-btn:active {
    transform: translateY(0);
}

/* Indicador de precisao de esclarecimento */
.chatbot-msg--clarificacao {
    border-left: 3px solid #f59e0b;
}

/* ═══ Convivência com barras fixas inferiores (E-025/E-026) ═══
   .nh-bottomnav = 64px mobile (z 9998, oculto ≥769px) · .ck-bottom-bar = ~76px (z 100)
   O FAB (z 9999) precisa subir acima delas para não cobrir a navegação
   nem o botão de pagamento. `:has()` tem suporte universal (2026). */
@media (max-width:768px){
    body:has(.nh-bottomnav) .chatbot-fab {
        bottom: 80px;
    }
}
body:has(.ck-bottom-bar) .chatbot-fab {
    bottom: 92px;
}
