/* AI智能问答功能样式 - 字里豆香 */

/* AI问答区块容器 */
.ai-qa-section {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 800px;
    z-index: 999;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-qa-section.collapsed {
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.ai-qa-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 240, 230, 0.98) 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(168, 195, 185, 0.2);
    overflow: hidden;
    border: 1px solid rgba(168, 195, 185, 0.3);
}

/* 头部样式 */
.ai-qa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--color-bean) 0%, #8ca89e 100%);
    color: white;
}

.ai-qa-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-qa-title i {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

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

.ai-qa-title h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

/* 状态指示器 */
.ai-qa-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.status-indicator.online {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}

.status-indicator.thinking {
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
}

.status-indicator.offline {
    background: #f87171;
    box-shadow: 0 0 8px #f87171;
}

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

/* 介绍区域 */
.ai-qa-intro {
    padding: 12px 20px;
    background: rgba(168, 195, 185, 0.1);
    border-bottom: 1px solid rgba(168, 195, 185, 0.2);
}

.ai-qa-intro p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
}

/* 消息区域 */
.ai-qa-messages {
    height: 200px;
    overflow-y: auto;
    padding: 15px 20px;
    background: #fafafa;
    scroll-behavior: smooth;
}

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

.ai-qa-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.ai-qa-messages::-webkit-scrollbar-thumb {
    background: var(--color-bean);
    border-radius: 3px;
}

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

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

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

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

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--color-bean) 0%, #8ca89e 100%);
    color: white;
}

.ai-message.user .message-avatar {
    background: var(--color-bronze);
    color: white;
}

.message-avatar i {
    font-size: 1rem;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.ai-message .message-content {
    background: white;
    color: var(--color-ink);
    border: 1px solid rgba(168, 195, 185, 0.2);
    border-bottom-left-radius: 4px;
}

.ai-message.user .message-content {
    background: var(--color-bean);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 0.95rem;
}

/* 输入区域 */
.ai-qa-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid rgba(168, 195, 185, 0.2);
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-label {
    font-size: 0.85rem;
    color: #888;
}

.quick-btn {
    padding: 6px 12px;
    background: rgba(168, 195, 185, 0.15);
    border: 1px solid rgba(168, 195, 185, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--color-ink);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-btn:hover {
    background: var(--color-bean);
    color: white;
    border-color: var(--color-bean);
    transform: translateY(-2px);
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.ai-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(168, 195, 185, 0.3);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.ai-input:focus {
    border-color: var(--color-bean);
    box-shadow: 0 0 0 3px rgba(168, 195, 185, 0.2);
}

.ai-input::placeholder {
    color: #aaa;
}

.ai-send-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--color-bean) 0%, #8ca89e 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(168, 195, 185, 0.4);
}

.ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 切换按钮 */
.ai-toggle-btn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-bean) 0%, #8ca89e 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(168, 195, 185, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-toggle-btn.visible {
    display: flex;
}

.ai-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(168, 195, 185, 0.5);
}

/* 错误和加载状态 */
.ai-error {
    color: #dc2626;
    background: #fef2f2;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.ai-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-bean);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-qa-section {
        top: 80px;
        width: calc(100% - 20px);
        max-height: 70vh;
    }
    
    .ai-qa-container {
        max-height: 70vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .ai-qa-header {
        padding: 12px 15px;
    }
    
    .ai-qa-title h3 {
        font-size: 1rem;
    }
    
    .ai-qa-intro {
        padding: 10px 15px;
    }
    
    .ai-qa-intro p {
        font-size: 0.85rem;
    }
    
    .ai-qa-messages {
        height: 150px;
        flex: 1;
    }
    
    .message-content {
        max-width: 85%;
        padding: 10px 12px;
    }
    
    .message-content p {
        font-size: 0.9rem;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    .ai-qa-input-area {
        padding: 10px 15px;
    }
    
    .quick-questions {
        gap: 6px;
    }
    
    .quick-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .quick-label {
        display: none;
    }
    
    .ai-input {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .ai-send-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .ai-toggle-btn {
        width: 48px;
        height: 48px;
        bottom: 80px;
        right: 20px;
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .ai-qa-section {
        top: 70px;
        width: calc(100% - 10px);
        max-height: 65vh;
    }
    
    .ai-qa-container {
        max-height: 65vh;
    }
    
    .ai-qa-header {
        padding: 10px 12px;
    }
    
    .ai-qa-title i {
        font-size: 1.2rem;
    }
    
    .ai-qa-title h3 {
        font-size: 0.95rem;
    }
    
    .ai-qa-messages {
        height: 120px;
    }
    
    .quick-questions {
        flex-wrap: wrap;
    }
    
    .quick-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .ai-input {
        padding: 10px 12px;
    }
    
    .ai-send-btn {
        width: 100%;
        justify-content: center;
    }
    
    .ai-toggle-btn {
        width: 44px;
        height: 44px;
        bottom: 70px;
        right: 15px;
        font-size: 1.2rem;
    }
}
