/* --- 基础样式重置 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Source Han Sans SC",sans-serif
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* --- 导航栏样式 (修复变形) --- */
header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem 5%;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav ul li a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.3s;
    white-space: nowrap; /* 核心修复：防止文字换行变形 */
}

nav ul li a:hover {
    color: #007bff;
    background: #e7f3ff;
    border-radius: 6px;
}

/* --- 搜索区域 --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.filter-section {
    text-align: center;
    margin-bottom: 40px;
}

.filter-section h1 {
    margin-bottom: 20px;
    color: #222;
}

.search-section {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.search-section input {
    width: 300px;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.search-section input:focus {
    border-color: #ffb800;
}

.search-section button {
    padding: 0 25px;
    background: #ffb800;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* --- 资料 Block 网格布局 --- */
.page-title {
    margin-bottom: 25px;
    padding-left: 10px;
    border-left: 5px solid #ffb800;
}

.material-grid {
    display: grid;
    /* 每行自动填充，每个 block 最小 300px */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* 单个 Block 的样式 (对应 main.js 生成的结构) */
.data-block {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.data-block:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.data-block h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.25rem;
}

.main-content {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1; /* 自动填满空间，让底部对齐 */
}

/* 底部价格和按钮 */
.block-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f5f5f5;
    padding-top: 15px;
}

.price-tag {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e63946;
}

.price-tag.free {
    color: #2a9d8f;
}

.view-btn {
    background: #007bff;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.view-btn:hover {
    background: #0056b3;
}
footer {
    background: #333;
    color: #d83b3b;
    padding: 12px 5%;
    text-align: center;
    margin-top: 50px;
}

/* 预览容器自适应处理 */
#preview-container {
    max-height: 70vh; /* 限制高度，防止太长 */
    overflow-y: auto;
    border: 2px solid #eee;
    background-color: #525659; /* 模仿 PDF 阅读器的深色底 */
}

#pdf-preview-canvas {
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#watermark-layer div {
    /* 辅助倾斜和间距 */
    user-select: none;
    font-weight: bold;
}


/* 预览区域：固定高度，负责“切掉”多余部分 */
/* 1. 窗户：大小固定 */
/* 容器：窗户大小固定 */
/* 1. 预览窗口：固定高度，负责截断 */
.preview-area {
    width: 100% !important;
    height: 160px !important;    /* 窗口高度固定 */
    background: #f0f0f0 !important;
    overflow: hidden !important;  /* 核心：切掉 160px 以下的所有内容 */
    position: relative !important;
    display: block !important;    /* 必须是 block，不能是 flex */
}

/* 2. PDF 画布：宽度铺满，高度随比例自然生长 */
.preview-area canvas {
    width: 100% !important;
    height: auto !important;      /* 核心：强制比例正常，绝不准垂直压缩 */
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* 预览区域：确保比例不畸形的关键 */
.preview-area {
    width: 100%;
    height: 160px;
    background: #f0f0f0;
    overflow: hidden;    /* 切掉底部，防止看到畸形的长图 */
    position: relative;
    display: block;      /* 强制 block，避免 flex 挤压 canvas */
}

.preview-area canvas {
    width: 100% !important;
    height: auto !important; /* 强制等比缩放，绝不拉伸 */
    position: absolute;
    top: 0;
    left: 0;
}

/* 付费相关 UI 样式 */
.pay-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4d4f;
    color: white;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 5;
}

.price-tag {
    color: #e63946;
    font-weight: bold;
    font-size: 1.1rem;
}

.pay-btn {
    background: #ffb800 !important; /* 付费按钮使用橙色区分 */
}
/* ====== Mobile Header Fix (put at END of list.css) ====== */
@media (max-width: 768px) {
  header{
    width: 100%;
    padding: 8px 12px;            /* 让 header 变矮 */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;           /* 整体居中 */
    gap: 8px;                      /* 各行之间间距 */
  }

  /* nav 在 list.css 里是 space-between + max-width，会导致不居中 */
  nav{
    width: 100%;
    max-width: none;
    margin: 0;
    justify-content: center;       /* 让 nav 内容居中 */
  }

  nav ul{
    width: 100%;
    justify-content: center;       /* 关键：导航项水平居中 */
    flex-wrap: wrap;               /* 小屏自动换行 */
    gap: 8px;
    padding: 0;
  }

  nav ul li a{
    padding: 6px 10px;             /* 导航按钮更紧凑 */
    font-size: 0.85rem;
  }

  /* 右侧登录区也居中 */
  .user-auth{
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* 你的 HTML 用的是 btn-link，不是 auth-link，所以要补上 */
  .btn-link{
    padding: 6px 12px;
    font-size: 0.85rem;
    display: inline-block;
  }
}
/* ====== Mobile Header + Layout Fix (merge) ====== */
@media (max-width: 768px) {

  /* 1) 顶部 header：铺满、居中、变矮 */
  header{
    width: 100%;
    padding: 6px 10px;          /* 更矮 */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;         /* 整体居中 */
    gap: 6px;                    /* 更紧凑 */
    text-align: center;
  }

  .logo h1{ font-size: 1.2rem; line-height: 1.2; }
  .logo p{  font-size: 0.75rem; margin-top: 2px; }

  /* 2) nav：修复 list.css 的 space-between，强制居中 */
  nav{
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    justify-content: center;
  }

  nav ul{
    width: 100%;
    display: flex;
    justify-content: center;     /* 关键：导航项居中 */
    flex-wrap: wrap;             /* 小屏自动换行 */
    gap: 6px;                    /* 更紧凑 */
    padding: 0;
    margin: 0;
  }

  nav ul li a{
    display: inline-block;
    padding: 5px 8px;            /* 按钮更小 */
    font-size: 0.82rem;
    border-radius: 6px;
  }

  /* 3) 登录区：居中 + 更紧凑（注意你 HTML 用的是 btn-link） */
  .user-auth{
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .user-status{ font-size: 0.85rem; }

  .btn-link{
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.82rem;
  }

  /* 4) 两条 hr 太占空间，手机端隐藏 */
  hr{ display: none; }

  /* 5) footer 变矮 + body 预留变小（避免挡住内容） */
  footer{
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.3;
  }
  body{
    padding-bottom: 70px;        /* 原来 120px 太大 */
  }
  /* 只留大标题，隐藏副标题 */
  .logo p{
    display: none;
  }
  .logo h1{
    font-size: 1.15rem;
    margin: 0;
  }
  /* header 和 main 之间更紧 */
  .container{
    margin-top: 0 !important;
    padding-top: 8px !important;   /* 想“几乎没有”就改成 0 */
  }

  /* 搜索区/标题那块也缩紧一点 */
  .filter-section{
    margin-bottom: 12px !important; /* 想更紧就 6px 或 0 */
  }
}
