/* Manh Duc AI Assistant - Modern Chat Widget */
#mdai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.mdai-chat-button {
    width: 60px;
    height: 60px;
    background: var(--mdai-primary, #2563eb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    font-size: 28px;
    color: white;
}

.mdai-chat-button:hover {
    background: var(--mdai-primary-hover, #1d4ed8);
    transform: scale(1.05);
}

.mdai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 35px -10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

#mdai-chat-widget.mdai-chat-open .mdai-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.mdai-chat-header {
    background: var(--mdai-primary, #2563eb);
    color: white;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mdai-chat-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.mdai-chat-close:hover {
    opacity: 1;
}

.mdai-chat-messages {
    height: 380px;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mdai-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeInUp 0.2s ease;
}

.mdai-message.user {
    background: var(--mdai-primary, #2563eb);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.mdai-message.bot {
    background: #e5e7eb;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.mdai-chat-input-area {
    display: flex;
    border-top: 1px solid #e2e8f0;
    background: white;
    padding: 12px;
    gap: 8px;
    align-items: flex-end;
}

#mdai-user-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
    transition: border 0.2s;
}

#mdai-user-input:focus {
    outline: none;
    border-color: var(--mdai-primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

#mdai-send-btn {
    background: var(--mdai-primary, #2563eb);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
}

#mdai-send-btn:hover {
    background: var(--mdai-primary-hover, #1d4ed8);
}

.mdai-typing {
    padding: 8px 16px;
    font-size: 0.8rem;
    color: #6b7280;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    display: none;
}

.mdai-typing.active {
    display: block;
}

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

/* Responsive */
@media (max-width: 480px) {
    .mdai-chat-window {
        width: calc(100vw - 30px);
        right: 0;
        bottom: 70px;
    }
    .mdai-chat-messages {
        height: 320px;
    }
}