/* AI 客服聊天机器人样式 */
:root {
    --ai-primary: #FF6B9D;
    --ai-secondary: #FF8C42;
    --ai-bg: #FFF5F7;
    --ai-text: #333;
    --ai-white: #fff;
}

/* 悬浮按钮 */
.ai-chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255,107,157,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: ai-pulse 2s infinite;
}

.ai-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255,107,157,0.5);
}

.ai-chatbot-toggle svg {
    width: 30px;
    height: 30px;
    fill: white;
}

@keyframes ai-pulse {
    0% { box-shadow: 0 4px 20px rgba(255,107,157,0.4); }
    50% { box-shadow: 0 4px 30px rgba(255,107,157,0.6); }
    100% { box-shadow: 0 4px 20px rgba(255,107,157,0.4); }
}

/* 聊天窗口 */
.ai-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--ai-white);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: ai-slide-up 0.3s ease;
}

.ai-chatbot-window.active {
    display: flex;
}

@keyframes ai-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 聊天窗口头部 */
.ai-chatbot-header {
    background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ai-chatbot-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.ai-chatbot-info p {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

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

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

/* 聊天内容区域 */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.ai-message {
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    animation: ai-fade-in 0.3s ease;
}

@keyframes ai-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message.ai-bot {
    flex-direction: row;
}

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

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

.ai-bot .ai-message-avatar {
    background: var(--ai-bg);
}

.ai-user .ai-message-avatar {
    background: var(--ai-primary);
    color: white;
}

.ai-message-content {
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-bot .ai-message-content {
    background: white;
    color: var(--ai-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ai-user .ai-message-content {
    background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* 输入区域 */
.ai-chatbot-input {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.ai-chatbot-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.ai-chatbot-input input:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(255,107,157,0.1);
}

.ai-chatbot-input button {
    background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.ai-chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255,107,157,0.3);
}

.ai-chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 打字指示器 */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ai-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ai-primary);
    animation: ai-typing 1.4s infinite;
}

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

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

/* 快速回复按钮 */
.ai-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ai-quick-reply-btn {
    background: var(--ai-bg);
    color: var(--ai-primary);
    border: 1px solid var(--ai-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-quick-reply-btn:hover {
    background: var(--ai-primary);
    color: white;
}

/* H5 响应式 */
@media screen and (max-width: 768px) {
    .ai-chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .ai-chatbot-window {
        bottom: 80px;
        right: 20px;
        left: 20px;
        width: auto;
        height: 70vh;
    }
}
