/**
 * AI客服样式
 * Zibll AI Chat Widget Styles
 */

/* 聊天按钮 */
.zibll-ai-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.zibll-ai-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.chat-button-text {
    font-size: 14px;
    font-weight: 500;
}

.chat-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
}

/* 聊天窗口 */
.zibll-ai-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.zibll-ai-chat-widget.show {
    opacity: 1;
    transform: translateY(0);
}

.zibll-ai-chat-widget.minimized {
    height: 50px;
}

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

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.chat-title .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.chat-controls button {
    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;
    transition: all 0.2s ease;
}

.chat-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-controls .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* 聊天主体 */
.chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

/* 消息样式 */
.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.message.system-message {
    justify-content: center;
}

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

.message.ai-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message.user-message .message-avatar {
    background: #007cba;
    color: white;
}

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

.message.ai-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e8ed;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user-message .message-content {
    background: #007cba;
    color: white;
}

.message.system-message .message-content {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
    font-size: 12px;
    font-style: italic;
    text-align: center;
    max-width: 80%;
}

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

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #666;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots::before,
.typing-dots::after,
.typing-dots span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots::before {
    animation-delay: -0.32s;
}

.typing-dots span::before {
    animation-delay: -0.16s;
}

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

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid #e1e8ed;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f8f9fa;
}

.chat-input:focus {
    border-color: #667eea;
    background: white;
}

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

.chat-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chat-send-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* 聊天底部 */
.chat-footer {
    border-top: 1px solid #e1e8ed;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

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

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-actions button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chat-actions button:hover {
    background: #e9ecef;
    color: #333;
}

.chat-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .zibll-ai-chat-button {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
    }
    
    .zibll-ai-chat-widget {
        bottom: 80px;
        right: 15px;
        left: 15px;
        width: auto;
        height: 60vh;
        max-height: 500px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .message-content {
        max-width: 80%;
    }
}

/* 主题变体 */
.zibll-ai-chat-widget[data-theme="dark"] {
    background: #2d3748;
    color: #e2e8f0;
}

.zibll-ai-chat-widget[data-theme="dark"] .chat-header {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.zibll-ai-chat-widget[data-theme="dark"] .chat-messages {
    background: #1a202c;
}

.zibll-ai-chat-widget[data-theme="dark"] .message.ai-message .message-content {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

.zibll-ai-chat-widget[data-theme="dark"] .chat-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.zibll-ai-chat-widget[data-theme="dark"] .chat-footer {
    background: #1a202c;
}

/* 位置变体 */
.zibll-ai-chat-widget[data-position="bottom-left"] {
    right: auto;
    left: 20px;
}

.zibll-ai-chat-button[data-position="bottom-left"] {
    right: auto;
    left: 20px;
}

.zibll-ai-chat-widget[data-position="top-right"] {
    bottom: auto;
    top: 20px;
}

.zibll-ai-chat-button[data-position="top-right"] {
    bottom: auto;
    top: 20px;
}

.zibll-ai-chat-widget[data-position="top-left"] {
    bottom: auto;
    top: 20px;
    right: auto;
    left: 20px;
}

.zibll-ai-chat-button[data-position="top-left"] {
    bottom: auto;
    top: 20px;
    right: auto;
    left: 20px;
}

/* 滚动条样式 */
.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;
}

/* 加载动画 */
.chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误提示 */
.chat-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    text-align: center;
}

/* 成功提示 */
.chat-success {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    text-align: center;
}