/* Markdown内容样式优化 */
.ai-message-content h1, .ai-message-content h2, .ai-message-content h3 {
    font-weight: 600;
    margin: 1.2em 0 0.8em;
    color: #1e3a8a;
}

.ai-message-content h1 {
    font-size: 1.5em;
    border-bottom: 2px solid #dbeafe;
    padding-bottom: 0.3em;
}

.ai-message-content h2 {
    font-size: 1.3em;
}

.ai-message-content h3 {
    font-size: 1.1em;
}

.ai-message-content p {
    margin: 0.8em 0;
    line-height: 1.6;
    color: #334155;
}

.ai-message-content ul, .ai-message-content ol {
    padding-left: 1.8em;
    margin: 1em 0;
}

.ai-message-content li {
    margin-bottom: 0.5em;
    line-height: 1.5;
}

.ai-message-content ul {
    list-style-type: disc;
}

.ai-message-content ol {
    list-style-type: decimal;
}

.ai-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ai-message-content th {
    background-color: #3d6aff;
    color: white;
    font-weight: 500;
    padding: 0.8em;
    text-align: left;
}

.ai-message-content td {
    padding: 0.8em;
    border-bottom: 1px solid #e2e8f0;
}

.ai-message-content tr:nth-child(even) {
    background-color: #f8fafc;
}

.ai-message-content tr:last-child td {
    border-bottom: none;
}

.ai-message-content code {
    background-color: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #e11d48;
}

.ai-message-content pre {
    background-color: #1e293b;
    padding: 1em;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.2em 0;
}

.ai-message-content pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
}

.ai-message-content blockquote {
    border-left: 4px solid #94a3b8;
    padding-left: 1.2em;
    margin: 1.2em 0;
    color: #64748b;
    font-style: italic;
}

.ai-message-content img {
    max-width: 100%;
    border-radius: 0.5rem;
    margin: 0.5em 0;
}

/* 参考文献角标样式 */
.ai-message-content .reference-sup {
    background-color: #3b82f6;
    color: white;
    font-size: 0.7em;
    line-height: 1.2;
    padding: 0.1em 0.3em;
    border-radius: 50%;
    cursor: pointer;
    vertical-align: super;
    margin: 0 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2em;
    height: 1.2em;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    user-select: none;
}

.ai-message-content .reference-sup:hover {
    background-color: #2563eb;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.ai-message-content .reference-sup:active {
    transform: scale(0.95);
}

/* 为参考资料列表添加样式 */
.references-section {
    border-top: 1px dashed #e2e8f0;
}

.references-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

.references-toggle:hover {
    color: #3b82f6;
}

.references-toggle svg {
    transition: transform 0.2s;
    margin-right: 0.5rem;
}

.references-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.references-content {
    padding-left: 1rem;
}

.reference-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reference-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    word-break: break-all;
}

.reference-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* 分享页面的角标样式 */
.share-page .ai-message-content .reference-sup {
    background-color: #6b7280;
    cursor: default;
}

.share-page .ai-message-content .reference-sup:hover {
    background-color: #4b5563;
    transform: scale(1.1);
    cursor: default;
}