/* ===== 企业培训平台 全局样式 ===== */
:root {
  /* 浅绿主色调 */
  --primary: #2fa873;
  --primary-dark: #218a5c;
  --primary-light: #6fce9f;
  --success: #17a34a;
  --warning: #d99706;
  --danger: #dc4848;
  --muted: #5f7a6b;
  --bg: #f1f7f2;
  --card: #ffffff;
  --border: #dbe9df;
  --text: #1e2b24;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(22, 56, 38, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px;
  /* 绿色渐变左栏：顶部亮草绿 → 底部深海绿，叠加柔光与斜向细线，形成「线条感」底纹 */
  background:
    radial-gradient(115% 55% at 18% 0%, rgba(255,255,255,.22), rgba(255,255,255,0) 62%),
    linear-gradient(165deg, #4ecf8d 0%, #2fa873 38%, #1d8a5b 68%, #14624a 100%);
  color: rgba(255,255,255,.92);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex: none;
  overflow: hidden;
}
/* 斜向细线条底纹（卡通线条感） */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.07) 0 1px, rgba(255,255,255,0) 1px 13px);
}
.brand {
  margin-top: 46px;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.18);
  border-top: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 2px 8px rgba(9,52,33,.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #17805a; flex: none;
}
.brand .brand-text {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.35; overflow: hidden;
}
.brand .brand-name, .brand .brand-sub { font-size: 13px; font-weight: 400; color: #fff; }
.side-nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,.9);
  border-left: 3px solid transparent;
}
.side-nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.22); border-left-color: #fff; color: #fff; font-weight: 600; }
.side-nav .ico { width: 18px; text-align: center; }
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.18); font-size: 12px; color: rgba(255,255,255,.76); text-align: center; }

/* ---------- 侧栏激励插画：天天学习，好好向上（纯线条卡通） ---------- */
.side-motiv { padding: 6px 12px 8px; text-align: center; user-select: none; }
.side-motiv svg { width: 100%; height: auto; display: block; overflow: visible; }
.side-motiv svg .ln { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.side-motiv svg .ln-thin { stroke-width: 1.4; opacity: .58; }
.side-motiv svg .dash { stroke-dasharray: 4 5; }
.side-motiv .motiv-text {
  margin-top: 2px;
  font-family: "Hanzipen SC", "Yuanti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; font-weight: 700; line-height: 1.4; letter-spacing: 2px;
  color: #fff; text-shadow: 0 1px 2px rgba(10,52,34,.22);
}
.side-motiv .motiv-text span { display: block; }
.side-motiv .motiv-text span:last-child { transform: rotate(-1.6deg); }
.side-motiv .motiv-art { animation: motivFloat 5.5s ease-in-out infinite; transform-origin: 88px 96px; }
.side-motiv .plane { animation: motivPlane 6.5s ease-in-out infinite; transform-origin: 130px 40px; }
@keyframes motivFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes motivPlane { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(4px, -4px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) {
  .side-motiv .motiv-art, .side-motiv .plane { animation: none; }
}
.side-logout {
  display: block; width: 100%; padding: 9px 0; border: none; border-radius: 8px;
  background: #fff; color: #1f4d33; font-size: 13px; font-weight: 500; text-align: center; cursor: pointer;
  letter-spacing: 5px; text-indent: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.14); transition: transform .12s, box-shadow .12s;
}
.side-logout:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.24); }
.side-logout:active { transform: translateY(0); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .me { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7bd4a5);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}
.content { padding: 20px 24px 48px; }

