/* ==================== AI悬浮助手样式 ==================== */

/* 悬浮按钮容器 */
#ai-float-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

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

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

.ai-float-btn:active {
    transform: scale(0.95);
}

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

/* 对话窗口 */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    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: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.ai-chat-title i {
    font-size: 20px;
}

.ai-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-status i {
    font-size: 8px;
    animation: pulse 2s infinite;
}

.ai-status.online i {
    color: #2ecc71;
}

.ai-status.offline i {
    color: #e74c3c;
}

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

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

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

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

/* 模型选择器 */
.ai-model-selector {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.ai-btn-text {
    background: transparent;
    border: none;
    color: #6c757d;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.ai-btn-text:hover {
    background: #e9ecef;
    color: #495057;
}

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

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

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

/* 欢迎消息 */
.ai-welcome-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* 消息项 */
.ai-message-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

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

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

.ai-message-item.user .ai-avatar {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.ai-message-bubble {
    max-width: 75%;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.ai-message-text {
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.ai-message-time {
    font-size: 11px;
    color: #adb5bd;
    margin-top: 6px;
}

.ai-message-item.user .ai-message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* 代码块样式 */
.ai-message-text code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.ai-message-item.user .ai-message-text code {
    background: rgba(255, 255, 255, 0.2);
}

.ai-message-text pre {
    background: #2d3748;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.ai-message-text pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 快捷问题 */
.ai-quick-questions {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.ai-quick-questions::-webkit-scrollbar {
    height: 4px;
}

.ai-quick-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-quick-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* 输入区域 */
.ai-chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-send-btn:active {
    transform: scale(0.95);
}

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

/* 加载提示 */
.ai-loading {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6c757d;
}

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

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-chat-window {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 90px;
    }
    
    .ai-float-btn {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    #ai-float-container {
        bottom: 20px;
        right: 20px;
    }
}

