/* 研学平台 · 全局样式（翰林紫品牌色系） */
:root {
  --purple: #7030B0;
  --purple-dark: #501070;
  --purple-bright: #9030F0;
  --purple-bg: #F5EEFB;
  --purple-bg-soft: #FBF8FE;
  --ink: #3A3A3A;
  --ink-2: #5B5B6B;
  --muted: #8A8A9C;
  --line: #ECE7F5;
  --bg: #F6F5FA;
  --white: #FFFFFF;
  --green: #2E9E6B;
  --green-bg: #E8F6EF;
  --amber: #C77A12;
  --amber-bg: #FDF3E2;
  --red: #C8393C;
  --red-bg: #FBECEC;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 4px 18px rgba(80, 16, 112, .07);
  --shadow-lg: 0 12px 40px rgba(80, 16, 112, .14);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

a { color: var(--purple); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 顶部栏 ---------- */
.topbar {
  height: 60px;
  background: linear-gradient(100deg, var(--purple-dark) 0%, var(--purple) 55%, var(--purple-bright) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 2px 12px rgba(80, 16, 112, .18);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}
.brand-text { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; opacity: .78; margin-top: -3px; }
.topbar-spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  cursor: pointer;
}
.user-chip .uname { font-size: 13px; font-weight: 600; }
.user-chip .urole { font-size: 11px; opacity: .8; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--purple-bright);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: 0 0 auto;
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.xl { width: 76px; height: 76px; font-size: 28px; }

.dropdown {
  position: absolute; right: 20px; top: 56px;
  background: #fff; color: var(--ink);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  min-width: 180px; overflow: hidden; z-index: 70;
  border: 1px solid var(--line);
}
.dropdown-item { padding: 11px 16px; font-size: 14px; cursor: pointer; }
.dropdown-item:hover { background: var(--purple-bg-soft); }
.dropdown-sep { height: 1px; background: var(--line); }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: calc(100vh - 60px); }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 11px;
  color: var(--ink-2); font-size: 14.5px; cursor: pointer;
  margin-bottom: 4px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--purple-bg-soft); }
.nav-item.active { background: var(--purple-bg); color: var(--purple-dark); font-weight: 600; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; border-radius: 999px; padding: 1px 7px; font-weight: 600;
}

.content { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0; color: var(--purple-dark); }
.page-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------- 移动端底部导航 ---------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  z-index: 60; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item {
  flex: 1; padding: 8px 0 6px; text-align: center;
  font-size: 11px; color: var(--muted); border: none; background: none;
}
.tabbar-item .t-ico { font-size: 19px; display: block; line-height: 1.3; }
.tabbar-item.active { color: var(--purple); font-weight: 600; }

