/* 
    ================================================
    ENGINE DE CHAT PREMIUM - v2.9 (AZUL ASSISTENTE)
    ================================================
    Arquiteto: Rodrigo Vieira
    Estilo: Liquid Glass Vibrante + Animações Pro
*/

/* 1. CONTAINER PRINCIPAL */
#chat-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* 2. GATILHO / BOTÃO PILL (ESTILO ASSISTENTE) */
#chat-trigger {
    width: auto;
    height: 52px;
    padding: 0 25px;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10000;

    /* AZUL VIBRANTE OPACO (Para vencer o fundo escuro) */
    background: rgba(0, 102, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);

    /* BORDAS E BRILHO DE VIDRO */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.5);

    /* GLOW AZUL POTENTE */
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 102, 255, 0.5);

    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chat-trigger:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(0, 102, 255, 1);
    /* Sólido no hover */
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 102, 255, 0.8);
}

/* CONTEÚDO DO BOTÃO (ÍCONE E TEXTO) */
.trigger-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trigger-content span {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.trigger-content svg {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.4));
}

/* 3. NOTIFICAÇÃO (BADGE VERMELHA) */
.chat-badge {
    position: absolute;
    top: -5px;
    right: 5px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 7px;
    border-radius: 50%;
    border: 2px solid #070110;
    z-index: 10001;
    display: none;
    /* Controlado pelo JS */
}

/* 4. JANELA DO CHAT */
#chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 550px;
    display: none;
    flex-direction: column;
    animation: chatAppear 0.4s ease-out;
    border-radius: 24px;

    /* FUNDO DARK GLASS */
    background: rgba(15, 5, 25, 0.9);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 102, 255, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

/* 5. ÁREA DE MENSAGENS */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.msg.bot {
    align-self: flex-start;
}

.msg.user {
    align-self: flex-end;
}

/* BOLHAS DE MENSAGEM */
.msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    animation: msgReveal 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.user .msg-bubble {
    background: #0066ff;
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 102, 255, 0.3);
}

/* 6. STATUS: PENSANDO / DIGITANDO */
.status-text {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(255, 255, 255, 0.1) !important;
}

.dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.dot {
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    animation: dotBlink 1.4s infinite both;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* 7. HEADER DO CHAT */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-wrapper {
    position: relative;
}

.avatar-wrapper img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #0066ff;
    object-fit: cover;
}

.online-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #070110;
}

.chat-name {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

.chat-status {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: 0.3s;
}

.chat-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* 8. INPUT E FOOTER */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

#user-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 12px 20px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: 0.3s;
}

#user-input:focus {
    border-color: #0066ff;
    background: rgba(255, 255, 255, 0.08);
}

#send-btn {
    background: #0066ff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}

#send-btn:hover {
    transform: scale(1.1);
    background: #3385ff;
}

/* 9. OPÇÕES RÁPIDAS */
.quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.quick-replies button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 15px;
    border-radius: 50px;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}

.quick-replies button:hover {
    background: rgba(0, 102, 255, 0.2);
    border-color: #0066ff;
}

/* 10. ANIMAÇÕES (KEYFRAMES) */
@keyframes chatAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes msgReveal {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dotBlink {
    0% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    20% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
}

/* SCROLLBAR CUSTOM */
#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 255, 0.3);
    border-radius: 10px;
}