/* 研究成果页面样式 - 重构版 */

/* 论文展示区域 */
.papers-section {
    padding: var(--spacing-xl) 0;
}

.papers-container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 左侧筛选区域 */
.filter-section {
    flex: 0 0 280px;
    height: fit-content;
    /* 恢复 sticky 定位，整个面板固定 */
    position: sticky;
    top: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    /* 确保内容不会溢出 */
    max-width: 280px;
}

/* 筛选标签 */
.filter-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.filter-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    outline: none;
    position: relative;
    /* 确保按钮不会超出容器 */
    box-sizing: border-box;
    text-align: center;
}

.filter-tab:hover {
    background: rgba(0, 51, 102, 0.05);
    color: var(--primary-color);
}

.filter-tab.active {
    background: white;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* 筛选面板通用样式 */
.filter-panel {
    background: white;
    border-radius: 0;
    padding: 0;
    overflow: hidden;
    display: none; /* 默认隐藏所有面板 */
    border-top: 1px solid #e5e7eb;
}

.filter-panel.active {
    display: block; /* 只显示激活的面板 */
}

/* 年份筛选 */
.year-filter {
    /* 不再需要 overflow-y auto，由内部滚动容器处理 */
}

/* 移除容器的滚动条样式 - 现在由 year-list 处理 */

/* 标题区域 - 固定在顶部 - 隐藏重复标题 */
.year-filter h3,
.journal-filter h3 {
    display: none; /* 隐藏重复的标题文字，因为已有筛选按钮表明功能 */
}

/* 年份列表滚动区域 */
.year-list,
.journal-list {
    max-height: 600px; /* 增加一倍高度，从300px到600px */
    overflow-y: auto;
    padding: 15px 15px 15px 15px; /* 增加顶部内边距，因为隐藏了标题 */
    /* 美化滚动条 */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

/* Webkit 滚动条美化 - 移动到年份和期刊列表 */
.year-list::-webkit-scrollbar,
.journal-list::-webkit-scrollbar {
    width: 6px;
}

.year-list::-webkit-scrollbar-track,
.journal-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.year-list::-webkit-scrollbar-thumb,
.journal-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.year-list::-webkit-scrollbar-thumb:hover,
.journal-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.year-item,
.journal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.year-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.year-item:hover::before {
    left: 100%;
}

.year-item:hover,
.journal-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.15);
}

.year-item.active,
.journal-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 6px 16px rgba(0, 51, 102, 0.25);
}

.year-item.active::after {
    content: '✓';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
}

.year-text,
.journal-text {
    font-weight: 500;
    font-size: 0.95rem;
    flex: 1;
    margin-right: 8px;
}

.year-count,
.journal-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 25px;
    text-align: center;
    flex-shrink: 0;
}

.year-item:hover .year-count,
.year-item.active .year-count {
    background: rgba(255, 255, 255, 0.3);
}

.year-stats,
.journal-stats {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    margin: 0;
    /* 统计信息固定在底部，不参与滚动 */
    position: relative;
    z-index: 1;
}

.year-stats p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
}

.year-stats span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* 右侧论文内容 */
.papers-content {
    flex: 1;
    min-width: 0;
}

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

.papers-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.view-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 论文列表样式 */
.papers-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.paper-item {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

/* 添加加载动画 */
.paper-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.paper-item.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 51, 102, 0.1) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.paper-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-left-color: var(--primary-color);
}

.paper-item.highlight {
    border-left-color: var(--accent-color);
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.paper-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.paper-title.journal-high-impact {
    color: var(--primary-color);
}

/* 论文标题链接样式 - 简洁版 */
.paper-title-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: inherit;
}

.paper-title-link:hover {
    color: #2563eb;
    font-weight: 600;
}

.journal-high-impact .paper-title-link:hover {
    color: #dc2626;
}

.paper-journal {
    font-size: 1.3rem !important;
    color: #000000 !important;
    font-weight: 800 !important;
    margin-bottom: 10px;
    font-style: italic !important;
    letter-spacing: 0.5px;
}

/* Tier 1-2 期刊自动高亮 */
.journal-tier-1 .paper-journal .journal-highlight,
.journal-tier-2 .paper-journal .journal-highlight {
    color: #000000;
    font-weight: 800;
    font-size: 1.4rem;
    font-style: normal;
}

.paper-authors {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* 确保作者姓名显示为黑色 - 使用最高优先级选择器覆盖research.css */
.papers-section .paper-item .paper-authors strong,
.papers-section .papers-list .paper-authors strong,
.papers-content .paper-item .paper-authors strong,
.papers-content .papers-list .paper-authors strong {
    font-weight: normal !important;
    color: #000 !important;
}

/* 特定作者姓名变黑样式 */
.paper-authors .highlight-author {
    color: #000000 !important;
    font-weight: normal !important;
}

.paper-abstract {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #ddd;
}

.paper-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.paper-year {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.paper-actions {
    display: flex;
    gap: 10px;
}

.paper-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.paper-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* 添加论文区域 */
.add-paper-area {
    margin-top: 30px;
    text-align: center;
}

.add-paper-placeholder {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
    position: relative;
    overflow: hidden;
}

.add-paper-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 51, 102, 0.05), transparent);
    transition: left 0.6s ease;
}

