/**
 * AI客服悬浮窗样式
 */

/* 悬浮按钮 */
.ai-chat-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    animation: ai-chat-pulse 2s infinite;
}

.ai-chat-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-chat-float-btn.hidden {
    display: none;
}

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

/* 未读消息徽章 */
.ai-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    display: none;
}

.ai-chat-badge.show {
    display: flex;
}

/* 聊天窗口 */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ai-chat-window.show {
    display: flex;
    animation: ai-chat-slide-up 0.3s ease;
}

@keyframes ai-chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.ai-chat-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-header-actions {
    display: flex;
    gap: 10px;
}

.ai-chat-header-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 状态指示器 */
.ai-chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #2ed573;
    border-radius: 50%;
    animation: ai-chat-blink 1.5s infinite;
}

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

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

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

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

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

/* 消息样式 */
.ai-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    animation: ai-chat-fade-in 0.3s ease;
}

@keyframes ai-chat-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.ai-chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-chat-message.user .ai-chat-message-avatar {
    background: #3498db;
}

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

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

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

.ai-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.ai-chat-message.ai .ai-chat-message-time {
    text-align: left;
}

/* 加载动画 */
.ai-chat-loading {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-chat-loading span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: ai-chat-loading-bounce 1.4s infinite ease-in-out both;
}

.ai-chat-loading span:nth-child(1) { animation-delay: -0.32s; }
.ai-chat-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-chat-loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

.ai-chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 40px;
    font-family: inherit;
}

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

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

.ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

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

/* 快捷问题 */
.ai-chat-quick-questions {
    padding: 10px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-chat-quick-question {
    padding: 6px 12px;
    background: #f0f2ff;
    color: #667eea;
    border: 1px solid #e0e4ff;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-chat-quick-question:hover {
    background: #667eea;
    color: white;
}

/* 欢迎消息 */
.ai-chat-welcome {
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

.ai-chat-welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.ai-chat-welcome h3 {
    margin: 0 0 10px;
    color: #333;
}

.ai-chat-welcome p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* 联系表单 */
.ai-chat-contact-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-chat-contact-form h4 {
    margin: 0 0 15px;
    color: #333;
    font-size: 14px;
}

.ai-chat-form-group {
    margin-bottom: 12px;
}

.ai-chat-form-group label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.ai-chat-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.ai-chat-form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.ai-chat-form-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-form-submit:hover {
    opacity: 0.9;
}

/* 提示消息 */
.ai-chat-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    display: none;
    animation: ai-chat-toast-in 0.3s ease;
}

.ai-chat-toast.show {
    display: block;
}

@keyframes ai-chat-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .ai-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .ai-chat-float-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* 代码块样式 */
.ai-chat-message-content pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    margin: 8px 0;
}

.ai-chat-message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.ai-chat-message-content p {
    margin: 0 0 10px;
}

.ai-chat-message-content p:last-child {
    margin-bottom: 0;
}

.ai-chat-message-content ul,
.ai-chat-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-chat-message-content li {
    margin: 4px 0;
}

.ai-chat-message-content strong {
    font-weight: 600;
}
