<style>
/* AI Chat Widget Container */
#aiChatWidget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 2147483646;
    border: 1px solid rgba(148, 163, 184, 0.3);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#aiChatWidget.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* AI Chat Header */
#aiChatHeader {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ai-chat-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.ai-chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-chat-header-text h5 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.ai-chat-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

#aiChatHeader h5 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

#aiChatClose {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#aiChatClose:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#aiChatClose i {
    font-size: 20px;
}

#aiChatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.chat-message.ai .chat-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chat-message.user .chat-avatar {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-message.ai .chat-bubble {
    background: rgba(100, 116, 139, 0.2);
    color: #e5e7eb;
    border-radius: 16px 16px 16px 4px;
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

#aiChatInput {
    padding: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    gap: 10px;
}

#aiChatInput input {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
}

#aiChatInput input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#aiChatInput button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#aiChatInput button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#aiChatInput button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}


/* AI Chat Support Button */
.ai-chat-support-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
    border: none;
}

.ai-chat-support-btn i {
    color: white;
    font-size: 28px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.ai-chat-support-btn .support-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-left: 8px;
    opacity: 0;
    max-width: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.ai-chat-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.7);
}

.ai-chat-support-btn:hover i {
    transform: scale(1.1);
}

@media (min-width: 769px) {
    .ai-chat-support-btn:hover {
        width: 140px;
        border-radius: 30px;
    }
    
    .ai-chat-support-btn:hover .support-text {
        opacity: 1;
        max-width: 80px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #aiChatWidget {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        right: 20px;
        bottom: 90px;
    }
    
    .ai-chat-support-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .ai-chat-support-btn i {
        font-size: 24px;
    }
}
</style>
