/* ==================== AI 问答样式 ==================== */

.top-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.tab-btn {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #5a6c7d;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f0f4f8;
}

.tab-btn.active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

.ai-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-top: 16px;
}

.ai-disclaimer {
    background: #fff8e6;
    border-left: 3px solid #f5a623;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    color: #6b4f1c;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ai-disclaimer strong {
    color: #8b5a00;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
}

.ai-suggestion-tag {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #d1d9e6;
    border-radius: 16px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-tag:hover {
    background: #e6f0ff;
    border-color: #4a90e2;
    color: #2563eb;
}

.ai-messages {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    padding: 8px 4px;
    margin-bottom: 16px;
}

.ai-msg {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

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

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

.ai-msg-user .bubble {
    background: #1a1a2e;
    color: #fff;
    padding: 10px 16px;
    border-radius: 16px 16px 4px 16px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
}

.ai-msg-assistant .bubble {
    background: #f0f4f8;
    color: #1a1a2e;
    padding: 16px 20px;
    border-radius: 4px 16px 16px 16px;
    max-width: 90%;
    line-height: 1.7;
    word-wrap: break-word;
}

.ai-msg-assistant.refused .bubble {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    color: #7f1d1d;
}

.ai-msg-assistant .bubble h1,
.ai-msg-assistant .bubble h2,
.ai-msg-assistant .bubble h3 {
    margin: 12px 0 8px;
    color: #1a1a2e;
}

.ai-msg-assistant .bubble h1 { font-size: 18px; }
.ai-msg-assistant .bubble h2 { font-size: 16px; }
.ai-msg-assistant .bubble h3 { font-size: 14px; }

.ai-msg-assistant .bubble p {
    margin: 8px 0;
}

.ai-msg-assistant .bubble ul,
.ai-msg-assistant .bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.ai-msg-assistant .bubble li {
    margin: 4px 0;
}

.ai-msg-assistant .bubble code {
    background: #e6ebf2;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #c026d3;
}

.ai-msg-assistant .bubble strong {
    color: #1e3a8a;
}

.ai-msg-assistant .bubble table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
    font-size: 13px;
}

.ai-msg-assistant .bubble th,
.ai-msg-assistant .bubble td {
    border: 1px solid #d1d9e6;
    padding: 6px 10px;
    text-align: left;
}

.ai-msg-assistant .bubble th {
    background: #e6ebf2;
    font-weight: 600;
}

.citations {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #d1d9e6;
}

.citations-title {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 6px;
}

.citation-tag {
    display: inline-block;
    margin: 3px 4px 3px 0;
    padding: 3px 10px;
    background: #fff;
    border: 1px solid #c5d4e6;
    border-radius: 12px;
    font-size: 11px;
    color: #2563eb;
    cursor: pointer;
    transition: all 0.2s;
}

.citation-tag:hover {
    background: #e6f0ff;
    border-color: #2563eb;
}

.ai-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 14px;
    padding: 10px 16px;
}

.ai-loading::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-input-area {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-input-area textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d9e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
    max-height: 150px;
    transition: border-color 0.2s;
}

.ai-input-area textarea:focus {
    outline: none;
    border-color: #2563eb;
}

#aiSendBtn {
    padding: 10px 20px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    height: 50px;
    min-width: 80px;
    transition: background 0.2s;
}

#aiSendBtn:hover:not(:disabled) {
    background: #2d2d4e;
}

#aiSendBtn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ai-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.link-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover {
    color: #2563eb;
}

.ai-empty {
    text-align: center;
    color: #9ca3af;
    padding: 40px 20px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .ai-msg-user .bubble,
    .ai-msg-assistant .bubble {
        max-width: 95%;
    }
    .top-tabs {
        flex-wrap: wrap;
    }
}
