/* =========================================================
   托育人才能力提升培训平台 - 全局样式
   浅色主题 · 无第三方依赖
   ========================================================= */
:root {
  --primary:      #2a6fb0;
  --primary-dark: #1e558c;
  --primary-soft: #e8f2fb;
  --accent:       #1f9d8f;
  --accent-soft:  #e5f7f4;
  --danger:       #d9534f;
  --danger-soft:  #fdecec;
  --warn:         #d99a2b;
  --warn-soft:    #fff6e5;
  --success:      #2e9e6b;
  --success-soft: #e7f7ef;

  --text:      #1f2d3d;
  --text-2:    #55637a;
  --text-3:    #8a97a8;
  --border:    #e3eaf3;
  --border-2:  #d3dfeb;
  --bg:        #f4f7fb;
  --surface:   #ffffff;
  --surface-2: #fafcfe;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 6px 20px rgba(31, 45, 61, .07);
  --shadow-lg: 0 14px 40px rgba(31, 45, 61, .13);
  --sidebar-w: 216px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-family: inherit; cursor: pointer; transition: .18s;
  background: var(--primary); color: #fff; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #188a7e; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c1443f; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; color: var(--primary); cursor: pointer;
  padding: 2px 4px; font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text); background: #fff; transition: .18s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 111, 176, .12);
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%238a97a8' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
label.field > span .req { color: var(--danger); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-body { padding: 20px; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.tag.gray  { background: #eef2f7; color: var(--text-3); }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.red   { background: var(--danger-soft);  color: var(--danger); }
.tag.orange{ background: var(--warn-soft);    color: var(--warn); }
.tag.teal  { background: var(--accent-soft);  color: var(--accent); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; padding: 11px 14px; background: var(--surface-2); color: var(--text-2);
  font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }

.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty svg { opacity: .5; margin-bottom: 12px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 16px 20px; font-size: 13px; color: var(--text-2); }
.pager button {
  min-width: 32px; height: 32px; border: 1px solid var(--border-2); background: #fff;
  border-radius: 6px; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.progress { height: 6px; background: #eceff4; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; transition: width .3s; }

/* ---------------- 布局：管理后台 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #183048; color: #c8d6e5;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand b { display: block; color: #fff; font-size: 15px; letter-spacing: .5px; }
.sidebar .brand small { color: #7d95ad; font-size: 11px; }
.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: #c8d6e5; font-size: 14px; margin-bottom: 3px; transition: .16s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: linear-gradient(135deg, var(--primary), #2e86d0); color: #fff; box-shadow: 0 5px 14px rgba(42,111,176,.35); }
.sidebar nav a svg { flex: 0 0 18px; }
.sidebar .side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7d95ad; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.content { padding: 22px 24px 40px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .desc { color: var(--text-3); font-size: 13px; margin-top: 2px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 180px; }

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

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .label { font-size: 13px; color: var(--text-3); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat .value small { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat .ico {
  position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary);
}
.stat.teal .ico  { background: var(--accent-soft);  color: var(--accent); }
.stat.orange .ico{ background: var(--warn-soft);    color: var(--warn); }
.stat.green .ico { background: var(--success-soft); color: var(--success); }

/* ---------------- 布局：学员端 ---------------- */
.stu-header {
  background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.stu-header .inner {
  max-width: 1140px; margin: 0 auto; height: 62px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; gap: 20px;
}
.stu-header .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.stu-header .logo .mark {
  width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.stu-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.stu-nav a { padding: 8px 15px; border-radius: 8px; color: var(--text-2); font-size: 14px; }
.stu-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.stu-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.stu-main { max-width: 1140px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #eaf2fb 0%, #e4f5f1 55%, #f3f8fd 100%);
}
.login-box {
  width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 38px 36px 32px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.login-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.login-box .brand-mark {
  width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; font-weight: 700;
}
.login-box h2 { text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row img { height: 40px; width: 110px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); cursor: pointer; flex: 0 0 110px; object-fit: cover; background: #f5f8fc; }
.login-tip { margin-top: 20px; padding: 12px 14px; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-3); line-height: 1.9; }
.login-tip code { background: #eef4fb; color: var(--primary); padding: 1px 6px; border-radius: 4px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-3); }

/* ---------------- 视频卡片 ---------------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; }
.vcard {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: .2s; display: flex; flex-direction: column;
}
.vcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-2); }
.vcard .cover { position: relative; aspect-ratio: 16 / 9; background: #dfe8f2; overflow: hidden; }
.vcard .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .cover .play-ico {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: .2s; background: rgba(15, 35, 55, .28);
}
.vcard:hover .cover .play-ico { opacity: 1; }
.vcard .cover .play-ico span {
  width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.vcard .cover .dur {
  position: absolute; right: 8px; bottom: 8px; background: rgba(15,25,38,.72); color: #fff;
  font-size: 12px; padding: 1px 7px; border-radius: 4px;
}
.vcard .cover .done-badge {
  position: absolute; left: 8px; top: 8px; background: var(--success); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
}
.vcard .body { padding: 13px 14px 15px; flex: 1; display: flex; flex-direction: column; }
.vcard .body h4 {
  font-size: 14.5px; line-height: 1.45; margin-bottom: 8px; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px;
}
.vcard .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: auto; }
.vcard .meta .sep { color: var(--border-2); }
.vcard .pbar { margin-top: 10px; }
.vcard .pbar .txt { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 5px; }

/* ---------------- 分类 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); transition: .18s; cursor: pointer;
}
.cat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cat-card .name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.cat-card .subs { font-size: 12.5px; color: var(--text-3); line-height: 1.9; }
.cat-card .cnt { margin-top: 8px; font-size: 12px; color: var(--primary); }

/* ---------------- 播放页 ---------------- */
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .play-layout { grid-template-columns: 1fr; } }
.player-shell {
  position: relative; background: #0d1520; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9;
}
.player-shell video { width: 100%; height: 100%; display: block; background: #0d1520; }
#wmCanvas {
  /* 尺寸交给 canvas 位图（draw 中按容器尺寸 × dpr 设置），
     避免 CSS 100% 拉伸导致全屏/放大后水印变形或被裁剪 */
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5;
}
/* 隐藏原生控制栏全屏按钮（video 单独全屏会让水印层脱离全屏画面），
   由播放器容器级自定义按钮替代，保证水印始终可见 */
.player-shell video::-webkit-media-controls-fullscreen-button { display: none !important; }
.player-shell video::-webkit-media-controls-enclosure { overflow: hidden; }
.vt-fs-btn {
  position: absolute; right: 12px; bottom: 46px; z-index: 6;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(13, 21, 32, 0.55); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, opacity .2s; opacity: .85;
}
.vt-fs-btn:hover { background: rgba(13, 21, 32, 0.8); opacity: 1; }
.player-shell:fullscreen .vt-fs-btn { right: 18px; bottom: 56px; }
.player-lock {
  position: absolute; inset: 0; z-index: 8; background: rgba(13,21,32,.94); color: #fff;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px;
}
.player-lock.show { display: flex; }
.player-lock .big { font-size: 40px; }
.player-lock p { margin: 0; color: #c8d6e5; font-size: 14px; }
.play-info { margin-top: 16px; }
.play-info h1 { font-size: 19px; margin-bottom: 8px; }
.play-metrics { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.play-metrics b { color: var(--text); font-size: 15px; }
.side-list .item { display: flex; gap: 11px; padding: 11px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.side-list .item:last-child { border-bottom: 0; }
.side-list .item:hover { background: var(--surface-2); }
.side-list .item.cur { background: var(--primary-soft); }
.side-list .item img { width: 84px; height: 48px; border-radius: 6px; object-fit: cover; flex: 0 0 84px; background: #dfe8f2; }
.side-list .item .t { font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-list .item .m { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 32, 48, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: .2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateY(10px); transition: .2s;
}
.modal-mask.show .modal { transform: none; }
.modal.wide { max-width: 800px; }
.modal-head { padding: 17px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; }
.modal-head .x { background: none; border: 0; font-size: 22px; color: var(--text-3); cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

#toastWrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: rgba(25, 38, 55, .94); color: #fff; padding: 10px 20px; border-radius: 9px;
  font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .24s ease; max-width: 90vw;
}
.toast.ok   { background: #1f7d55; }
.toast.err  { background: #b93b37; }
.toast.warn { background: #b3801f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------------- 工具类 ---------------- */
.mb0 { margin-bottom: 0 } .mb8 { margin-bottom: 8px } .mb12 { margin-bottom: 12px }
.mb16 { margin-bottom: 16px } .mb20 { margin-bottom: 20px } .mt12 { margin-top: 12px }
.mt16 { margin-top: 16px } .mt20 { margin-top: 20px }
.flex { display: flex } .fcol { flex-direction: column }
.between { justify-content: space-between } .center { align-items: center }
.g6 { gap: 6px } .g10 { gap: 10px } .g16 { gap: 16px }
.tc { text-align: center } .tr { text-align: right }
.muted { color: var(--text-3) } .small { font-size: 12.5px }
.bold { font-weight: 700 }
.nowrap { white-space: nowrap }
.hidden { display: none !important }
.scroll-y { overflow-y: auto }
.w100 { width: 100% }
.mono { font-family: Consolas, Monaco, monospace }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -100%; z-index: 60; transition: .2s; }
  .sidebar.open { left: 0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .stu-nav { display: none; }
  .content { padding: 16px 14px 40px; }
}
