#upgyn-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

#chat-launcher {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-dark);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

#chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
}

.chat-open #chat-window {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-info img {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    /* Torna a imagem circular para estilo de avatar */
    padding: 0;
    /* Remove o padding para a imagem ocupar tudo */
    object-fit: cover;
    /* Garante que a imagem preencha o espaço sem distorcer */
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.header-info h3 {
    font-size: 1rem;
    margin: 0;
}

.header-info span {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
}

.close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

#chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 1rem;
    font-size: 0.92rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
    background: white;
    color: var(--dark);
    border-bottom-left-radius: 2px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 1.2rem;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 1rem;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--primary);
}

.chat-input-area button {
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input-area button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Typing indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 1rem;
    width: fit-content;
}

.typing span {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    #chat-window {
        width: calc(100vw - 40px);
        height: 80vh;
        bottom: 80px;
    }
}