/* AI助手组件样式 */
.ai-assistant-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

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

.ai-avatar-large {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

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

/* 对话区域 */
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

.ai-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

/* 快捷问题 */
.quick-questions {
    max-width: 400px;
}

.quick-question-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-question-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

/* 消息样式 */
.ai-message {
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease-out;
}

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

.ai-message.assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
}

.user-message {
    display: flex;
    align-items: flex-start;
    flex-direction: row-reverse;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.ai-message-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 14px;
}

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

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

/* 消息来源标签 */
.message-source {
    margin-top: 8px;
    text-align: right;
}

.source-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
    font-weight: 500;
}

.source-knowledge {
    background: #e0f2fe;
    color: #0277bd;
    border: 1px solid #b3e5fc;
}

.source-recall {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.source-gemini {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.source-fallback {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc02;
}

.source-default {
    background: #f5f5f5;
    color: #757575;
    border: 1px solid #e0e0e0;
}

/* 消息建议 */
.message-suggestions {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.suggestion-btn {
    padding: 4px 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

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

.ai-input {
    width: 100%;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    resize: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

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

.ai-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

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

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

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滚动条样式 */
.ai-chat-area::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

.ai-chat-area::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-assistant-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .ai-input-area {
        padding: 12px 16px;
    }
    
    .ai-assistant-header {
        padding: 12px 16px;
    }
    
    .quick-question-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ai-assistant-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .ai-chat-area {
        background: #111827;
    }
    
    .message-text {
        background: #374151;
        color: #f9fafb;
    }
    
    .user-message .message-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    .ai-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .ai-input:focus {
        border-color: #667eea;
    }
    
    .quick-question-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .suggestion-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
}