/* ==========================================
   全局样式
   ========================================== */

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

:root {
    /* 颜色主题 */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Nature期刊主题色 */
    --nature-red: #c41e3a;
    --nature-blue: #0066cc;
    --nature-green: #22c55e;
    --nature-purple: #a855f7;
    --nature-orange: #f97316;
    --nature-teal: #14b8a6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ==========================================
   Header
   ========================================== */

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0 2rem;
    box-shadow: var(--shadow-lg);
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 2rem;
}

/* ==========================================
   搜索和筛选
   ========================================== */

.search-bar {
    max-width: 800px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
    transition: box-shadow 0.3s;
}

.search-input:focus {
    outline: none;
    box-shadow: var(--shadow-lg);
}

.filter-group {
    display: flex;
    gap: 1rem;
}

.filter-select {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: none;
    border-radius: 10px;
    background: white;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.3s;
}

.filter-select:focus {
    outline: none;
    box-shadow: var(--shadow-md);
}

.exclude-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.exclude-btn:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ==========================================
   加载和错误状态
   ========================================== */

.loading-container,
.error-container {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-container p {
    color: #dc2626;
    font-size: 1.2rem;
}

/* ==========================================
   文章信息栏
   ========================================== */

.articles-info {
    padding: 2rem 0 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==========================================
   文章网格
   ========================================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

/* ==========================================
   文章卡片
   ========================================== */

.article-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--nature-purple));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.article-card:hover::before {
    transform: scaleX(1);
}

/* 期刊标签 */
.journal-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    width: fit-content;
}

.journal-nature { background: #ffe4e6; color: var(--nature-red); }
.journal-nmeth { background: #dbeafe; color: var(--nature-blue); }
.journal-nbt { background: #dcfce7; color: var(--nature-green); }
.journal-nmi { background: #f3e8ff; color: var(--nature-purple); }
.journal-ncs { background: #fed7aa; color: var(--nature-orange); }
.journal-ncomms { background: #ccfbf1; color: var(--nature-teal); }

/* 文章标题 */
.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 文章元信息 */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 作者单位 */
.article-affiliation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: start;
    gap: 0.5rem;
    line-height: 1.5;
}

.affiliation-icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* 论文摘要说明 */
.article-justification {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 文章底部 */
.article-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.3s;
    display: inline-block;
}

.article-card:hover .read-more {
    transform: translateX(5px);
}

/* ==========================================
   复制功能样式
   ========================================== */

/* 复制按钮 */
.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    height: 40px;
    padding: 0 1rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    z-index: 10;
}

.copy-icon {
    font-size: 1.1rem;
}

.copy-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.copy-btn:hover .copy-text {
    color: white;
}

/* 遮罩层 */
.copy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

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

/* 复制菜单 */
.copy-menu {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 200px;
    animation: slideUp 0.3s ease-out;
}

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

/* 菜单按钮 */
.copy-menu-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.copy-title-btn {
    background: var(--primary-color);
    color: white;
}

.copy-title-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.copy-id-btn {
    background: var(--nature-green);
    color: white;
}

.copy-id-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cancel-btn {
    background: var(--border-color);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    background: var(--text-light);
    color: var(--text-primary);
}

/* ==========================================
   排除筛选 Modal
   ========================================== */

/* Modal 遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
    padding: 1rem;
}

/* Modal 对话框 */
.modal-dialog {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

/* Modal 头部 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--text-light);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Modal 主体 */
.modal-body {
    padding: 1.5rem;
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-description code {
    background: var(--background);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
}

/* 教程链接 */
.tutorial-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border-bottom: 1px solid transparent;
}

.tutorial-link:hover {
    color: var(--primary-hover);
    border-bottom-color: var(--primary-hover);
}

.modal-example {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.modal-example strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modal-example pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.exclude-textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s;
    background: var(--card-background);
}

.exclude-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.exclude-textarea::placeholder {
    color: var(--text-light);
}

.modal-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Modal 底部 */
.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-btn {
    flex: 1;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn-primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-btn-secondary {
    background: var(--border-color);
    color: var(--text-secondary);
}

.modal-btn-secondary:hover {
    background: var(--text-light);
    color: var(--text-primary);
}

/* 教程 Modal 特定样式 */
.tutorial-modal-dialog {
    max-width: 900px;
}

.tutorial-content {
    text-align: center;
    background: var(--background);
    padding: 1rem;
    border-radius: 10px;
}

.tutorial-gif {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

/* ==========================================
   无结果状态
   ========================================== */

.no-results {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results p {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.clear-btn {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.clear-btn:hover {
    background: var(--primary-hover);
}

/* ==========================================
   Footer
   ========================================== */

.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer p {
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

/* ==========================================
   响应式设计
   ========================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .title {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .filter-group {
        flex-direction: column;
    }

    .header {
        padding: 2rem 0 1.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (min-width: 1400px) {
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    }
}

/* ==========================================
   打印样式
   ========================================== */

@media print {
    .header,
    .search-bar,
    .footer {
        display: none;
    }

    .article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}