.page-title { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ---------- 卡片 / 表格 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 12px 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e9f1ea; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #f4faf5; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f3faf5; }
.tbl-wrap { overflow-x: auto; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .label { color: var(--muted); font-size: 13px; }

/* ---------- 按钮 / 输入 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

input, select, textarea {
  font-family: inherit; font-size: 13px;
  border: 1px solid #c2d9ca; border-radius: 8px;
  padding: 7px 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,168,115,.14); }
textarea { resize: vertical; min-height: 64px; }
.input-sm { padding: 5px 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.field input[type="radio"], .field input[type="checkbox"] { width: auto; flex: none; }
.opt-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #e4e9ef; border-radius: 8px; margin-bottom: 8px; background: #fafbfc; }
.opt-row:hover { border-color: var(--primary, #3e8e6d); background: #f2f8f4; }
.opt-row .opt-letter { flex: none; width: 22px; font-size: 13px; font-weight: 700; color: var(--primary-dark, #1e5c3f); text-align: center; }
.opt-row input[type="radio"] { flex: none; margin: 0; }
.opt-row.is-answer { border-color: var(--primary, #3e8e6d); background: #eef7f1; }
.opt-row.is-answer .opt-letter::after { content: " ✓"; color: var(--primary, #3e8e6d); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 徽标 / 进度条 ---------- */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; line-height: 1.7;
}
.badge-green { background: #dff5e6; color: #0b7a3b; }
.badge-red { background: #fdeeee; color: #c0392b; }
.badge-gray { background: #eef3ef; color: #64806f; }
.badge-blue { background: #e0f3ec; color: #0a7260; }
.badge-orange { background: #fdf3e1; color: #b07814; }
.badge-purple { background: #e9f5e9; color: #348a3f; }
.badge-archived { background: #f2f5f3; color: #93a89c; }

.progress-track { background: #e3efe6; border-radius: 20px; height: 8px; overflow: hidden; min-width: 90px; }
.progress-fill { background: linear-gradient(90deg, var(--primary), #74d2a2); height: 100%; border-radius: 20px; transition: width .3s; }
.progress-fill.done { background: linear-gradient(90deg, #17a34a, #3ec97a); }
.pbar { display: flex; align-items: center; gap: 8px; }
.pbar .ptxt { font-size: 12px; color: var(--muted); min-width: 42px; text-align: right; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(9, 32, 21, .42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 640px; max-width: 100%;
  box-shadow: 0 18px 50px rgba(9, 28, 18, .22);
}
.modal.lg { width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; max-height: 68vh; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close-x { cursor: pointer; border: 0; background: none; font-size: 18px; color: var(--muted); }
.multi-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.multi-pick .pick-group { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 2px 0; }
.multi-pick .pick-dep { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.multi-pick .pick-dep-head { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 2px 0; border: none !important; background: none !important; cursor: pointer; }
.multi-pick .pick-dep-head input { flex: none; width: auto; }
.multi-pick .pick-dep-head span { white-space: nowrap; }
.multi-pick label { border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; cursor: pointer; display: flex; gap: 5px; align-items: center; font-size: 12px; background: #fff; min-width: 0; white-space: nowrap; }
.multi-pick label span { overflow: hidden; text-overflow: ellipsis; }
.multi-pick label input { flex: none; width: auto; }
.multi-pick label:has(input:checked) { border-color: var(--primary); background: #e9f6ee; color: var(--primary-dark); }

.ver-badge {
  font-size: 12px;
  color: var(--muted);
  background: #f2f6f3;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- Toast ---------- */
/* 图片课件编辑：缩略图管理网格 */
.img-mgr { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 260px; overflow: auto; border: 1px dashed var(--border); border-radius: 8px; padding: 8px; }
.img-mgr .img-cell { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.img-mgr img { width: 100%; height: 64px; object-fit: cover; display: block; }
.img-mgr .img-cell-foot { display: flex; align-items: center; gap: 4px; padding: 4px 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.img-mgr .img-cell-foot .btn { padding: 2px 6px; font-size: 11px; }
/* ---------- 更换整个素材文件（高亮卡片） ---------- */
.swap-box {
  border: 1.5px dashed var(--primary);
  background: linear-gradient(180deg, rgba(47,168,115,.12), rgba(47,168,115,.04));
  border-radius: var(--radius);
  padding: 12px 14px;
}
.swap-box-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.swap-box-head .swap-ico { font-size: 17px; line-height: 1; }
.swap-box-head .swap-title { font-weight: 700; font-size: 14px; color: var(--primary-dark); }
.swap-box-head .swap-tip { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.swap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swap-row .swap-hint { font-size: 12px; color: var(--muted); }

#toasts { position: fixed; right: 18px; top: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #161e2e; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 360px;
  animation: slideIn .18s ease;
}
.toast.ok { background: #0f7a3d; }
.toast.err { background: #b91c1c; }
@keyframes slideIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 空态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 26px 0; }

/* ---------- 门户 ---------- */
.portal-head {
  background: linear-gradient(120deg, #143622, #2fa873);
  color: #fff; padding: 26px 30px; border-radius: 0 0 18px 18px;
}
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.task-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.task-card .t-title { font-size: 15px; font-weight: 700; }
.task-card .t-sub { color: var(--muted); font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.task-card .t-desc { color: #4b5563; font-size: 13px; min-height: 20px; }
.task-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.sec-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }

/* ---------- 新任务提醒（站内角标） ---------- */
.bell-btn {
  position: relative; width: 42px; height: 38px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #fff;
  font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.bell-btn:hover { background: rgba(255, 255, 255, .16); }
.bell-btn.has-new { border-color: #ffd08a; }
.bell-badge {
  position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 19px; text-align: center; box-shadow: 0 0 0 2px rgba(20, 54, 34, .85);
}
.bell-btn.has-new .bell-ico { display: inline-block; animation: bellShake 1.8s ease-in-out infinite; }
@keyframes bellShake {
  0%, 62%, 100% { transform: none; }
  70% { transform: rotate(14deg); }
  80% { transform: rotate(-12deg); }
  90% { transform: rotate(8deg); }
}
.new-flag {
  display: inline-block; background: #e5484d; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 6px; padding: 1px 5px; margin-right: 6px; vertical-align: middle; letter-spacing: .5px;
}
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff;
}
.notif-item .notif-title { font-weight: 700; font-size: 14px; }
.notif-item .notif-sub { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- 表单内提醒开关 ---------- */
.notify-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.notify-pick input[type=checkbox] { width: auto; flex: none; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.6; }

/* ---------- 学习页 ---------- */
.learn-wrap { max-width: 1060px; margin: 0 auto; padding: 18px 18px 60px; }
.learn-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; }
.lock-tip { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); font-size: 12px; }
.video-frame { background: #000; border-radius: 14px; overflow: hidden; position: relative; }
.video-frame video { width: 100%; display: block; background: #000; max-height: 70vh; }
.video-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  padding: 26px 14px 10px; color: #fff; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
}
.ctrl-btn { background: none; border: 0; color: #fff; font-size: 16px; cursor: pointer; padding: 4px; line-height: 1; }
.ctrl-time { font-variant-numeric: tabular-nums; }
.ctrl-msg { font-size: 12px; color: #ffd08a; }
.pdf-canvas-box { background: #cfded4; border-radius: 6px; padding: 18px; display: flex; justify-content: center; }
.pdf-canvas-box canvas { max-width: 100%; height: auto; box-shadow: 0 8px 30px rgba(14, 46, 28, .35); background: #fff; }
.done-banner {
  background: linear-gradient(90deg, #e6f8ec, #cff0db);
  border: 1px solid #a2dfba; color: #0f6b36; border-radius: 10px;
  padding: 10px 16px; font-weight: 600; margin-bottom: 12px;
}
.center-col { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 0; color: var(--muted); }

@media (max-width: 860px) {
  .sidebar { width: 60px; }
  .brand { margin-top: 8px; }
  .brand span.txt, .side-nav a span.txt { display: none; }
  .side-foot { display: block; padding: 8px; }
  .side-logout { padding: 7px 2px; font-size: 12px; border-radius: 8px; }
  .side-nav a { justify-content: center; }
  .side-motiv { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
/* 窗口较矮时（笔记本小屏）隐藏激励插画，保证导航与退出按钮完整可见 */
@media (max-height: 700px) {
  .side-motiv { display: none; }
}
