/* Chatbot Flutuante - Impacto Designer */

/* ============================================
   BOTÃO FLUTUANTE
   ============================================ */

/* Botão circular fixo no canto inferior direito */
.chatbot-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--cor-primaria);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(61, 95, 192, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    border: none;
    animation: chatbot-pulse 2s infinite;
}

/* Efeito hover no botão */
.chatbot-float:hover {
    background: #2a4a9e;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(61, 95, 192, 0.6);
}

/* Estado ativo (chat aberto) - remove pulso e muda cor */
.chatbot-float.active {
    animation: none;
    background: #555;
}

/* Animação de pulso para chamar atenção */
@keyframes chatbot-pulse {
    0% { box-shadow: 0 4px 12px rgba(61, 95, 192, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(61, 95, 192, 0.8), 0 0 0 10px rgba(61, 95, 192, 0.1); }
    100% { box-shadow: 0 4px 12px rgba(61, 95, 192, 0.4); }
}

/* ============================================
   JANELA DO CHAT
   ============================================ */

/* Container da janela de chat (fixa na tela) */
.chatbot-window {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 520px;
    max-height: calc(100vh - 10rem);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

/* Estado aberto da janela */
.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   HEADER DO CHAT
   ============================================ */

/* Barra superior com gradiente azul */
.chatbot-header {
    background: linear-gradient(135deg, #4c74e0 0%, #062886 100%);
    color: white;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

/* Avatar/ícone do atendente */
.chatbot-header-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Título e subtítulo do header */
.chatbot-header-info h4 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    text-shadow: none;
}

.chatbot-header-info span {
    font-size: 0.75rem;
    color: #bfdbfe;
}

/* Botão de fechar (X) */
.chatbot-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-close:hover {
    opacity: 1;
}

/* ============================================
   CORPO DO CHAT (área de mensagens)
   ============================================ */

/* Container scrollável das mensagens */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: #f8f9fa;
}

/* ============================================
   MENSAGENS
   ============================================ */

/* Estilo base das mensagens */
.chatbot-msg {
    max-width: 85%;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: msgFadeIn 0.3s ease;
}

/* Animação de entrada das mensagens */
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mensagem do bot (lado esquerdo, fundo branco) */
.chatbot-msg.bot {
    background: white;
    color: #333;
    border: 1px solid #e5e7eb;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Mensagem do usuário (lado direito, fundo azul) */
.chatbot-msg.user {
    background: var(--cor-primaria);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Mensagem de sistema (centralizada, fundo azul claro) */
.chatbot-msg.system {
    background: #dbeafe;
    color: #1e40af;
    align-self: center;
    text-align: center;
    font-size: 0.8rem;
    border: 1px solid #93c5fd;
}

/* ============================================
   BOTÕES DE OPÇÃO
   ============================================ */

/* Container dos botões de opção */
.chatbot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-self: flex-start;
    max-width: 90%;
    animation: msgFadeIn 0.3s ease;
}

/* Estilo de cada botão de opção */
.chatbot-option-btn {
    background: white;
    color: var(--cor-primaria);
    border: 2px solid var(--cor-primaria);
    padding: 0.5rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Hover nos botões de opção */
.chatbot-option-btn:hover {
    background: var(--cor-primaria);
    color: white;
    transform: translateY(-1px);
}

/* Ícone dentro do botão */
.chatbot-option-btn i {
    font-size: 0.8rem;
}

/* ============================================
   FORMULÁRIO DENTRO DO CHAT
   ============================================ */

/* Container do formulário */
.chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    animation: msgFadeIn 0.3s ease;
}

/* Labels dos campos */
.chatbot-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

/* Inputs e textarea do formulário */
.chatbot-form input,
.chatbot-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

/* Focus nos campos do formulário */
.chatbot-form input:focus,
.chatbot-form textarea:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 2px rgba(61, 95, 192, 0.15);
}

/* Textarea redimensionável */
.chatbot-form textarea {
    resize: vertical;
    min-height: 70px;
}

/* Grid de 2 colunas para Nome/E-mail */
.chatbot-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Container dos botões de ação (Enviar/Voltar) */
.chatbot-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

/* Botão Enviar */
.chatbot-btn-send {
    background: var(--cor-primaria);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Hover no botão Enviar */
.chatbot-btn-send:hover {
    background: #2a4a9e;
}

/* Estado desabilitado do botão Enviar */
.chatbot-btn-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Botão Voltar */
.chatbot-btn-back {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover no botão Voltar */
.chatbot-btn-back:hover {
    background: #e5e7eb;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

/* Indicador de carregamento circular */
.chatbot-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff80;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Rotação do spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   INDICADOR DE DIGITANDO
   ============================================ */

/* Bolinhas animadas "digitando..." */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 0.7rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Cada bolinha do indicador */
.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.2s infinite;
}

/* Atraso escalonado para efeito de onda */
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Animação das bolinhas */
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ============================================
   HONEYPOT (PROTEÇÃO ANTI-SPAM)
   ============================================ */

/* Campo oculto - bots preenchem, humanos não veem */
.chatbot-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* ============================================
   SCROLLBAR PERSONALIZADA
   ============================================ */

.chatbot-body::-webkit-scrollbar {
    width: 5px;
}

.chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* ============================================
   RESPONSIVE (MOBILE)
   ============================================ */

@media (max-width: 480px) {
    /* Botão flutuante menor no mobile */
    .chatbot-float {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 54px;
        height: 54px;
        font-size: 1.3rem;
    }

    /* Janela do chat ocupa toda a tela no mobile */
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Formulário em coluna única no mobile */
    .chatbot-form-row {
        grid-template-columns: 1fr;
    }
}
