/* =============================================================
   style.css —— 自考专升本学习工作台（初稿 v0.1）
   职责：全局主题、响应式布局、首页与课程详情页各模块样式、可访问性。
   ============================================================= */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f5ff;
  --surface-3: #f8fafc;
  --border: #e1e8f2;
  --border-strong: #cbd7e8;
  --text: #17233a;
  --text-2: #3c4b66;
  --muted: #667792;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0ff;
  --teal: #0e9f8a;
  --teal-soft: #e2f6f2;
  --amber: #c2740a;
  --amber-soft: #fff4e2;
  --red: #d0362f;
  --red-soft: #fdeceb;
  --shadow: 0 2px 12px rgba(23, 45, 90, .07);
  --shadow-lg: 0 12px 40px rgba(23, 45, 90, .16);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }

:focus-visible {
  outline: 3px solid #7aa6ff;
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap { width: min(1200px, calc(100% - 40px)); margin-inline: auto; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 68px;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); flex: 1 1 auto; min-width: 230px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0e9f8a);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.top-nav { display: flex; gap: 4px; align-items: center; }
.top-nav a {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}
.top-nav a:hover { background: var(--surface-2); text-decoration: none; }
.top-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

.header-countdown {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  white-space: nowrap;
}
.header-countdown strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.hc-label { font-size: 12px; }

/* ---------------- Layout ---------------- */
.site-main { padding: 28px 0 56px; min-height: 60vh; }
.section { margin-bottom: 30px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--primary-dark); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.notice {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
}

/* ---------------- Hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}
.hero-intro {
  padding: 26px;
  background: linear-gradient(135deg, #1e4fd8 0%, #2563eb 55%, #1aa39a 140%);
  color: #fff;
  border: none;
  position: relative;
  overflow: hidden;
}
.hero-intro::after {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  right: -80px;
  top: -100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.hero-intro h1 { font-size: clamp(21px, 3vw, 28px); margin: 8px 0 10px; position: relative; }
.hero-intro p { margin: 0; color: rgba(255, 255, 255, .9); font-size: 13.5px; max-width: 48ch; position: relative; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; }
.hero-tags span {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
}

.countdown-card { padding: 22px; display: flex; flex-direction: column; justify-content: center; }
.countdown-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.countdown-top h2 { font-size: 15px; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #f3dcb4; }
.badge.teal { background: var(--teal-soft); color: #0a7c6c; border-color: #bfe9df; }
.badge.gray { background: var(--surface-3); color: var(--muted); }

.countdown-display { display: flex; gap: 10px; margin: 18px 0 14px; flex-wrap: wrap; }
.cd-unit {
  flex: 1 1 70px;
  min-width: 68px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 10px 4px;
}
.cd-unit b { display: block; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.cd-unit small { font-size: 11px; color: var(--muted); }
.countdown-foot { color: var(--muted); font-size: 12.5px; margin: 0; }

/* ---------------- Exam info ---------------- */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.info-item { padding: 16px 18px; }
.info-item .k { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.info-item .v { font-size: 16px; font-weight: 650; margin-top: 6px; }
.info-item .s { font-size: 12px; color: var(--muted); margin-top: 4px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-3); color: var(--text-2); font-weight: 650; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfdff; }
td small { color: var(--muted); }

