/* 全局变量 */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 280px;
}

/* 基础重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

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

/* --- Header 顶部栏 --- */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.25rem;
    cursor: pointer;
    margin: 0;
    font-weight: 700;
    color: #0f172a;
}

.github-link {
    color: var(--text-main);
    opacity: 0.6;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.github-link:hover {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-search input {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-page);
    width: 240px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.header-search input:focus {
    width: 320px;
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-blog-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: var(--primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #dbeafe;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.header-blog-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* --- 主布局 --- */
.main-layout {
    display: flex;
    gap: 40px;
    margin-top: 30px;
    align-items: flex-start;
}

/* --- 左侧边栏 --- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 10px;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section {
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #dbeafe;
}

.stat-card span {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-card label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-group {
    margin-bottom: 30px;
}

.nav-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 1.2px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 10px;
}

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

.nav-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.nav-item .count {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.nav-item.active .count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- 右侧内容区 --- */
.content-area {
    flex: 1;
    min-width: 0;
}

.filter-status {
    background: #eff6ff;
    color: var(--primary);
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #dbeafe;
    animation: fadeIn 0.3s ease;
}

.filter-status button {
    background: white;
    border: 1px solid #bfdbfe;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.filter-status button:hover {
    background: #dbeafe;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
}

@media (min-width: 900px) {
    .timeline {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1300px) {
    .timeline {
        grid-template-columns: repeat(3, 1fr);
    }
}

.paper-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    top: 0;
}

.paper-card:hover {
    top: -4px;
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.paper-date {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 500;
}

.paper-title {
    font-size: 1.15rem;
    margin: 0 0 12px 0;
    color: #0f172a;
    line-height: 1.5;
    font-weight: 700;
}

.paper-abstract {
    font-size: 0.95rem;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

/* 新增：卡片底部容器 (关键词 + 点赞) */
.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
    padding-top: 10px;
}

.paper-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 0.75rem;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

/* 新增：点赞按钮样式 */
.like-btn {
    background: #fff0f0;
    border: 1px solid #ffe4e6;
    color: #e11d48;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-weight: 600;
    flex-shrink: 0;
}

.like-btn:hover {
    background: #ffe4e6;
    transform: scale(1.05);
}

.like-btn:active {
    transform: scale(0.95);
}

.heart-icon {
    font-size: 1rem;
}

/* 点击动画类 */
.liked-anim {
    animation: heartBeat 0.3s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}


/* --- Modal 弹窗 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 850px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #0f172a;
}

.close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0;
}

.close:hover {
    color: #0f172a;
}

.detail-meta {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #334155;
}

.btn-link {
    display: inline-block;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 10px;
    font-weight: 500;
    transition: background 0.2s;
}

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

@media (max-width: 850px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 30px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .header-search input {
        width: 100%;
    }

    .header-search input:focus {
        width: 100%;
    }
    
    .header-blog-btn {
        justify-content: center;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    border: 3px solid #f1f5f9;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    align-items: center;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.sort-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 5px;
}

.sort-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.sort-btn.active {
    background: #eff6ff;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
}