/* ============================================
   PC 端 AI 智能客服样式
   浮动在页面右下角，点击展开对话框
   ============================================ */

/* AI 客服悬浮按钮 */
.ai-chat-btn {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    width: 70px;
    height: 70px;
    border-radius: 0;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-top: none;
    cursor: pointer;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 12px;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}
.ai-chat-btn:hover {
    border-color: #F77258;
    color: #F77258;
    transform: none;
    box-shadow: none;
}
.ai-chat-btn .ai-icon {
    font-size: 20px;
}
.ai-chat-btn .ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
}
.ai-chat-btn .ai-badge.show {
    display: block;
    animation: aiPulse 1.5s infinite;
}

/* 聊天气泡动画 */
@keyframes aiPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* 主对话框 */
.ai-chat-dialog {
    position: fixed;
    bottom: 75px;
    right: 80px;
    z-index: 9998;
    width: 380px;
    height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: aiSlideUp 0.3s ease;
}
.ai-chat-dialog.open {
    display: flex;
}

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

/* 对话框头部 */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-chat-header h3 .ai-icon {
    font-size: 20px;
}
.ai-chat-header .ai-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 4px;
}
.ai-chat-header .ai-close-btn:hover {
    opacity: 1;
}

/* 消息列表区域 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* 消息气泡 */
.ai-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    animation: aiMsgIn 0.3s ease;
}
@keyframes aiMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* AI 消息（左侧） */
.ai-msg-ai {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e8ecf1;
    border-bottom-left-radius: 4px;
    color: #333;
}
.ai-msg-ai .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    position: absolute;
    left: -42px;
    top: 0;
    flex-shrink: 0;
}

/* 用户消息（右侧） */
.ai-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* 输入区域 */
.ai-chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e8ecf1;
    background: #fff;
    gap: 8px;
}
.ai-chat-input-area input {
    flex: 1;
    border: 1px solid #e0e4e8;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}
.ai-chat-input-area input:focus {
    border-color: #667eea;
}
.ai-chat-input-area .ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}
.ai-chat-input-area .ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}
.ai-chat-input-area .ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 输入中...动画 */
.ai-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
    background: #fff;
    border: 1px solid #e8ecf1;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.ai-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: aiTyping 1.4s infinite both;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTyping {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* 欢迎消息中的快捷问题按钮 */
.ai-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.ai-quick-btn {
    background: #eef1ff;
    border: 1px solid #d5dbf5;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px;
    color: #5a6fd6;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-quick-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* 消息中的 markdown 简单样式 */
.ai-msg-ai strong { color: #5a6fd6; }
.ai-msg-ai a { color: #667eea; text-decoration: underline; }
.ai-msg-ai ul, .ai-msg-ai ol { padding-left: 20px; margin: 4px 0; }
.ai-msg-ai li { margin: 2px 0; }
.ai-msg-ai code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
