* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 🔥 流式输入光标效果 */
#reviewContent.streaming::after {
    content: '▊';
    animation: blink 1s step-end infinite;
    color: #667eea;
    font-weight: bold;
    margin-left: 2px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 搜索区域 */
.search-section {
    padding: 40px;
    border-bottom: 2px solid #f0f0f0;
}

.search-box {
    display: flex;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

#keywordInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

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

#generateBtn {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#generateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#generateBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 初始化加载动画 */
.init-loading {
    margin: 30px auto 0;
    max-width: 800px;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

.init-progress-container {
    height: 6px;
    background: #e0e7ff;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.init-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.init-text {
    margin-top: 12px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.countdown {
    font-weight: 700;
    font-size: 18px;
    color: #5a67d8;
    display: inline-block;
    min-width: 20px;
    text-align: center;
}

/* 文献综述区域 */
.review-section {
    padding: 40px;
    border-bottom: 2px solid #f0f0f0;
}

.review-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.review-content {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    line-height: 1.8;
    color: #333;
}

.review-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.review-content h2 {
    color: #667eea;
    font-size: 1.4em;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.review-content h3 {
    color: #555;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

.review-content sup {
    color: #667eea;
    font-weight: 600;
    margin-left: 1px;
}

.review-content strong {
    color: #333;
    font-weight: 600;
}

/* 🔥 字数统计区域 */
.review-stats {
    display: none;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    margin-top: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stats-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.stats-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

/* 论文列表区域 */
.papers-section {
    padding: 40px;
}

.papers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.papers-header h2 {
    color: #333;
    font-size: 1.8em;
}

#downloadAllBtn {
    padding: 12px 30px;
    font-size: 15px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#downloadAllBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

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

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
    background: #f5f5f5;
}

.paper-title {
    font-weight: 500;
    color: #333;
    max-width: 400px;
}

.paper-authors {
    color: #666;
    font-size: 0.9em;
}

.paper-citations {
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
    text-align: center;
}

.download-btn {
    padding: 8px 20px;
    font-size: 14px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

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


/* 下载链接 */
.download-link {
    display: inline-block;
    padding: 6px 15px;
    color: white;
    background: #4CAF50;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.3s;
}

.download-link:hover {
    background: #45a049;
    transform: scale(1.05);
}

.fallback-link {
    background: #ff9800;
}

.fallback-link:hover {
    background: #f57c00;
}

/* 下载状态 */
.download-status {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.download-status .downloading {
    color: #667eea;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

.download-status .download-error {
    color: #f44336;
    font-weight: 500;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    /* 头部适配 */
    header {
        padding: 25px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.95em;
    }

    /* 搜索区域适配 */
    .search-section {
        padding: 25px 20px;
    }

    .search-box {
        flex-direction: column;
        gap: 12px;
    }

    #keywordInput {
        width: 100%;
        padding: 12px 16px;
        font-size: 15px;
    }

    #generateBtn {
        width: 100%;
        padding: 12px 30px;
        font-size: 15px;
    }

    /* 初始化加载动画适配 */
    .init-loading {
        margin: 20px auto 0;
        padding: 0 10px;
    }

    .init-text {
        font-size: 13px;
        margin-top: 10px;
    }

    /* 综述区域适配 */
    .review-section {
        padding: 25px 20px;
    }

    /* 🔥 字数统计适配 */
    .review-stats {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .stats-label {
        font-size: 0.85em;
    }

    .stats-value {
        font-size: 1.3em;
    }

    .review-section h2 {
        font-size: 1.5em;
    }

    .review-content {
        padding: 15px;
        font-size: 14px;
    }

    .review-content h2 {
        font-size: 1.2em;
        margin-top: 20px;
    }

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

    /* 论文列表适配 */
    .papers-section {
        padding: 25px 20px;
    }

    .papers-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .papers-header h2 {
        font-size: 1.5em;
        text-align: center;
    }

    #downloadAllBtn {
        width: 100%;
        padding: 12px 30px;
    }

    /* 表格卡片式布局 */
    .table-container {
        overflow-x: visible;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        overflow: hidden;
        background: white;
    }

    tbody tr:hover {
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    td {
        padding: 10px 15px;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding-left: 45%;
        text-align: right;
    }

    td:last-child {
        border-bottom: none;
    }

    td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: 600;
        color: #667eea;
        text-align: left;
    }

    .paper-title {
        max-width: 100%;
    }

    .download-btn {
        width: 100%;
        padding: 10px 20px;
        font-size: 14px;
    }

    .download-link {
        display: block;
        text-align: center;
        padding: 10px 15px;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .review-content {
        font-size: 13px;
    }

    td {
        font-size: 14px;
    }
}

/* ==================== Tab切换 ==================== */
.tab-nav {
    display: flex;
    gap: 10px;
    padding: 20px 40px 0;
    border-bottom: 2px solid #f0f0f0;
    background: white;
}

.tab-btn {
    padding: 12px 30px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== 历史记录 ==================== */
.history-section {
    padding: 40px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.history-header h2 {
    font-size: 1.8em;
    color: #333;
}

.history-stats {
    color: #666;
    font-size: 1em;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    min-height: 200px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

.history-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.card-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    color: #666;
    font-size: 0.9em;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-preview {
    color: #888;
    font-size: 0.9em;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: #999;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.empty-state-hint {
    color: #bbb;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header h3 {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin: 0;
    flex: 1;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-time {
    color: #999;
    font-size: 0.85em;
}

.btn-delete-card {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-delete-card:hover {
    opacity: 1;
    background: #ffebee;
    transform: scale(1.1);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.paper-count {
    color: #666;
    font-size: 0.9em;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: #764ba2;
}

.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: #e74c3c;
}

/* ==================== Modal弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0;
    flex: 1;
    padding-right: 20px;
}

.close-btn {
    font-size: 2em;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #667eea;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #666;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-review {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    line-height: 1.8;
    color: #333;
}

/* Modal综述内容样式（与主界面保持一致） */
.modal-review p {
    margin-bottom: 15px;
    text-align: justify;
}

.modal-review h2 {
    color: #667eea;
    font-size: 1.4em;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.modal-review h3 {
    color: #555;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-review sup {
    color: #667eea;
    font-weight: 600;
    margin-left: 1px;
}

.modal-review strong {
    color: #333;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #e84141;
}

/* ==================== AI输出分块显示 ==================== */
.ai-output-section {
    padding: 20px 40px;
    border-bottom: 2px solid #f0f0f0;
    background: #1a1a2e;
}

.ai-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ai-output-header h3 {
    color: #e0e0e0;
    font-size: 1.1em;
    margin: 0;
}

.ai-output-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a0a0a0;
    font-size: 0.9em;
    cursor: pointer;
}

.toggle-label input {
    cursor: pointer;
}

.clear-output-btn {
    padding: 5px 12px;
    font-size: 12px;
    color: #a0a0a0;
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-output-btn:hover {
    color: #e0e0e0;
    border-color: #5a5a7a;
    background: #2a2a4e;
}

.ai-output-container {
    max-height: 300px;
    overflow-y: auto;
    background: #0d0d1a;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.ai-output-container::-webkit-scrollbar {
    width: 8px;
}

.ai-output-container::-webkit-scrollbar-track {
    background: #1a1a2e;
    border-radius: 4px;
}

.ai-output-container::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 4px;
}

.ai-output-container::-webkit-scrollbar-thumb:hover {
    background: #5a5a7a;
}

/* 输出块基础样式 */
.ai-output-block {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid;
    position: relative;
}

.block-type-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 6px;
}

.block-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 文本输出块 */
.ai-output-text {
    background: #1a2332;
    border-left-color: #4ecdc4;
    color: #e0e0e0;
}

.ai-output-text .block-type-label {
    background: #4ecdc4;
    color: #0d0d1a;
}

/* 思考块 */
.ai-output-thinking {
    background: #2a1f3d;
    border-left-color: #a855f7;
    color: #d0c0e0;
}

.ai-output-thinking .block-type-label {
    background: #a855f7;
    color: white;
}

.ai-output-thinking .block-content {
    font-style: italic;
    opacity: 0.9;
}

/* 工具调用块 */
.ai-output-tool_use {
    background: #1f2a3d;
    border-left-color: #f59e0b;
    color: #e0d0c0;
}

.ai-output-tool_use .block-type-label {
    background: #f59e0b;
    color: #0d0d1a;
}

/* 工具结果块 */
.ai-output-tool_result {
    background: #1a3020;
    border-left-color: #22c55e;
    color: #c0e0d0;
}

.ai-output-tool_result .block-type-label {
    background: #22c55e;
    color: #0d0d1a;
}

/* 系统消息块 */
.ai-output-system {
    background: #2a2a3a;
    border-left-color: #6b7280;
    color: #a0a0a0;
}

.ai-output-system .block-type-label {
    background: #6b7280;
    color: white;
}

/* 流式光标效果 */
.ai-output-block:last-child .block-content::after {
    content: '▊';
    animation: cursor-blink 1s step-end infinite;
    color: #667eea;
    margin-left: 2px;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .tab-nav {
        padding: 15px 20px 0;
    }

    .history-section {
        padding: 20px;
    }

    .history-list {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header, .modal-body, .modal-footer {
        padding: 20px;
    }

    /* AI输出区域响应式 */
    .ai-output-section {
        padding: 15px 20px;
    }

    .ai-output-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .ai-output-container {
        max-height: 200px;
        font-size: 12px;
    }
}

/* ========== 论文提取加载动画 ========== */
.papers-loading {
    background: white;
    padding: 60px 40px;
    text-align: center;
    border-radius: 8px;
    margin: 20px 0;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-icon {
    font-size: 48px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-text {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

/* 脉冲点动画 */
.pulse-dots {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pulse-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse-dot 1.4s ease-in-out infinite;
}

.pulse-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.pulse-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.pulse-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* 🔥 论文提取进度条样式 */
.papers-progress-container {
    width: 100%;
    max-width: 500px;
    height: 8px;
    background: #e0e7ff;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.papers-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 1s linear;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* 🔥 论文提取倒计时样式 */
.papers-countdown {
    margin-top: 12px;
    color: #667eea;
    font-size: 15px;
    font-weight: 500;
}

.countdown-num {
    font-weight: 700;
    font-size: 20px;
    color: #5a67d8;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.percentage-text {
    margin-left: 8px;
    color: #888;
    font-size: 14px;
}


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

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
}

/* ========== Modal论文列表样式（表格布局） ========== */
.modal-papers {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.modal-papers .papers-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Modal中的论文操作按钮 */
.modal-paper-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-paper-actions .download-link {
    font-size: 12px;
    padding: 5px 12px;
}
/* ==================== 下载历史Tab ==================== */
.downloads-section {
    padding: 30px;
}

.downloads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.downloads-header h2 {
    font-size: 1.8em;
    color: #333;
}

.downloads-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    font-size: 14px;
    color: #666;
    background: #f5f5f5;
    padding: 8px 15px;
    border-radius: 20px;
}

.stat-item strong {
    color: #667eea;
    font-weight: 600;
}

/* 筛选器 */
.downloads-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.downloads-filter select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.downloads-filter select:hover {
    border-color: #667eea;
}

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

/* 下载记录列表 */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.download-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.download-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #667eea;
}

.download-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.download-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    line-height: 1.5;
}

.download-item-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 15px;
}

.download-item-status.success {
    background: #d4edda;
    color: #155724;
}

.download-item-status.failed {
    background: #f8d7da;
    color: #721c24;
}

.download-item-status.cached {
    background: #d1ecf1;
    color: #0c5460;
}

.download-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.download-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 下载尝试记录 */
.download-attempts {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e0e0e0;
}

.download-attempts-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.attempt-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attempt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.attempt-item.success {
    background: #d4edda;
}

.attempt-item.failed {
    background: #f8d7da;
}

.attempt-source {
    font-weight: 600;
    min-width: 120px;
}

.attempt-error {
    color: #721c24;
    font-style: italic;
}

.download-item-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.download-item-actions a,
.download-item-actions button {
    padding: 6px 15px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.download-item-actions .btn-open {
    background: #667eea;
    color: white;
}

.download-item-actions .btn-open:hover {
    background: #5568d3;
}

.download-item-actions .btn-fallback {
    background: #f0f0f0;
    color: #666;
}

.download-item-actions .btn-fallback:hover {
    background: #e0e0e0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
}
