/* ============================================
   四级真题资源下载站 — 样式表
   ============================================ */

/* --- CSS 变量 & 主题 --- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- 全局重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

a { text-decoration: none; color: inherit; }

/* --- 顶部导航栏 --- */
.header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: #fff;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.header-content { position: relative; z-index: 1; }
.header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; }
.header h1 .icon { display: inline-block; animation: bounce 2s infinite; }
.header p { margin-top: 0.35rem; font-size: 1rem; opacity: 0.85; font-weight: 400; }
.header .stats { margin-top: 1rem; display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.header .stat-item {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
}
.header .stat-item strong { font-size: 1.1rem; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* --- 主容器 --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

/* --- Tab 切换栏 --- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: -1.2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: 1rem 0 0.75rem;
}

.tabs {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tab-btn {
  padding: 0.65rem 1.4rem;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: #fff; background: var(--primary); }
.tab-btn .badge {
  display: inline-block;
  margin-left: 0.35rem;
  background: rgba(255,255,255,.3);
  color: inherit;
  border-radius: 10px;
  padding: 0 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
}
.tab-btn:not(.active) .badge {
  background: var(--primary-light);
  color: var(--primary);
}

/* --- 搜索框 --- */
.search-wrap {
  margin-left: auto;
  position: relative;
}
.search-wrap input {
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 0.9rem;
  outline: none;
  width: 220px;
  transition: var(--transition);
  background: var(--card-bg);
}
.search-wrap input:focus { border-color: var(--primary); width: 280px; box-shadow: 0 0 0 3px var(--primary-light); }
.search-wrap .search-icon {
  position: absolute;
  left: 0.8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* --- 筛选栏 --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.filter-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  color: var(--text-secondary);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- 操作栏 --- */
.action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.action-bar .count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.action-bar .count strong { color: var(--primary); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* --- 全选 checkbox --- */
.select-all-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}
.select-all-label input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* --- 卡片网格 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .card-grid { grid-template-columns: 1fr; } }

/* --- 卡片 --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 2.5px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeUp 0.4s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card.selected { border-color: var(--primary); background: var(--primary-light); }
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.06s; }
.card:nth-child(4) { animation-delay: 0.08s; }
.card:nth-child(5) { animation-delay: 0.10s; }
.card:nth-child(6) { animation-delay: 0.12s; }
.card:nth-child(7) { animation-delay: 0.14s; }
.card:nth-child(8) { animation-delay: 0.16s; }
.card:nth-child(n+9) { animation-delay: 0.18s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 卡片选中勾 */
.card .check-circle {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.7rem;
  color: transparent;
}
.card.selected .check-circle { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 卡片图标 */
.card .file-icon {
  font-size: 2.5rem;
  text-align: center;
  line-height: 1;
}
.card .file-name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.card .file-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.card .file-meta span {
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}
.card .file-size { font-size: 0.78rem; color: var(--text-secondary); }
.card .btn-download {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.card .btn-download:hover { background: var(--primary-dark); }
.card.selected .btn-download { background: var(--primary-dark); }

/* --- 空状态 --- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.empty-state p { font-size: 1.1rem; }

/* --- 加载/进度模态框 --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  min-width: 320px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 1rem; }
.modal-box .progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin: 0.75rem 0;
}
.modal-box .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 5px;
  width: 0%;
  transition: width 0.3s ease;
}
.modal-box .progress-text { font-size: 0.85rem; color: var(--text-secondary); }
.modal-box .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 页脚 --- */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* --- 响应式调整 --- */
@media (max-width: 768px) {
  .header h1 { font-size: 1.5rem; }
  .toolbar { flex-direction: column; align-items: stretch; margin-top: -1rem; }
  .search-wrap { margin-left: 0; }
  .search-wrap input { width: 100%; }
  .search-wrap input:focus { width: 100%; }
  .filter-bar { gap: 0.5rem; }
}
