﻿/* 智能客服专用样式 - 不会影响您网站原有样式 */

/* 智能客服图标样式 */
.chat-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: auto;
    min-width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(24, 144, 255, 0.4);
    z-index: 9998;
    font-size: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    padding: 0 10px;
}

.chat-toggle-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.chat-toggle-text {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 10px;
    opacity: 1;
    transition: all 0.3s ease;
}

/* 小屏幕只显示图标 */
@media (max-width: 768px) {
    .chat-toggle {
        width: 60px;
        justify-content: center;
        padding: 0;
    }
    
    .chat-toggle-text {
        display: none;
    }
}

/* 鼠标悬停效果 */
.chat-toggle:hover {
    width: 150px;
    background: linear-gradient(135deg, #096dd9 0%, #0050b3 100%);
    box-shadow: 0 6px 20px rgba(24, 144, 255, 0.6);
    transform: translateY(-2px);
}

.chat-toggle:hover .chat-toggle-icon {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 聊天窗口样式 */
.chat-widget-hidden {
    display: none !important;
}

#chat-widget {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 9999;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    background: #52c41a;
    border-radius: 50%;
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    animation: message-appear 0.3s ease;
}

@keyframes message-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.message.assistant .message-bubble {
    background: white;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-indicator {
    display: none;
    color: #666;
    font-style: italic;
    margin: 0 20px 10px;
    font-size: 14px;
    align-items: center;
    gap: 8px;
}

.typing-animation {
    display: flex;
    gap: 2px;
}

.typing-animation span {
    width: 4px;
    height: 4px;
    background: #1890ff;
    border-radius: 50%;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-animation span:nth-child(2) {
    animation-delay: 0.3s;
}

.typing-animation span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    background: white;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

#chat-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

#send-btn {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
}

.send-icon {
    transform: rotate(90deg);
}

.quick-reply {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-reply-btn {
    background: #f0f0f0;
    border: 1px solid #d9d9d9;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background: #e6f7ff;
    border-color: #1890ff;
    color: #1890ff;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-toggle {
        bottom: 15px;
        right: 15px;
    }
    
    #chat-widget {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 15px;
        border-radius: 8px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}