/* AI 客服聊天样式 */
.ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* 悬浮按钮 */
.ai-chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: absolute;
    bottom: 300px;
    right: 0;
}

.ai-chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-chat-toggle-btn.active {
    transform: rotate(135deg);
}

/* 聊天窗口 */
.ai-chat-window {
    width: 360px;
    max-height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: absolute;
    bottom: 70px;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 聊天头部 */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header h3 {
    color: white;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.ai-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 消息列表 */
.ai-chat-messages {
    height: 350px;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* 消息项 */
.ai-chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.ai-chat-message.user {
    justify-content: flex-end;
}

.ai-chat-message.assistant {
    justify-content: flex-start;
}

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

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

.ai-chat-message.assistant .ai-chat-avatar {
    background: #e9ecef;
    color: #666;
}

.ai-chat-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-chat-message.user .ai-chat-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.ai-chat-message.assistant .ai-chat-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 空状态 */
.ai-chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 加载状态 */
.ai-chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.ai-chat-loading-dots {
    display: flex;
}

.ai-chat-loading-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    margin: 0 3px;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.ai-chat-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chat-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.ai-chat-loading-dot:nth-child(3) {
    animation-delay: 0s;
}

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

/* 输入区域 */
.ai-chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.ai-chat-input:focus {
    border-color: #667eea;
}

.ai-chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 40px);
        max-height: 70vh;
    }
    
    .ai-chat-messages {
        height: calc(70vh - 140px);
    }
    
    .ai-chat-bubble {
        max-width: 85%;
    }
}