/* ====== CHAT IA STYLES ====== */

/* Botão Flutuante - Sutil, leve e integrado à identidade (Verde Esmeralda) */
.btn-chat-flutuante {
    position: fixed;
    top: 5.5rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.85);
    color: #10b981; /* emerald-500 */
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-chat-flutuante:hover {
    transform: scale(1.08) translateY(-2px);
    background: #10b981;
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.btn-chat-flutuante:active {
    transform: scale(0.95);
}

/* Modal do Chat */
.modal-chat-ia {
    position: fixed;
    top: 9rem;
    right: 2rem;
    width: 380px;
    max-height: 550px;
    height: 75vh;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(16, 185, 129, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    animation: slideDownFade 0.3s ease forwards;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-cabecalho {
    background: linear-gradient(135deg, #059669, #10b981); /* Tonalidades de esmeralda */
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 2;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-fechar {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}

.btn-fechar:hover {
    opacity: 1;
}

.chat-mensagens {
    flex: 1;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    
    /* Efeito de fundo sutil com pontos esmeralda simulando uma malha/blueprint */
    background-color: #f8fafc;
    background-image: radial-gradient(rgba(16, 185, 129, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0;
}

.mensagem {
    max-width: 85%;
    padding: 0.85rem 1.15rem;
    border-radius: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: fadeMessage 0.3s ease-out;
}

@keyframes fadeMessage {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mensagem da IA */
.mensagem.bot {
    background: white;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* Mensagem do Usuário */
.mensagem.user {
    background: #10b981; 
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid rgba(16, 185, 129, 0.1);
    display: flex;
    gap: 0.5rem;
    z-index: 2;
}

#chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    outline: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    background: #f8fafc;
}

#chat-input:focus {
    border-color: #10b981;
    background: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.btn-enviar {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-enviar:hover {
    background: #059669;
    transform: scale(1.05);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background: white;
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 1rem;
    align-self: flex-start;
    width: fit-content;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .modal-chat-ia {
        width: calc(100% - 2rem);
        right: 1rem;
        left: 1rem;
        top: 9rem;
    }
}
