/* 在线客服系统样式 - 优化版 */
.customer-service-widget {
    position: fixed;
    bottom: 20px;
    right: 90px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 客服触发按钮 */
.cs-trigger-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    animation: pulse-ring 2s infinite;
    border: none;
}

.cs-trigger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.cs-trigger-btn .iconfont {
    font-size: 32px;
    color: white;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

/* 未读消息徽章 */
.cs-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* 客服面板 */
.cs-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 580px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.cs-panel.active {
    display: flex;
}

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

/* 面板头部 */
.cs-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.cs-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-avatar .iconfont {
    font-size: 22px;
    color: #667eea;
}

.cs-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.cs-header-text p {
    margin: 3px 0 0;
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
}

.cs-status {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    margin-right: 5px;
    animation: blink 2s infinite;
    box-shadow: 0 0 4px rgba(46, 204, 113, 0.6);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.cs-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cs-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* 快捷回复按钮 */
.cs-quick-replies {
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cs-quick-reply-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 18px;
    padding: 7px 14px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.cs-quick-reply-btn .iconfont {
    font-size: 15px;
    display: inline-block;
}

.cs-quick-reply-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.cs-quick-reply-btn:active {
    transform: translateY(0);
}

/* 消息区域 */
.cs-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    background: #ffffff;
}

.cs-messages::-webkit-scrollbar {
    width: 6px;
}

.cs-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cs-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cs-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.cs-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.cs-message.visitor {
    justify-content: flex-end;
}

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

.cs-message.admin .cs-message-content {
    background: #f1f3f5;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.cs-message.visitor .cs-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.cs-message.system .cs-message-content {
    background: #e7f3ff;
    color: #0066cc;
    font-size: 12px;
    text-align: center;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
}

.cs-message-time {
    font-size: 11px;
    color: #adb5bd;
    margin-top: 4px;
    text-align: center;
}

/* 输入区域 */
.cs-input-area {
    background: white;
    border-top: 1px solid #e9ecef;
}

.cs-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
}

.cs-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background: #f8f9fa;
}

.cs-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cs-send-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.cs-send-btn .iconfont {
    font-size: 18px;
}

.cs-send-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cs-send-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

/* 连接状态 */
.cs-connection-status {
    padding: 6px 15px;
    background: #fff3cd;
    color: #856404;
    font-size: 11px;
    text-align: center;
    border-bottom: 1px solid #ffeaa7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cs-connection-status:before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.cs-connection-status.connected {
    background: #d4edda;
    color: #155724;
    border-bottom-color: #c3e6cb;
}

.cs-connection-status.error {
    background: #f8d7da;
    color: #721c24;
    border-bottom-color: #f5c6cb;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .cs-panel {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: 600px;
        right: 0;
        left: 20px;
    }
    
    .customer-service-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .FloatingWindow {
        display: none;
    }
    
    .cs-quick-replies {
        padding: 10px;
    }
    
    .cs-quick-reply-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* 修复服务热线hover显示 */
.FloatingWindow .FloatingWindow_list:nth-child(2):hover .FloatingWindow_list_down {
    display: block;
}
