/* AI客服助手样式 */

.cs-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 聊天按钮 */
.cs-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: cs-breathe 2.8s ease-in-out infinite;
    will-change: transform, box-shadow;
    position: relative;
}

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

@keyframes cs-breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.16);
        box-shadow: 0 14px 36px rgba(118, 75, 162, 0.65);
    }
}

.cs-chat-toggle svg {
    color: white;
    transition: all 0.3s ease;
}

.cs-chat-toggle .cs-icon-close {
    display: none;
}

.cs-chat-toggle.active .cs-icon-chat {
    display: none;
}

.cs-chat-toggle.active .cs-icon-close {
    display: block;
}

.cs-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 聊天窗口 */
.cs-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.cs-chat-window.active {
    display: flex;
}

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

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

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

.cs-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-agent-name {
    font-weight: 600;
    font-size: 16px;
}

.cs-agent-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
}

.cs-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: blink 2s infinite;
}

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

.cs-minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.cs-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cs-minimize-btn svg {
    color: white;
}

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

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

.cs-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.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-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.cs-message-bot .cs-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

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

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

.cs-message-content p {
    margin: 0;
}

.cs-message-content p + p {
    margin-top: 8px;
}

.cs-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.cs-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.cs-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.cs-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* 快捷回复 */
.cs-quick-replies {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.cs-quick-replies::-webkit-scrollbar {
    height: 4px;
}

.cs-quick-replies::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.cs-quick-reply {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.cs-quick-reply:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

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

.cs-chat-form {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.cs-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.cs-message-input:focus {
    border-color: #667eea;
}

.cs-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.cs-send-btn:hover {
    transform: scale(1.1);
}

.cs-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cs-send-btn svg {
    color: white;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .cs-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 20px;
    }
}

/* 欢迎消息 */
.cs-welcome-message {
    margin-bottom: 20px;
}

/* 时间戳 */
.cs-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.cs-message-bot .cs-message-time {
    text-align: left;
}
