/* ============================================================
   资源列表 / 详情 / 筛选 / 分页 / 分类切换
   依赖 style.css 的 :root 设计 token
   ============================================================ */

/* 标签云（首页年级入口等） */
.tag-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-pill); color: var(--text-sub);
  font-size: 14px; font-weight: 500; transition: all 0.25s var(--ease);
}
.tag i { color: var(--text-weak); transition: color 0.2s var(--ease); }
.tag:hover {
  background: var(--primary); border-color: var(--primary); color: #fff;
  transform: translateY(-2px); box-shadow: var(--shadow-primary);
}
.tag:hover i { color: #fff; }

/* ============================================================
   资源卡片网格
   ============================================================ */
.res-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px;
}
@media (max-width: 1440px) { .res-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1200px) { .res-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 992px)  { .res-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .res-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 480px)  { .res-grid { grid-template-columns: 1fr; } }

.res-card {
  position: relative;
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; color: var(--text);
  transition: all 0.3s var(--ease); box-shadow: var(--shadow-xs);
}
.res-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-hover);
}
.res-card.mini .res-info { padding: 14px 16px; }
.res-thumb {
  position: relative; width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-soft) 100%);
  overflow: hidden;
}
.res-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.res-card:hover .res-thumb img { transform: scale(1.06); }
.res-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(15, 23, 42, 0.4) 100%);
  opacity: 0; transition: opacity 0.3s var(--ease);
}
.res-card:hover .res-thumb::after { opacity: 1; }
.res-badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  padding: 3px 10px; background: var(--primary); color: #fff;
  border-radius: var(--radius-pill); font-size: 11px; font-weight: 600;
  box-shadow: var(--shadow-primary);
}
.res-badge.hot { background: #F59E0B; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35); }
.res-badge.new { background: #10B981; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35); }
.res-info {
  padding: 14px 16px 16px; flex: 1;
  display: flex; flex-direction: column; gap: 6px;
}
.res-name {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  color: var(--text); margin-bottom: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.2s var(--ease);
}
.res-card:hover .res-name { color: var(--primary); }
.res-meta {
  font-size: 12px; color: var(--text-weak);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.res-meta i { font-size: 13px; }
.res-meta span { display: inline-flex; align-items: center; gap: 3px; }
.res-brief {
  font-size: 13px; color: var(--text-sub); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 2px;
}
.res-action {
  margin-top: auto; padding-top: 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-weak);
}
.res-action .dl-icon {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--primary); font-weight: 600;
}

/* ============================================================
   列表页布局（侧栏筛选 + 主区）
   ============================================================ */
.list-layout {
  display: grid; grid-template-columns: 240px 1fr; gap: 32px;
  align-items: start;
}
.list-aside {
  position: sticky; top: calc(var(--navbar-height) + 20px);
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-xs);
}
.list-aside h4 {
  font-size: 13px; color: var(--text-weak); text-transform: uppercase;
  letter-spacing: 0.1em; margin: 16px 0 10px; font-weight: 600;
}
.list-aside h4:first-child { margin-top: 0; }
.list-aside .filter-options {
  display: flex; flex-direction: column; gap: 4px;
}
.list-aside .filter-options a {
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-sub); transition: all 0.2s var(--ease);
}
.list-aside .filter-options a:hover {
  background: var(--primary-light); color: var(--primary); padding-left: 16px;
}
.list-aside .filter-options a.active {
  background: var(--primary); color: #fff; font-weight: 500;
}
.list-main { min-width: 0; }
.list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding: 12px 16px;
  background: var(--bg-soft); border-radius: var(--radius);
}
.list-toolbar .total {
  font-size: 14px; color: var(--text-sub);
}
.list-toolbar .total b { color: var(--primary); font-weight: 700; }
.list-toolbar .sort {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-weak);
}
.list-toolbar .sort a {
  padding: 4px 10px; border-radius: var(--radius-xs); color: var(--text-sub);
}
.list-toolbar .sort a.active {
  background: var(--primary); color: #fff;
}
@media (max-width: 992px) {
  .list-layout { grid-template-columns: 1fr; }
  .list-aside { position: static; }
}

/* 老式筛选栏（保留兼容） */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
  padding: 16px; background: var(--bg-soft); border-radius: var(--radius); border: 1px solid var(--border-light);
}
.filter-bar select {
  height: 38px; padding: 0 32px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); font-size: 14px; color: var(--text);
  min-width: 130px; outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5l3 3 3-3' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.filter-bar select:focus { border-color: var(--primary); }
.filter-bar button {
  height: 38px; padding: 0 18px;
  background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.2s var(--ease);
  display: inline-flex; align-items: center; gap: 4px;
}
.filter-bar button:hover { background: var(--primary-hover); }

/* ============================================================
   分类切换标签条（wangke /downloads.html 等）
   ============================================================ */
