/* CONTAINER PRINCIPAL */
#chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.18);
    font-family: "Segoe UI", Arial, sans-serif;
    color: #101218;
    z-index: 9999;
    display: none; /* JS controla a exibição */
    flex-direction: column;
    overflow: hidden;
}

/* NOVO: BOTÃO FLUTUANTE (LAUNCHER) */
#chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 65px;
    height: 65px;
    background: #3A6BB2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(58, 107, 178, 0.3);
    z-index: 9998;
    display: none; /* Aparece após 3s via JS */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid #fff;
}

#chat-launcher:hover {
    transform: scale(1.1);
}

#chat-launcher img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* NOVO: BADGE DE NOTIFICAÇÃO */
.launcher-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4d4f; /* Vermelho vibrante */
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* HEADER */
#chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

#chat-header img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: #3A6BB2;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #28c76f;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(40,199,111,.8);
}

#chat-close {
    margin-left: auto;
    cursor: pointer;
    font-size: 22px;
    color: #888;
    transition: .2s;
}

#chat-close:hover { color: #000; }

/* ÁREA DE MENSAGENS */
#chat-messages {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
    background: linear-gradient(#fafafa,#fdfdfd);
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

/* BALÕES */
.me {
    align-self: flex-end;
    background: #f2f2f2;
    color: #222;
    border: 1px solid #ddd;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    margin: 6px 0 6px auto;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
}

.bot {
    align-self: flex-start;
    background: #e8f1ff;
    color: #101218;
    border: 1px solid #3A6BB2;
    padding: 10px 14px;
    border-radius: 14px 14px 14px 4px;
    margin: 6px 0;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
}

/* BOTÕES DE SUGESTÃO */
.sug {
    display: inline-block;
    background: #3A6BB2;
    color: #fff;
    border: none;
    padding: 8px 14px;
    margin: 4px 3px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: .2s;
    box-shadow: 0 2px 6px rgba(58, 107, 178, 0.2);
}

.sug:hover {
    background: #2f5795;
    transform: translateY(-1px);
}

/* INPUT */
#chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

#chat-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: .2s;
}

#chat-input input:focus {
    border-color: #3A6BB2;
    box-shadow: 0 0 0 2px rgba(58,107,178,.15);
}

#chat-input button {
    background: #3A6BB2;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}

/* MOBILE RESPONSIVO */
@media (max-width: 768px) {
    #chatbot {
        width: 100% !important;
        height: 100% !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
    }
    
    #chat-launcher {
        bottom: 15px;
        right: 15px;
        width: 60px;
        height: 60px;
    }

    #chat-input input {
        font-size: 16px; /* Evita zoom automático no iPhone */
    }
}

/* Botão de Link (CTA de Venda) */
.btn-link-cta {
    display: block; /* Ocupa a largura disponível para destaque */
    background: #28c76f; /* Verde para remeter a compra/sucesso */
    color: #fff;
    border: none;
    padding: 10px 16px;
    margin: 8px 3px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: .3s;
    box-shadow: 0 4px 12px rgba(40, 199, 111, 0.3);
    text-align: center;
}

.btn-link-cta:hover {
    background: #21a35a;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(40, 199, 111, 0.4);
}

/* Ajuste para as sugestões normais não colarem nos CTAs */
.sug {
    opacity: 0.9;
}
