/* VinFast AI Chatbot - Glassmorphism UI */
#vf-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 5px; /* Sát lề phải */
    z-index: 99998;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#vf-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1464f4 0%, #0d47a1 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(20, 100, 244, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

#vf-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(20, 100, 244, 0.6);
}

.vf-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Glassmorphism */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.vf-chatbot-hidden .vf-chatbot-window {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
    visibility: hidden !important;
}

.vf-chatbot-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(20, 100, 244, 0.9) 0%, rgba(13, 71, 161, 0.9) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.vf-chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}

#vf-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#vf-chatbot-close:hover {
    opacity: 1;
}

.vf-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vf-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.vf-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.vf-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.vf-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: vf-fade-in-up 0.3s ease forwards;
}

.vf-chat-message.user {
    align-self: flex-end;
}

.vf-chat-message.bot {
    align-self: flex-start;
}

.vf-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.vf-chat-message.user .vf-msg-bubble {
    background: #1464f4;
    color: white;
    border-bottom-right-radius: 4px;
}

.vf-chat-message.bot .vf-msg-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

/* Markdown formatting in bot messages */
.vf-chat-message.bot .vf-msg-bubble p { margin: 0 0 10px 0; }
.vf-chat-message.bot .vf-msg-bubble p:last-child { margin: 0; }
.vf-chat-message.bot .vf-msg-bubble strong { color: #1464f4; }
.vf-chat-message.bot .vf-msg-bubble ul { margin: 5px 0; padding-left: 20px; }
.vf-chat-message.bot .vf-msg-bubble a {
    color: #1464f4;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}
.vf-chat-message.bot .vf-msg-bubble a:hover {
    color: #0d47a1;
}

.vf-chatbot-input-area {
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
}

#vf-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#vf-chatbot-input:focus {
    border-color: #1464f4;
    box-shadow: 0 0 0 2px rgba(20, 100, 244, 0.1);
}

#vf-chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1464f4;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

#vf-chatbot-send:hover {
    background: #0d47a1;
    transform: scale(1.05);
}

#vf-chatbot-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Loading Dots */
.vf-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.vf-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #1464f4;
    border-radius: 50%;
    animation: vf-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes vf-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes vf-fade-in-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .vf-chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #vf-chatbot-container {
        bottom: 85px;
        right: 5px; /* Sát lề phải trên mobile */
        left: auto;
    }

    #vf-chatbot-toggle {
        width: 46px;
        height: 46px;
    }

    #vf-chatbot-input {
        font-size: 16px;
    }
}
