/* =========================================================================
   Viral Machine Pro - Support Chat Widget
   Styles for the Floating AI Support Chat in SaaS Dashboard
   ========================================================================= */

#vmp-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999999;
    /* Higher than .vmp-saas-layout (999999) */
    font-family: 'Inter', sans-serif;
}

#vmp-chat-icon {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#vmp-chat-icon svg {
    width: 32px;
    height: 32px;
    color: #fff;
    transition: transform 0.3s ease;
}

#vmp-chat-icon:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

#vmp-chat-icon.open svg {
    transform: rotate(90deg);
}

#vmp-chat-box {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 140px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f8fafc;
    transform-origin: bottom right;
}

#vmp-chat-header {
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

#vmp-chat-header svg {
    width: 20px;
    height: 20px;
    color: #8b5cf6;
}

#vmp-chat-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#vmp-chat-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

#vmp-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

#vmp-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#vmp-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#vmp-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.3);
    border-radius: 10px;
}

.vmp-chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    animation: vmpMsgSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: bottom center;
}

@keyframes vmpMsgSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.vmp-chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.vmp-chat-message.bot {
    align-self: flex-start;
    background: rgba(51, 65, 85, 0.8);
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Base Typing Indicator */
.vmp-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px !important;
    width: fit-content;
}

.vmp-typing-indicator span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #94a3b8;
    animation: vmpTyping 1.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.vmp-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.vmp-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes vmpTyping {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

#vmp-chat-black-extra {
    padding: 0 20px 10px 20px;
}

.vmp-btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.vmp-btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.vmp-btn-whatsapp svg {
    width: 18px;
    height: 18px;
}

#vmp-chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
}

#vmp-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.8);
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

#vmp-chat-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(30, 41, 59, 1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

#vmp-chat-input::placeholder {
    color: #64748b;
}

#vmp-chat-send {
    width: 44px;
    height: 44px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#vmp-chat-send svg {
    width: 18px;
    height: 18px;
    margin-left: -2px;
    /* Optical alignment for send icon */
}

#vmp-chat-send:hover {
    background: #7c3aed;
    transform: scale(1.05);
}

#vmp-chat-send:active {
    transform: scale(0.95);
}

/* Animations */
.vmp-fade-in {
    animation: vmpFadeIn 0.4s ease-out;
}

@keyframes vmpFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    #vmp-chat-box {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    #vmp-chat-widget {
        bottom: 20px;
        right: 20px;
    }
}