/* ===========================================
   管理后台样式（复用 style.css 的 CSS 变量）
   =========================================== */

/* 关键修复：确保 HTML 的 hidden 属性始终生效。
   否则 .admin-login{display:flex} / .modal{display:flex} 会覆盖 [hidden]，
   导致登录框/注册框/弹窗永远可见、× 关不掉、视图切换失效。 */
[hidden] { display: none !important; }

.admin-body { background: var(--bg-alt); min-height: 100vh; }

.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line);
}
.admin-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--brand-700); }
.admin-logo { height: 36px; width: auto; border-radius: 8px; }
.ver { font-size: 12px; color: var(--ink-3); font-weight: 600; }

/* 登录 */
.admin-login { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.login-card {
  width: 360px; max-width: 90vw; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; box-shadow: 0 10px 30px rgba(27,94,32,.08);
}
.login-card h2 { margin: 0 0 6px; color: var(--brand-700); }
.login-tip { color: var(--ink-3); font-size: 13px; margin: 0 0 18px; }
.login-err { color: #c0392b; font-size: 13px; margin: 10px 0 0; }
/* 登录/注册单输入框与上方提示间的距离，避免过近 */
.login-card > .in { margin-top: 6px; }

/* 仪表盘 */
.admin-main { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; }
.admin-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.dash-hint { color: var(--ink-3); font-size: 13px; }
/* 返回首页等工具栏幽灵按钮：原 .btn-ghost 为白字白边（给深色 hero 用），
   在浅色后台会隐形；此处改为品牌色描边+文字，确保可见且与主按钮区分 */
.admin-toolbar .btn-ghost {
  background: var(--brand-100); color: var(--brand-900);
  border: 1.5px solid var(--brand-700); font-weight: 700;
  box-shadow: 0 1px 4px rgba(27,94,32,.12);
}
.admin-toolbar .btn-ghost:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.admin-toolbar .btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* 课程行操作按钮（编辑/章节管理）原 .btn-ghost 为白字白边(给深色 hero)，在白卡片上隐形；
   改为浅绿底+深绿字+深绿描边，清晰可见且与主操作层级分明 */
.admin-course-list .btn-ghost {
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-700); font-weight: 600;
}
.admin-course-list .btn-ghost:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

.admin-course-list { display: grid; gap: 16px; }
.course-row {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(27,94,32,.05);
}
.course-row-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.course-row-title { font-weight: 700; font-size: 17px; color: var(--ink); }
.course-row-meta { color: var(--ink-3); font-size: 13px; }
.tag-on  { background: #e8f5e9; color: var(--brand-700); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.tag-off { background: #f0f0f0; color: var(--ink-3); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.tag-paid{ background: #fff3e0; color: #b26a00; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.tag-paid-partial{ background: #F3E5F5; color: #6A1B9A; border-radius: 999px; padding: 2px 10px; font-size: 12px; }   /* 三态付费：部分付费（2026-09-07）*/
.tag-soon{ background: #fff8e1; color: #8a6d1a; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.course-row-actions { margin-left: auto; display: flex; gap: 8px; }

.chapter-panel { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.lesson-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.lesson-item .lt { font-weight: 600; color: var(--ink); }
.lesson-item .lf { font-size: 12px; color: var(--brand-600); }
.lesson-item .lv { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.lesson-item .la { display: flex; gap: 6px; }
/* 上传分步状态（持久可见，失败信息不自动消失，便于截图反馈） */
.upstat { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--ink-3); word-break: break-all; }
.upstat.bad { color: #c0392b; font-weight: 600; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand-600); transition: width .2s; }

/* 表单 */
.in {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: #fff;
}
.in:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(27,94,32,.12); }
/* 下拉框与文本框视觉统一：重置原生外观、固定等高(与文本框一致)、右侧箭头，整行上下协调 */
select.in {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  height: 44px; line-height: 1.2; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a8a7f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
/* 封面图上传行与预览 */
.cover-upload-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cover-upload-hint { font-size: 12px; color: var(--ink-3); }
.cover-preview { margin-top: 10px; }
.cover-preview img { max-width: 160px; max-height: 110px; border-radius: 10px; border: 1px solid var(--line); display: block; }
/* 上传封面图按钮：原 .btn-ghost 为白字白边(给深色 hero)，在浅色弹窗内隐形；
   改为浅绿底+深绿字+深绿描边，与课程列表按钮风格一致，清晰可见 */
.cover-upload-row .btn-ghost { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-700); font-weight: 600; }
.cover-upload-row .btn-ghost:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
/* 登录/注册按钮：占满卡片宽度，且与上方输入框保持协调间距 */
.btn-block { display: flex; width: 100%; margin-top: 18px; }
label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 20px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,30,20,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { width: 520px; max-width: 96vw; max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal-lg { width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; color: var(--brand-700); }
.modal-x { border: none; background: none; font-size: 26px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

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

/* 原生文件选择框（配合 <label for=...> 触发）。
   刻意不用 display:none / visibility:hidden / 离屏定位 —— Safari 对不可见 file input 的
   响应不稳定；这里用「保留 1px 布局 + 完全透明」的视觉隐藏，跨浏览器最可靠。 */
.af-file-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
/* label 当按钮用时：禁止选中文字，避免双击把文字刷蓝 */
label.btn { user-select: none; -webkit-user-select: none; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .course-row-actions { margin-left: 0; width: 100%; }
}

/* ===== 青少年活动 / 渠道 / 报名 新增样式 ===== */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-tab {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.admin-tab.is-active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.admin-sec { margin-top: 18px; }
.admin-sec-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
/* 区块操作栏按钮（新建课程/新建活动/创建渠道等）：原 .btn-ghost 为白字白边(给深色 hero)，
   在浅色后台隐形；.btn-primary 为白底品牌字，对比偏弱。这里统一给可见的品牌描边/实心样式。 */
.admin-sec-bar .btn-ghost {
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-700); font-weight: 600;
}
.admin-sec-bar .btn-ghost:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.admin-sec-bar .btn-primary { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.admin-sec-bar .btn-primary:hover { background: var(--brand-900); color: #fff; border-color: var(--brand-900); }

/* 渠道链接 */
.channel-links { padding: 10px 14px 4px; display: flex; flex-direction: column; gap: 8px; }
.cl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-label { font-size: 13px; color: var(--ink-3); min-width: 92px; }
.cl-input { flex: 1; min-width: 200px; font-size: 12px; color: var(--ink-2); background: #f7f9f8; }
.cl-tip { margin: 2px 0 4px; font-size: 12px; line-height: 1.6; color: var(--ink-3); }

/* 多图预览 */
.gallery-preview { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.gallery-preview[hidden] { display: none !important; }
.gp-item { position: relative; width: 90px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.gp-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 20px; padding: 0; }

/* 报名分组 + 导出 */
.reg-group { margin-bottom: 24px; }
.reg-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.reg-group-head h3 { margin: 0; font-size: 17px; color: var(--ink-1); }
.reg-group-actions { display: flex; align-items: center; gap: 8px; }
.reg-count { color: var(--ink-3); font-weight: 400; font-size: 14px; }
.reg-table th, .reg-table td { font-size: 13px; vertical-align: middle; }
/* 报名表「已付」复选框垂直对齐优化 (2026-10-21)：原生 checkbox 默认 baseline 对齐 + 浏览器默认外边距会导致复选框略高于文字，
   统一改为 middle 对齐并消除外边距、微幅下压 1px 使其与「已付」文字视觉居中对齐 */
.reg-table .chk { margin: 0; line-height: 1; }
.reg-table input[type="checkbox"] {
  vertical-align: middle;
  margin: 0;
  width: 15px;
  height: 15px;
  position: relative;
  top: 1px;
}
/* 报名分组内「导出 Excel」按钮：原 .btn-ghost 为白字白边（给深色 hero 用），在浅色后台隐形；
   改为浅绿底+深绿字+深绿描边，与课程列表按钮风格一致，清晰可见 */
.reg-group-head .btn-ghost {
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-700); font-weight: 600;
}
.reg-group-head .btn-ghost:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
/* 报名行「删除」按钮：红色描边，弱于主操作、强调为危险操作 */
.reg-del-btn {
  background: #fff; border: 1px solid #e0b4b4; color: #c0392b;
  border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.reg-del-btn:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
/* 报名分组「删除本表」按钮：危险操作，红色描边，与绿色「导出 Excel」明确区分 */
.reg-group-head .reg-del-group-btn {
  background: #fff; color: #c0392b; border: 1px solid #c0392b; font-weight: 600;
}
.reg-group-head .reg-del-group-btn:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* 报名页活动选择 */
.signup-picker { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.signup-pick { text-align: left; }

/* 费用：单人票 + 动态组合票 */
.fee-block { display: flex; flex-direction: column; gap: 10px; }
.fee-combos { border: 1px dashed #d1d5db; border-radius: 8px; padding: 10px 12px; background: #fafafa; }
.fee-combos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fee-combos-title { font-size: 12px; color: #6b7280; }
.fee-combo-list { display: flex; flex-direction: column; gap: 8px; }
.fee-combo-row { display: flex; align-items: center; gap: 8px; }
.fee-combo-row .combo-name { flex: 1 1 50%; }
.fee-combo-row .combo-price { flex: 1 1 35%; }
.fee-combo-row .fee-combo-del { flex: 0 0 auto; white-space: nowrap; }

