/* AI客服样式 */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.4);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 580px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

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

.chat-quick-questions {
    padding: 10px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.quick-question-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #d2b48c;
    background: #fff8f0;
    color: #8B4513;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.quick-question-btn:hover {
    background: #d2b48c;
    color: white;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fafafa;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

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

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

.ai-message .message-avatar {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
}

.user-message .message-avatar {
    background: #f0f0f0;
    color: #666;
}

.message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.ai-message .message-content {
    background: white;
    color: #333;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.user-message .message-content {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    border-top-right-radius: 4px;
}

.message-content small {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.8;
}

.chat-input-area {
    padding: 12px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
    background: white;
}

#chatInput {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chatInput:focus {
    border-color: #d2b48c;
}

#chatSendBtn {
    padding: 0 20px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

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

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

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

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

/* 手机端适配 */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        border-radius: 16px 16px 0 0;
    }
    
    .chat-toggle-btn {
        width: 52px;
        height: 52px;
    }
}
