/* ============================================
   民国时期农户量化数据库 - 古典学术风格样式表
   ============================================ */

/* CSS变量定义 */
:root {
    --bg-primary: #f5f0e6;      /* 米白背景 */
    --bg-secondary: #f0e6d2;   /* 淡黄悬停 */
    --bg-paper: #faf8f3;       /* 纸张白 */
    --text-primary: #3d2914;     /* 深褐文字 */
    --text-secondary: #5c4033;   /* 次要文字 */
    --accent-red: #8b0000;       /* 暗红点缀 */
    --accent-green: #2d5a4a;     /* 青绿成功 */
    --border-color: #d4c4b0;     /* 浅褐边框 */
    --shadow: rgba(61, 41, 20, 0.1);
    --shadow-dark: rgba(61, 41, 20, 0.2);
    
    --font-serif: 'Noto Serif SC', 'SimSun', 'STSong', serif;
    --font-sans: 'Noto Sans SC', 'Microsoft YaHei', 'SimHei', sans-serif;
    --font-english: 'Times New Roman', Georgia, serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.8;
    min-height: 100vh;
}

/* 字体引入 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

/* ============================================
   导航栏样式
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 3rem;
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-red);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-red);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a.active {
    color: var(--accent-red);
}

.nav-links a.active::after {
    width: 100%;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ============================================
   首页样式
   ============================================ */
.home-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 2rem 2rem;
    position: relative;
    background-image: url('/uploads/background/home-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.home-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 240, 230, 0.5);  /* 改为0.4，能看到背景但文字仍清晰 */
    z-index: 0;
}

.home-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
}

.main-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    text-shadow: 1px 1px 2px var(--shadow);
}

.subtitle {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

/* 四栏目入口网格 */
.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.portal-card {
    background: var(--bg-paper);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.portal-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px var(--shadow-dark);
    border-color: var(--accent-red);
    background: var(--bg-secondary);
}

.portal-icon {
    font-size: 2.5rem;
    color: var(--accent-red);
    margin-bottom: 1rem;
}

.portal-title {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.portal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   页面通用样式
   ============================================ */
.page-container {
    padding: 80px 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* 锚点导航 */
.anchor-nav {
    position: sticky;
    top: 60px;
    background: var(--bg-primary);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    margin-bottom: 2rem;
}

.anchor-nav ul {
    display: flex;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    flex-wrap: wrap;
}

.anchor-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.anchor-nav a:hover {
    color: var(--accent-red);
}

/* 内容区块 */
.content-section {
    margin-bottom: 4rem;
    scroll-margin-top: 120px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-red);
    display: inline-block;
}

.section-content {
    font-size: 1rem;
    line-height: 2;
    color: var(--text-secondary);
    text-align: justify;
}

/* ============================================
   团队介绍卡片
   ============================================ */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.team-card {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
    border-color: var(--accent-red);
}

.team-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-secondary);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.team-name {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.team-title {
    font-size: 0.9rem;
    color: var(--accent-red);
    margin-bottom: 0.5rem;
}

.team-research {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.team-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-english);
}

/* ============================================
   研究留影画廊
   ============================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.gallery-caption {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   筛选器样式
   ============================================ */
.filter-bar {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--text-primary);
}

.filter-select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.filter-btn {
    padding: 0.6rem 1.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: var(--accent-red);
}

/* ============================================
   古典表格样式
   ============================================ */
.table-container {
    overflow-x: auto;
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.classic-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-paper);
    min-width: 800px;
}

.classic-table th {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 14px 12px;
    font-family: var(--font-serif);
    font-weight: 600;
    border: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.classic-table td {
    padding: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.classic-table tr:nth-child(even) {
    background: rgba(212, 196, 176, 0.2);
}

.classic-table tr:hover {
    background: var(--bg-secondary);
    cursor: pointer;
}

/* 表格状态提示 */
.table-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.table-message i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
    display: block;
}

/* ============================================
   分页器样式
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.pagination button.active {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   上传区域样式
   ============================================ */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-paper);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-red);
    background: var(--bg-secondary);
}

.upload-icon {
    font-size: 3rem;
    color: var(--accent-red);
    margin-bottom: 1rem;
}

.upload-text {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-input {
    display: none;
}

/* 上传要求 */
.upload-requirements {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.upload-requirements h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-requirements h3 i {
    color: var(--accent-red);
}

.upload-requirements ul {
    list-style: none;
    padding-left: 0;
}

.upload-requirements li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.upload-requirements li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-red);
    font-weight: bold;
}

/* 进度条 */
.progress-container {
    margin-bottom: 2rem;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-red));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 上传结果 */
.upload-result {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: none;
}

.upload-result.active {
    display: block;
}

.upload-result.success {
    border-color: var(--accent-green);
    background: rgba(45, 90, 74, 0.05);
}

.upload-result.error {
    border-color: var(--accent-red);
    background: rgba(139, 0, 0, 0.05);
}

.result-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-result.success .result-title {
    color: var(--accent-green);
}

.upload-result.error .result-title {
    color: var(--accent-red);
}

.result-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 数据状态 */
.data-status {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-item {
    text-align: center;
}

.status-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-red);
    font-family: var(--font-english);
}

.status-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   PDF预览模态框
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.pdf-viewer {
    width: 100%;
    height: 70vh;
    border: none;
}

/* ============================================
   数据详情弹窗
   ============================================ */
.detail-modal .modal-content {
    max-width: 700px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

.detail-item {
    padding: 0.8rem;
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   页脚样式
   ============================================ */
.footer {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.footer-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 2px solid var(--border-color);
        gap: 1rem;
    }

    .nav-links.active {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }

    .main-title {
        font-size: 2rem;
    }

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

    .page-title {
        font-size: 1.8rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .team-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .result-stats {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ============================================
   加载动画
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   提示信息
   ============================================ */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.alert-info {
    background: rgba(45, 90, 74, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.alert-warning {
    background: rgba(139, 0, 0, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.alert i {
    font-size: 1.2rem;
}
/* ============================================
   数据简介样式（数据简介板块）
   ============================================ */
.data-item {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px dashed var(--border-color);
}

.data-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.item-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    font-weight: 600;
}

.item-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    text-align: justify;
}

.item-content strong {
    color: var(--text-primary);
    font-weight: 600;
}