.add-paper-placeholder:hover::before {
    left: 100%;
}

.add-paper-placeholder:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.1);
}

.add-icon {
    display: block;
    font-size: 3rem;
    color: #bbb;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.add-paper-placeholder:hover .add-icon {
    color: var(--primary-color);
    transform: rotate(90deg) scale(1.1);
}

.add-paper-placeholder p {
    margin: 0;
    color: #888;
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.add-paper-placeholder:hover p {
    color: var(--primary-color);
}

/* 卡片视图样式 */
.papers-list.card-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.papers-list.card-view .paper-item {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.papers-list.card-view .paper-abstract {
    flex: 1;
}

/* 加载动画 */
.loading-papers {
    text-align: center;
    padding: 40px;
    color: #888;
}

.loading-papers::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 1.3rem;
}

.empty-state p {
    margin: 0;
    color: #999;
    font-size: 1rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .papers-container {
        flex-direction: column;
    }

    .filter-section {
        flex: none;
        position: static;
        margin-bottom: 30px;
        max-height: none;
    }

    .filter-tabs {
        margin-bottom: 0;
    }

    .filter-tab {
        padding: 14px 18px;
        font-size: 1rem;
    }

    .filter-panel.active {
        max-height: 300px;
        overflow-y: auto;
    }

    .year-list,
    .journal-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        max-height: none;
        padding: 15px;
    }

    .year-item,
    .journal-item {
        flex: 1 1 calc(50% - 10px);
        min-width: 120px;
        margin-bottom: 10px;
    }

    /* 年份筛选在平板端的优化 */
    .year-filter h3 {
        font-size: 1.2rem;
        padding: 20px 15px 12px 15px;
    }

    .year-list {
        max-height: 300px;
        padding: 0 15px 15px 15px;
    }

    .year-stats {
        padding: 12px 15px;
    }

    .year-stats {
        text-align: center;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .papers-section {
        padding: var(--spacing-lg) 0;
        /* 让papers-section占据全屏宽度 */
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .papers-container {
        flex-direction: column;
        /* 容器占据全宽 */
        width: 100%;
    }

    .filter-section {
        flex: none;
        position: static;
        margin-bottom: 30px;
        max-height: none;
        /* 在手机端占据全屏宽度 */
        width: 100%;
        max-width: 100%;
    }

    .filter-tabs {
        margin-bottom: 0;
    }

    .filter-tab {
        padding: 14px 18px;
        font-size: 1rem;
    }

    .filter-panel.active {
        max-height: 300px;
        overflow-y: auto;
    }

    .year-filter {
        padding: 20px 15px;
    }

    .year-list {
        flex-direction: column;
    }

    .year-item {
        flex: none;
        min-width: auto;
        padding: 15px;
    }

    .year-text {
        font-size: 1rem;
    }

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

    .paper-item {
        padding: 20px;
    }

    .paper-title {
        font-size: 1.1rem;
        line-height: 1.5;
    }

    .paper-journal {
        font-size: 0.95rem;
    }

    .paper-abstract {
        padding: 15px;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .papers-list.card-view {
        grid-template-columns: 1fr;
    }

    .view-options {
        align-self: stretch;
        justify-content: center;
    }

    /* 优化移动端的年份筛选 */
    .year-filter {
        background: white;
        border: 1px solid #eee;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .year-filter h3 {
        padding: 15px 12px 10px 12px;
        background: white !important;
    }

    .year-list {
        max-height: 250px;
        padding: 0 12px 12px 12px;
    }

    .year-stats {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .filter-section {
        padding: 15px;
        /* 确保在小屏幕上也是全宽 */
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .year-filter {
        padding: 15px;
    }

    .year-filter h3 {
        font-size: 1.1rem;
        padding: 12px 10px 8px 10px;
        background: white !important;
    }

    .year-list {
        max-height: 200px;
        padding: 0 10px 10px 10px;
    }

    .year-stats {
        padding: 8px 10px;
    }

    .year-item {
        padding: 12px;
        margin-bottom: 8px;
    }

    .year-item.active::after {
        right: 12px;
    }

    .paper-item {
        padding: 15px;
    }

    .paper-title {
        font-size: 1rem;
        line-height: 1.4;
    }

    .paper-journal {
        font-size: 0.9rem;
    }

    .paper-authors {
        font-size: 0.85rem;
    }

    .paper-abstract {
        padding: 12px;
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .paper-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .paper-actions {
        align-self: stretch;
        justify-content: center;
    }

    .paper-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    /* 视图按钮在移动端的优化 */
    .view-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* 添加论文区域的移动端优化 */
    .add-paper-placeholder {
        padding: 30px 15px;
    }

    .add-icon {
        font-size: 2.5rem;
    }

    .add-paper-placeholder p {
        font-size: 1rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .year-filter {
        padding: 12px;
    }

    .paper-item {
        padding: 12px;
    }

    .paper-title {
        font-size: 0.95rem;
    }

    .add-paper-placeholder {
        padding: 25px 12px;
    }

    .add-icon {
        font-size: 2rem;
    }
}

/* 打印样式 */
@media print {
    .year-filter,
    .view-options,
    .add-paper-area,
    .paper-actions {
        display: none;
    }

    .papers-container {
        flex-direction: column;
    }

    .paper-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}