/* ===== 课程视频网站 · 共用样式 ===== */
:root {
  --bg: #eef2f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e3e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8efff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.btn.ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.link {
  background: none;
  color: var(--brand);
  padding: 4px 6px;
  font-weight: 500;
}
.btn.link:hover { background: var(--brand-soft); }

input[type="text"], input[type="password"], input[type="date"], input[type="search"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .8);
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .3px;
}
.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, #60a5fa, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  box-shadow: 0 3px 10px -3px rgba(37, 99, 235, .6);
}
.spacer { flex: 1; }
.who {
  font-size: 13px;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 容器 ---------- */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 18px 80px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, #dbeafe 0%, transparent 60%),
    radial-gradient(700px 400px at 110% 110%, #e0e7ff 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 28px 26px;
}
.login-card h1 {
  font-size: 22px;
  margin: 0 0 4px;
  text-align: center;
}
.login-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}
.login-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(140deg, #60a5fa, #2563eb);
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: 0 10px 24px -10px rgba(37, 99, 235, .8);
}
.login-card .btn { width: 100%; padding: 11px; margin-top: 6px; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert.error { background: var(--danger-soft); color: #991b1b; }
.alert.ok { background: var(--ok-soft); color: #065f46; }
.alert.info { background: var(--brand-soft); color: #1e40af; }

/* ---------- 课程列表 ---------- */
.lesson {
  margin-bottom: 16px;
  overflow: hidden;
}
.lesson-head {
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff, #f7fafd);
}
.date-badge {
  flex: none;
  width: 62px;
  text-align: center;
  background: var(--brand-soft);
  border-radius: 11px;
  padding: 7px 4px;
  color: var(--brand-dark);
}
.date-badge .d { font-size: 20px; font-weight: 800; line-height: 1.1; }
.date-badge .m { font-size: 11px; font-weight: 600; opacity: .75; }
.lesson-title { flex: 1; min-width: 0; }
.lesson-title h3 { margin: 0; font-size: 16px; font-weight: 700; }
.lesson-title .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}
.chip.new { background: var(--ok-soft); color: #065f46; }

.lesson-body { padding: 8px 10px 12px; }

.comment {
  margin: 6px 10px 12px;
  padding: 11px 14px;
  background: var(--warn-soft);
  border-left: 3px solid #f59e0b;
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
  color: #78350f;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment::before {
  content: "老师评语";
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 3px;
  letter-spacing: .5px;
}

.video-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .14s;
}
.video-row:hover { background: #f5f8ff; }
.video-row + .video-row { border-top: 1px solid #f1f5f9; }
.play-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  padding-left: 2px;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .7);
  transition: transform .15s;
}
.video-row:hover .play-icon { transform: scale(1.08); }
.video-info { flex: 1; min-width: 0; }
.video-info .t {
  font-weight: 600;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-info .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.progress-bar {
  height: 4px;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 999px;
}
.done-tag { color: var(--ok); font-size: 12px; font-weight: 700; flex: none; }

.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted);
}
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .55; }

/* ---------- 播放器 ---------- */
.player-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.player-box {
  width: min(1000px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}
.player-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #e2e8f0;
  background: #111c33;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.player-top .name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-top .x {
  background: rgba(255, 255, 255, .1);
  border: 0;
  color: #cbd5e1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.player-top .x:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.player-box video {
  width: 100%;
  max-height: 68vh;
  background: #000;
  display: block;
}
.player-comment {
  padding: 12px 16px;
  background: #fff;
  font-size: 13.5px;
  color: #78350f;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  white-space: pre-wrap;
  max-height: 26vh;
  overflow: auto;
}
.resume-tip {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: rgba(37, 99, 235, .95);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  z-index: 2;
}

/* ---------- 后台 ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.panel { padding: 16px 18px; margin-bottom: 16px; }
.panel h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2 .count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.user-list { list-style: none; margin: 0; padding: 0; }
.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .13s;
}
.user-item:hover { background: #f5f8ff; }
.user-item.active { background: var(--brand-soft); }
.user-item.active .nm { color: var(--brand-dark); }
.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(140deg, #93c5fd, #3b82f6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.avatar.admin { background: linear-gradient(140deg, #fbbf24, #f59e0b); }
.user-meta { flex: 1; min-width: 0; }
.user-meta .nm {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta .un { font-size: 12px; color: var(--muted); }
.user-item .off { font-size: 11px; color: var(--danger); font-weight: 700; }

/* 在线状态点 */
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  margin-right: 6px;
  vertical-align: 1px;
  flex: none;
}
.online-dot.on {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
  animation: dotPulse 2.2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .5; }
}

.lesson-admin {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.lesson-admin .lh {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.lesson-admin .lh .dt { font-weight: 700; font-size: 14px; }
.lesson-admin .lh .ttl { color: var(--muted); font-size: 13px; }
.lesson-admin .lb { padding: 12px 14px; }
.lesson-admin textarea { min-height: 68px; font-size: 13.5px; }

.vrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 13.5px;
}
.vrow:nth-child(odd) { background: #fafcff; }
.vrow .vn {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vrow .vs { color: var(--muted); font-size: 12px; flex: none; }
.vrow .vw { flex: none; font-size: 12px; color: var(--ok); }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
}
.section-head h2 { margin: 0; font-size: 16px; }

/* ---------- 文件选择器 ---------- */
.fs-modal { z-index: 70; }
.fs-box {
  width: min(780px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}
.fs-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.fs-head h3 { margin: 0; font-size: 15px; }
.fs-path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.fs-path .p {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}
.fs-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
  min-height: 220px;
}
.fs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
}
.fs-item:hover { background: #f1f5f9; }
.fs-item.dir { font-weight: 600; }
.fs-item.picked { background: var(--brand-soft); }
.fs-item.picked .nm { color: var(--brand-dark); font-weight: 600; }
.fs-item .ico { flex: none; width: 20px; text-align: center; font-size: 15px; }
.fs-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-item .sz { flex: none; color: var(--muted); font-size: 12px; }
.fs-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
}
.fs-foot .picked { flex: 1; font-size: 13px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- toast ---------- */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #1f2937;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .5);
  animation: pop .2s ease;
  max-width: 90vw;
}
.toast.ok { background: #047857; }
.toast.err { background: #b91c1c; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ---------- 小屏 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 16px 12px 70px; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .who { display: none; }
  .lesson-head { padding: 13px 14px; gap: 11px; }
  .date-badge { width: 54px; }
  .date-badge .d { font-size: 18px; }
  .player-mask { padding: 0; align-items: stretch; }
  .player-box { border-radius: 0; max-height: 100vh; }
  .player-box video { max-height: 42vh; }
  .admin-grid { gap: 12px; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
