/* 动画学初中数学 v2 */
:root {
  --primary: #4a6cf7;
  --primary-dark: #3a56d4;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #2d3436;
  --text-light: #636e72;
  --border: #e8ecf3;
  --video: #e74c3c;
  --file: #27ae60;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(30, 41, 59, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 顶栏 */
header {
  background: linear-gradient(135deg, #4a6cf7, #7c5cf7);
  color: #fff;
  padding: 14px 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(74, 108, 247, 0.25);
}
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo { color: #fff; text-decoration: none; font-size: 1.2em; font-weight: 700; }
.logo:hover { opacity: 0.9; }
nav { margin-left: auto; display: flex; gap: 10px; }
nav a {
  color: #fff; text-decoration: none; padding: 6px 14px;
  border-radius: 20px; background: rgba(255,255,255,0.15); font-size: 0.9em;
  transition: background 0.2s;
}
nav a:hover { background: rgba(255,255,255,0.3); }
.search-form { display: flex; align-items: center; background: #fff; border-radius: 22px; padding: 3px 4px 3px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.search-form input {
  border: none; background: transparent; padding: 8px 0;
  width: 200px; font-size: 0.9em; outline: none; color: var(--text);
}
.search-form button {
  border: none; border-radius: 50%; width: 34px; height: 34px;
  background: var(--primary); color: #fff; font-size: 0.9em;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.search-form button:hover { background: var(--primary-dark); }

/* 面包屑 */
.breadcrumb {
  max-width: 1100px; margin: 16px auto 0; padding: 0 20px;
  font-size: 0.9em; color: var(--text-light);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #b2bec3; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* 主区 */
main { max-width: 1160px; margin: 0 auto; padding: 28px 20px; }

/* 统计条 */
.stats-bar {
  display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.stat-chip {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 16px; font-size: 0.85em; color: var(--text-light);
  box-shadow: var(--shadow);
}
.stat-chip b { color: var(--primary); }

/* 区块 */
section { margin-bottom: 40px; }
section h2 {
  font-size: 1.05em; margin-bottom: 20px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
section h2::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s; box-shadow: var(--shadow);
  display: block;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(30,41,59,0.12); }
.card .icon { font-size: 1.8em; display: block; margin-bottom: 8px; }
.card .label {
  font-size: 0.95em; font-weight: 600; display: block;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card .badge {
  display: inline-block; margin-top: 8px; font-size: 0.75em;
  color: var(--text-light); background: #f1f3f9; border-radius: 10px; padding: 2px 10px;
}
.card .loc {
  display: block; margin-top: 6px; font-size: 0.75em; color: var(--text-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card.video-card .badge { background: #fdeaea; color: var(--video); }
.card.file-card .badge { background: #e8f8ee; color: var(--file); }
/* 视频卡片 - 封面缩略图模式 */
.card.video-card.has-thumb {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 170px;
  border: none;
  padding: 14px;
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(30,41,59,0.15);
}
.card.video-card.has-thumb:hover { transform: translateY(-3px) scale(1.01); }
.thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.50) 45%, rgba(0,0,0,0.82) 100%);
}
.card.video-card.has-thumb > span { position: relative; z-index: 1; }
.thumb-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.92); color: var(--video);
  font-size: 1.1em; display: flex; align-items: center; justify-content: center;
  z-index: 2; box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  transition: transform 0.15s;
}
.card.video-card.has-thumb:hover .thumb-play { transform: translate(-50%,-50%) scale(1.12); }
.card.video-card.has-thumb .label {
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6);
}
.card.video-card.has-thumb .badge {
  background: rgba(0,0,0,0.55); color: #fff; backdrop-filter: blur(2px);
}
.card.video-card.has-thumb .progress { background: rgba(255,255,255,0.25); }
.card.video-card.has-thumb .progress span { background: #fff; }
.card .progress {
  display: block; height: 4px; background: #eef1f7; border-radius: 2px; margin-top: 10px; overflow: hidden;
}
.card .progress span { display: block; height: 100%; background: var(--primary); border-radius: 2px; width: 0; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty p { font-size: 1.1em; margin-bottom: 12px; }
.empty a { color: var(--primary); text-decoration: none; }

/* 学习项卡片 (首页) - 背景图 + 遮罩 */
.grid.subjects {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}
.subject-card {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 200px;
  border: none;
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(30,41,59,0.18);
}
.subject-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 10px 28px rgba(30,41,59,0.28);
}
.subject-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.50) 45%, rgba(0,0,0,0.82) 100%);
}
.subject-card > span { position: relative; z-index: 1; }
.subject-top {
  display: flex; justify-content: space-between; align-items: center;
}
.subject-ext {
  background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.5);
  border-radius: 10px; padding: 2px 10px; font-size: 0.72em;
  backdrop-filter: blur(3px);
}
.subject-icon {
  font-size: 2em;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.subject-size {
  font-size: 0.78em; color: rgba(255,255,255,0.95);
  background: rgba(0,0,0,0.45); padding: 3px 10px; border-radius: 12px;
  font-weight: 600;
}
.subject-main {
  margin-top: auto;
  background: rgba(0,0,0,0.26);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 14px;
}
.subject-main .label {
  font-size: 1.2em; font-weight: 800; color: #fff;
  -webkit-line-clamp: 1; margin-bottom: 2px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.6);
  letter-spacing: 0.5px;
}
.subject-main .desc {
  display: block; font-size: 0.82em; color: rgba(255,255,255,0.92);
  margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.subject-meta { display: flex; gap: 6px; margin-top: 10px; }
.subject-meta .badge {
  background: rgba(0,0,0,0.5); color: #fff; font-size: 0.72em;
  padding: 3px 10px; border-radius: 12px;
  font-weight: 600;
}

/* 播放页 */
.player-wrap { max-width: 960px; margin: 0 auto; }
video { width: 100%; border-radius: var(--radius); background: #000; box-shadow: var(--shadow); }
.video-info { margin: 16px 0; padding: 14px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.video-info .name { font-size: 1.15em; font-weight: 700; }
.video-info .meta { color: var(--text-light); font-size: 0.85em; margin-top: 4px; }
.video-actions { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.video-actions .btn {
  display: inline-block; padding: 8px 20px; border-radius: 8px; text-decoration: none;
  font-size: 0.9em; cursor: pointer; border: none;
  background: var(--primary); color: #fff; transition: background 0.2s;
}
.video-actions .btn:hover { background: var(--primary-dark); }
.video-actions .btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.video-actions .btn.ghost:hover { background: #f1f3f9; }
.video-actions .btn.saved { background: #27ae60; }

/* 资料区 */
.files-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.files-section h3 { font-size: 1em; margin-bottom: 12px; color: var(--text); }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text);
  transition: background 0.15s;
}
.file-item:hover { background: #f8fafd; }
.file-item .f-icon { font-size: 1.4em; }
.file-item .f-name { flex: 1; font-size: 0.92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .f-size { color: var(--text-light); font-size: 0.8em; }
.file-item .f-dl { color: var(--primary); font-size: 0.85em; font-weight: 600; }

/* 播放列表 */
.playlist { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); margin-top: 20px; }
.playlist h3 { font-size: 1em; margin-bottom: 12px; }
.playlist ul { list-style: none; max-height: 420px; overflow-y: auto; }
.playlist li a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; text-decoration: none; color: var(--text); font-size: 0.9em;
}
.playlist li a:hover { background: #f1f5ff; }
.playlist li.current a { background: #eef2ff; color: var(--primary); font-weight: 600; }
.playlist li .num { color: var(--text-light); font-size: 0.8em; width: 28px; flex-shrink: 0; }

/* 搜索 */
.search-page form { display: flex; gap: 10px; margin-bottom: 24px; }
.search-page input {
  flex: 1; max-width: 500px; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 16px; font-size: 1em; outline: none;
}
.search-page input:focus { border-color: var(--primary); }
.search-page button {
  border: none; background: var(--primary); color: #fff; border-radius: 10px;
  padding: 10px 24px; font-size: 1em; cursor: pointer;
}
.result-count { color: var(--text-light); font-size: 0.9em; margin-bottom: 16px; }

footer { text-align: center; padding: 30px; color: #b2bec3; font-size: 0.8em; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .search-form input { width: 120px; }
}
