/* ========== AI 智能客服 ========== */
.ai-chat-fixed {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9998;
}

/* 聊天按钮 */
.ai-chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

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

/* 在线状态指示 */
.ai-chat-btn::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* 聊天窗口 */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

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

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

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

.ai-chat-header-text h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ai-chat-header-text p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

.ai-chat-close {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s;
}

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

/* 聊天消息区 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fc;
}

.ai-message {
    margin-bottom: 12px;
    display: flex;
}

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

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

.ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-message.bot .ai-message-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ai-message.bot .ai-message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    margin-right: 8px;
}

.ai-message.user .ai-message-avatar {
    background: #e0e0e0;
    color: #666;
    margin-left: 8px;
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-message h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.welcome-message p {
    color: #666;
    font-size: 0.85rem;
}

/* 快捷问题按钮 */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.quick-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-btn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-color: transparent;
}

/* 聊天输入区 */
.ai-chat-input {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.ai-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s;
}

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

.ai-chat-input button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.ai-chat-input button:hover {
    transform: scale(1.05);
}

.ai-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-chat-fixed {
        bottom: 80px;
        right: 16px;
    }
    .ai-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 160px);
        max-width: 380px;
    }
}