/* ---------- 卡片与网格 ---------- */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
  border: 1px solid rgba(236, 231, 245, .8);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 15.5px; font-weight: 700; color: var(--purple-dark);
  margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.card-title .sub { font-weight: 400; font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- 研学项目卡片 ---------- */
.program-card {
  background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
  border: 1px solid rgba(236, 231, 245, .8);
  transition: transform .18s ease, box-shadow .18s ease;
}
.program-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.program-cover {
  height: 118px; display: flex; align-items: center; justify-content: center;
  font-size: 46px; color: #fff; position: relative;
}
.program-cover .cover-tag {
  position: absolute; left: 12px; top: 12px;
  background: rgba(255, 255, 255, .92); color: var(--purple-dark);
  font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
}
.program-cover .cover-status {
  position: absolute; right: 12px; top: 12px;
  background: rgba(0, 0, 0, .32); color: #fff;
  font-size: 11.5px; padding: 2px 10px; border-radius: 999px;
}
.program-body { padding: 14px 16px 16px; }
.program-title { font-size: 15.5px; font-weight: 700; margin: 0 0 6px; line-height: 1.45; }
.program-summary {
  font-size: 13px; color: var(--ink-2); margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.program-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.program-meta span { display: flex; align-items: center; gap: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 14px;
  transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--purple); color: var(--purple); }
.btn-primary {
  background: linear-gradient(100deg, var(--purple) 0%, var(--purple-bright) 100%);
  color: #fff; border: none; box-shadow: 0 3px 10px rgba(112, 48, 176, .28);
}
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-danger { background: var(--red); color: #fff; border: none; }
.btn-danger:hover { filter: brightness(1.06); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 标签 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--purple-bg); color: var(--purple-dark);
}
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-red { background: var(--red-bg); color: var(--red); }
.chip-gray { background: #F0EFF4; color: var(--muted); }
.chip-blue { background: #EAF0FB; color: #3F5BD9; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-pill {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.filter-pill.active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.label .req { color: var(--red); }
.input, .textarea, .select {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; outline: none;
  transition: border-color .16s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(112, 48, 176, .1); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 155px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; padding: 0 18px 18px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px;
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid #F4F1F9; vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--purple-bg-soft); }

/* ---------- 统计卡片 ---------- */
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 16px 18px;
  border: 1px solid rgba(236, 231, 245, .8); box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 27px; font-weight: 700; color: var(--purple-dark); line-height: 1.3; }
.stat-foot { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: #EDE9F5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--purple) 0%, var(--purple-bright) 100%); border-radius: 999px; transition: width .4s ease; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-text { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---------- 课时列表 ---------- */
.lesson-item {
  display: flex; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
  background: #fff;
}
.lesson-item.done { background: var(--purple-bg-soft); border-color: #DCCEF2; }
.lesson-check {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px;
  border: 2px solid #D5CEDF; cursor: pointer; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff;
}
.lesson-item.done .lesson-check { background: var(--purple); border-color: var(--purple); }
.lesson-title { font-weight: 600; font-size: 14.5px; }
.lesson-desc { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.lesson-meta { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; }

/* ---------- 图片上传 ---------- */
.upload-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.upload-tile {
  width: 92px; height: 92px; border-radius: 12px; position: relative;
  border: 1px solid var(--line); overflow: hidden; background: #FAF9FD;
}
.upload-tile img { width: 100%; height: 100%; object-fit: cover; }
.upload-tile .del {
  position: absolute; right: 3px; top: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.upload-add {
  width: 92px; height: 92px; border-radius: 12px; border: 1.5px dashed #CFC7E0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; cursor: pointer; background: #FAF9FD; gap: 2px;
}
.upload-add .plus { font-size: 22px; line-height: 1; }

.file-list { margin-top: 10px; }
.file-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 8px 12px; background: var(--purple-bg-soft); border-radius: 9px; margin-bottom: 6px;
}
.file-item .fsize { color: var(--muted); font-size: 12px; }

/* ---------- 证书 ---------- */
.cert-card {
  border-radius: var(--radius-lg); overflow: hidden; background: #fff;
  box-shadow: var(--shadow); border: 1px solid rgba(236, 231, 245, .8);
}
.cert-preview { background: var(--purple-bg-soft); padding: 12px; }
.cert-preview canvas, .cert-preview img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.cert-body { padding: 14px 16px; }
.cert-no { font-family: Consolas, Monaco, monospace; font-size: 13px; color: var(--purple-dark); font-weight: 600; }
.cert-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.login-logo {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff; object-fit: cover; padding: 3px;
  box-shadow: 0 4px 16px rgba(40, 8, 60, .25);
}
.verify-logo {
  width: 72px; height: 72px; border-radius: 50%;
  background: #fff; object-fit: cover; padding: 4px;
  box-shadow: var(--shadow-lg);
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .e-ico { font-size: 42px; opacity: .5; }
.empty .e-text { margin-top: 8px; font-size: 14px; }

/* ---------- Toast / Modal ---------- */
.toast-wrap { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 999; }
.toast {
  background: rgba(45, 20, 60, .93); color: #fff; padding: 10px 20px;
  border-radius: 10px; font-size: 14px; margin-bottom: 8px;
  box-shadow: var(--shadow-lg); animation: slideDown .22s ease;
}
.toast.error { background: rgba(190, 45, 50, .94); }
.toast.success { background: rgba(35, 130, 88, .94); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(35, 20, 50, .45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%;
  max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 820px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16.5px; font-weight: 700; color: var(--purple-dark); }
.modal-close { cursor: pointer; font-size: 20px; color: var(--muted); background: none; border: none; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- 图表（纯 CSS/SVG） ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--purple-bright) 0%, var(--purple) 100%);
  min-height: 3px; transition: height .4s ease;
}
.bar-val { font-size: 12px; font-weight: 600; color: var(--purple-dark); }
.bar-label {
  font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.line-chart { width: 100%; height: 170px; }

/* ---------- 详情页 ---------- */
.detail-hero {
  border-radius: var(--radius-lg); padding: 22px 24px; color: #fff;
  display: flex; align-items: flex-end; gap: 18px; margin-bottom: 18px;
}
.detail-hero .dh-emoji { font-size: 46px; }
.detail-hero h2 { margin: 0 0 4px; font-size: 21px; }
.detail-hero .dh-meta { font-size: 13px; opacity: .9; display: flex; gap: 16px; flex-wrap: wrap; }

.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13.5px; color: var(--purple); cursor: pointer; margin-bottom: 12px;
}

.rich-text p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.85; }

.req-list { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13.5px; }
.req-list li { margin-bottom: 4px; }

.info-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.info-item { background: var(--purple-bg-soft); border-radius: 11px; padding: 10px 14px; }
.info-item .k { font-size: 12px; color: var(--muted); }
.info-item .v { font-size: 14.5px; font-weight: 600; color: var(--ink); margin-top: 2px; }

.timeline { border-left: 2px solid #E4DCF2; padding-left: 16px; margin-left: 6px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -23px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--purple);
  box-shadow: 0 0 0 3px #fff;
}
.timeline-item .t-time { font-size: 12px; color: var(--muted); }
.timeline-item .t-title { font-size: 14px; font-weight: 600; }
.timeline-item .t-desc { font-size: 13px; color: var(--ink-2); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--purple-dark) 0%, var(--purple) 45%, var(--purple-bright) 100%);
  padding: 24px; position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); top: -140px; right: -120px;
}
.login-page::after {
  content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255, 255, 255, .05); bottom: -120px; left: -80px;
}
.login-box {
  width: 100%; max-width: 900px; background: #fff; border-radius: 22px;
  box-shadow: 0 24px 70px rgba(50, 12, 72, .3); display: flex; overflow: hidden;
  position: relative; z-index: 2; min-height: 480px;
}
.login-left {
  flex: 1; padding: 38px 34px; color: #fff;
  background: linear-gradient(150deg, var(--purple-dark) 0%, var(--purple) 60%, var(--purple-bright) 100%);
  display: flex; flex-direction: column; justify-content: center;
}
.login-left h1 { font-size: 26px; margin: 0 0 10px; }
.login-left .lead { font-size: 14px; opacity: .9; line-height: 1.8; }
.login-features { margin-top: 22px; }
.login-feature { display: flex; gap: 10px; margin-bottom: 12px; font-size: 13.5px; align-items: flex-start; }
.login-feature .f-ico { font-size: 16px; }
.login-right { flex: 1; padding: 38px 34px; display: flex; flex-direction: column; justify-content: center; }
.login-right h2 { font-size: 20px; margin: 0 0 6px; color: var(--purple-dark); }
.login-right .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.demo-accounts {
  margin-top: 18px; background: var(--purple-bg-soft); border-radius: 12px;
  padding: 12px 14px; font-size: 12.5px; color: var(--ink-2);
}
.demo-accounts b { color: var(--purple-dark); }
.demo-accounts .row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.demo-accounts code {
  background: #fff; padding: 1px 7px; border-radius: 6px;
  font-family: Consolas, Monaco, monospace; color: var(--purple);
  border: 1px solid var(--line);
}
.login-foot {
  text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted);
}

/* ---------- 核验页 ---------- */
.verify-page {
  min-height: 100vh; background: linear-gradient(160deg, var(--purple-bg) 0%, #F6F5FA 60%);
  padding: 30px 20px 60px;
}
.verify-box { max-width: 660px; margin: 0 auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-box { flex-direction: column; max-width: 460px; }
  .login-left { padding: 28px 26px; }
  .login-right { padding: 28px 26px; }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .sidebar { display: none; }
  .content { padding: 16px 14px 84px; }
  .tabbar { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-title { font-size: 19px; }
  .topbar { padding: 0 14px; }
  .brand-sub { display: none; }
  .detail-hero { padding: 18px; flex-direction: column; align-items: flex-start; }
  .modal-mask { padding: 12px; }
  .stat-value { font-size: 23px; }
}