/* ---------------- Events ---------------- */
.event-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.event-item {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  align-items: start;
}
.event-date {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 6px 2px;
}
.event-date b { display: block; font-size: 18px; line-height: 1.1; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.event-date span { font-size: 11px; color: var(--muted); }
.event-item.past { opacity: .62; }
.event-item.high .event-date { background: var(--amber-soft); border-color: #f3dcb4; }
.event-item.high .event-date b { color: var(--amber); }
.event-body h3 { font-size: 14px; margin-bottom: 3px; }
.event-body p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.event-meta { display: flex; gap: 8px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.due { font-size: 11.5px; font-weight: 650; color: var(--primary-dark); }
.due.past { color: var(--muted); }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-note { display: block; margin-top: 6px; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 9px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

/* ---------------- Filters & course grid ---------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-box { position: relative; flex: 1 1 240px; }
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.course-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s ease, box-shadow .15s ease; }
a.course-card { color: inherit; }
a.course-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(23, 45, 90, .12); }
.cc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cc-code {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: .4px;
}
.cc-credit { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cc-name { font-size: 15px; font-weight: 650; line-height: 1.45; }
.cc-cat { font-size: 12px; color: var(--muted); }
.cc-progress { margin-top: auto; }
.cc-progress-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.cc-progress-head b { font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; transition: width .3s ease; }
.p0 { background: #cbd7e8; }
.p1 { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.p2 { background: linear-gradient(90deg, #f0a13a, #e0841a); }
.p3 { background: linear-gradient(90deg, #24b39c, #0e9f8a); }
.cc-footer { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.cc-footer .go { color: var(--primary-dark); font-weight: 600; }

/* ---------------- Course detail ---------------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary-dark); }
.course-hero { padding: 22px; margin-bottom: 18px; }
.course-hero-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.course-hero h1 { font-size: clamp(20px, 3vw, 25px); margin: 8px 0 8px; }
.course-hero p { margin: 0; color: var(--text-2); font-size: 13.5px; max-width: 74ch; }
.course-hero .meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.progress-control { display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-top: 18px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); flex-wrap: wrap; }
.progress-control label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.progress-control input[type="range"] { flex: 1 1 180px; accent-color: var(--primary); min-width: 140px; }
.progress-control output { font-size: 18px; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.btn {
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 5px 11px; font-size: 12px; }
.icon-btn { border: none; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); padding: 2px 8px; }
.icon-btn:hover { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab {
  border: none;
  background: transparent;
  padding: 11px 15px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--primary-dark); }
.tab.active { color: var(--primary-dark); font-weight: 700; border-bottom-color: var(--primary); }
.tab-panel { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 17px; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.panel-note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: 0 8px 8px 0; margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; }
.summary-list { display: grid; gap: 10px; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.summary-row:last-child { border-bottom: none; }
.summary-row span { color: var(--muted); }
.summary-row b { font-weight: 650; }

.ratio-bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 90px; }
.ratio-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #0e9f8a); }

/* Knowledge */
.knowledge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.k-group { padding: 16px 18px; }
.k-group h3 { font-size: 14.5px; margin-bottom: 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.k-group h3 small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.k-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.k-list li { margin: 0; }
.k-list label { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; padding: 5px 6px; border-radius: 7px; line-height: 1.5; }
.k-list label:hover { background: var(--surface-3); }
.k-list input { margin-top: 4px; accent-color: var(--primary); flex: none; }
.k-list input:checked + span { text-decoration: line-through; color: var(--muted); }

/* Papers */
.paper-list { display: grid; gap: 10px; }
.paper-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; flex-wrap: wrap; }
.paper-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.paper-main { flex: 1 1 180px; }
.paper-main b { font-size: 14px; }
.paper-main small { display: block; color: var(--muted); font-size: 12px; }
.paper-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Notes */
.note-editor { padding: 18px; }
.note-editor textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  line-height: 1.75;
  font-size: 14px;
}
.note-editor textarea:focus { background: var(--surface); }
.note-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.note-status { font-size: 12px; color: var(--muted); }
.note-tips { margin-top: 14px; font-size: 12.5px; color: var(--muted); }

/* Attachments */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  background: var(--surface-3);
  transition: border-color .15s ease, background .15s ease;
}
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone p { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.upload-zone small { color: var(--muted); font-size: 12px; }
.upload-zone .btn { margin-top: 14px; }
.upload-zone input[type="file"] { display: none; }
.file-list { display: grid; gap: 10px; margin-top: 16px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.file-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.file-main { flex: 1 1 200px; min-width: 0; }
.file-main b { font-size: 13.5px; word-break: break-all; }
.file-main small { display: block; color: var(--muted); font-size: 11.5px; }
.file-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 14px; }

/* ---------------- Modal / toast ---------------- */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 27, 50, .55); }
.modal-panel {
  position: relative;
  width: min(900px, 100%);
  max-height: min(88dvh, 900px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 15px; word-break: break-all; }
.modal-body { padding: 16px; overflow: auto; background: var(--surface-3); }
.modal-body img { max-width: 100%; height: auto; display: block; margin-inline: auto; }
.modal-body iframe { width: 100%; height: min(70dvh, 640px); border: none; background: #fff; }
.modal-body pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text-2); margin: 0; }

.toast[hidden] { display: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  background: #1b2b48;
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 40px);
  text-align: center;
}

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px 0 30px; }
.footer-inner p { margin: 0 0 7px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.footer-inner strong { color: var(--text-2); }
.footer-meta { margin-top: 12px !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .header-inner { gap: 12px; padding-block: 10px; }
  .top-nav { order: 3; width: 100%; overflow-x: auto; }
  .header-countdown { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .event-list { grid-template-columns: 1fr; }
  .knowledge-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .wrap { width: min(100% - 24px, 1200px); }
  .site-main { padding-top: 20px; }
  .hero-intro, .countdown-card, .card-pad, .course-hero { padding: 18px; }
  .course-grid, .info-grid { grid-template-columns: 1fr; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 21px; }
  .cd-unit { min-width: 60px; flex-basis: 60px; }
  .section-head h2 { font-size: 17px; }
  th, td { padding: 9px 10px; }
  table { min-width: 620px; }
  .paper-actions, .file-actions { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