.cat-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}
.cat-tab {
  padding: 8px 18px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-sub); font-size: 14px; font-weight: 500;
  transition: all 0.2s var(--ease);
}
.cat-tab:hover {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
  transform: translateY(-1px);
}
.cat-tab.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: var(--shadow-primary);
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 40px; flex-wrap: wrap;
}
.pagination .pg {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-sub); font-size: 14px; font-weight: 500;
  background: var(--bg); transition: all 0.2s var(--ease);
}
.pagination .pg:hover {
  border-color: var(--primary); color: var(--primary);
  transform: translateY(-1px);
}
.pagination .pg.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}
.pagination .pg.ellipsis { border: 0; cursor: default; }

.empty {
  text-align: center; padding: 80px 20px;
  color: var(--text-weak); font-size: 15px;
}
.empty i { font-size: 48px; color: var(--border); margin-bottom: 16px; display: block; }

/* ============================================================
   资源详情页
   ============================================================ */
.detail {
  display: grid; grid-template-columns: 1fr 340px; gap: 40px;
  align-items: start;
}
.detail-main {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow-xs);
}
.detail-title {
  font-size: 30px; font-weight: 800; line-height: 1.3;
  margin-bottom: 16px; color: var(--text); letter-spacing: -0.02em;
}
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-size: 13px; color: var(--text-sub);
  padding-bottom: 20px; border-bottom: 1px solid var(--border-light); margin-bottom: 24px;
}
.detail-meta span { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta i { color: var(--primary); font-size: 15px; }
.detail-meta .meta-tag {
  padding: 2px 10px; background: var(--primary-light); color: var(--primary);
  border-radius: var(--radius-pill); font-weight: 500;
}
.detail-shot {
  width: 100%; max-width: 480px; margin: 0 auto 28px;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
}
.detail-shot img { width: 100%; display: block; }
.detail-desc {
  font-size: 15px; line-height: 1.9; color: var(--text-sub);
}
.detail-desc p { margin-bottom: 14px; }
.detail-desc h2, .detail-desc h3 { margin: 24px 0 12px; color: var(--text); }

/* 下载盒（侧栏 sticky） */
.detail-side { position: sticky; top: calc(var(--navbar-height) + 20px); }
.download-box {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.download-box h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  color: var(--text); display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-light);
}
.download-box h3 i { color: var(--primary); font-size: 18px; }
.dl-type {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--primary); font-weight: 600;
  padding: 4px 10px; background: var(--primary-light);
  border-radius: var(--radius-pill); margin-bottom: 14px;
}
.btn-dl {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; background: var(--primary); color: #fff;
  border-radius: var(--radius); font-size: 15px; font-weight: 600;
  transition: all 0.25s var(--ease); margin-bottom: 12px;
  box-shadow: var(--shadow-primary);
}
.btn-dl:hover {
  background: var(--primary-hover); color: #fff;
  transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}
.btn-dl i { font-size: 20px; }
.btn-read {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-sub); font-size: 14px; font-weight: 500;
  transition: all 0.2s var(--ease);
}
.btn-read:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.dl-memo {
  font-size: 13px; color: var(--text-sub); text-align: center;
  padding: 10px; background: var(--bg-soft); border-radius: var(--radius-sm);
}
.dl-memo b {
  color: var(--primary); font-size: 15px; font-weight: 700;
  padding: 2px 8px; background: var(--primary-light); border-radius: var(--radius-xs);
  margin-left: 4px;
}
.dl-empty {
  text-align: center; color: var(--text-weak);
  padding: 24px 0; font-size: 14px;
}
.qr-box {
  text-align: center; margin-top: 14px;
  padding-top: 14px; border-top: 1px dashed var(--border);
}
.qr-img {
  width: 180px; height: 180px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; background: var(--bg); margin: 0 auto;
}
.qr-tip {
  font-size: 12px; color: var(--text-weak); margin-top: 8px;
}

/* 详情侧栏推荐位 */
.side-block {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-xs);
}
.side-block h4 {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; gap: 6px;
}
.side-block h4 i { color: var(--primary); }
.rel-list { list-style: none; }
.rel-list li {
  padding: 10px 0; border-bottom: 1px dashed var(--border-light);
}
.rel-list li:last-child { border-bottom: 0; }
.rel-list li a {
  color: var(--text-sub); font-size: 14px;
  display: flex; align-items: flex-start; gap: 6px;
  transition: all 0.2s var(--ease);
}
.rel-list li a::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-weak); margin-top: 9px; flex-shrink: 0;
  transition: all 0.2s var(--ease);
}
.rel-list li a:hover { color: var(--primary); }
.rel-list li a:hover::before { background: var(--primary); }

/* 相关区块（详情底部） */
.block-rel { margin-top: 56px; }
.block-rel h2 {
  font-size: 22px; font-weight: 700; margin-bottom: 20px;
  color: var(--text); display: flex; align-items: center; gap: 10px;
}
.block-rel h2::before {
  content: ""; width: 4px; height: 22px; background: var(--primary); border-radius: 2px;
}

@media (max-width: 992px) {
  .detail { grid-template-columns: 1fr; gap: 24px; }
  .detail-side { position: static; }
  .detail-main { padding: 24px 20px; }
  .detail-title { font-size: 22px; }
}
@media (max-width: 768px) {
  .detail-title { font-size: 20px; }
}
