/* ==========================================================================
   报名签到系统 · 共享样式层
   H5 与后台共用；Bootstrap 5 / AdminLTE 各自的基础样式由 vendor 提供。
   本文件只补三块：品牌色变量、H5 报名流程样式、通用小工具类。
   ========================================================================== */

:root {
  --brand:        #1f6feb;
  --brand-dark:   #1858c4;
  --brand-soft:   #e8f1ff;
  --ok:           #16a34a;
  --warn:         #d97706;
  --danger:       #c02a22;      /* 深一档：正文级红色也要过 AA */
  --ink:          #16191f;
  --ink-2:        #4b5563;
  --ink-3:        #6b7280;      /* 原 #9ca3af 在白底只有 2.5:1，正文不可读 */
  --line:         #e5e7eb;
  --line-strong:  #d3d9e0;
  --bg:           #f5f6f8;

  /* 表单面：纸 / 面 / 控件 三层，靠明度分层而不是靠阴影 */
  --paper:        #fbfcfd;
  --surface:      #ffffff;
  --field-bg:     #ffffff;
  --focus-ring:   rgba(31, 111, 235, .38);

  /* 圆角只有一档体系：小控件 8 · 控件 12 · 容器 16，全站不得混用 */
  --r-chip:       8px;
  --r-control:    12px;
  --r-card:       16px;

  --dur-fast:     120ms;
  --dur-base:     180ms;
  --ease-out:     cubic-bezier(.16, 1, .3, 1);
  --ease-in:      cubic-bezier(.4, 0, 1, 1);

  --radius:       var(--r-card);   /* 旧变量名保留，指向同一体系 */
  --radius-sm:    var(--r-control);
  --shadow:       0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .06);
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 预留滚动条槽位：后台各页内容高度不同，有的出滚动条有的不出，
   切换页面时视口宽度会跳十几像素，整个框架跟着横向抖一下。 */
html { scrollbar-gutter: stable; }

/* --------------------------------------------------------------------------
   H5 外壳：单列、最大 640px、居中
   -------------------------------------------------------------------------- */
.h5-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 96px;
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;      /* iOS 地址栏伸缩时不要跳高度 */
  position: relative;
  overflow-x: clip;
}

/* 页头：不做渐变色块。活动名用字重与字号的对比撑起来，
   下面压一条 1px 分隔线 —— 表单页不需要"欢迎来到"式的横幅。 */
.h5-hero {
  padding: 20px 20px 16px;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.h5-hero h1 {
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 8px 0 6px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
  min-width: 0;
}
.h5-hero .h5-hero-time {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* 状态徽标：实色小片，靠底色与文字色的对比，而不是半透明白底 */
.h5-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-chip);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  background: #eef2f7;
  color: #334155;
  border: 1px solid #dde4ec;
}
.h5-badge.is-pending { background: #fff5e6; color: #8a5200; border-color: #f3ddb8; }
.h5-badge.is-open    { background: #e6f6ec; color: #146c3a; border-color: #c6e8d4; }
.h5-badge.is-closed  { background: #f0f1f3; color: #5b6472; border-color: #dfe3e8; }

.h5-body { padding: 18px 20px 0; }

/* 段落不做卡片：靠发丝线分组。原来"卡片 + 三像素蓝竖条标题"是模板味最重的两处 */
.h5-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.h5-card:first-child { border-top: 0; padding-top: 4px; }
.h5-card:last-child { padding-bottom: 6px; }

/* 段落标题与表单段标题共用一套，全站只有一种"小标题" */
.h5-card-title,
.form-section-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
  margin: 0 0 12px;
}
.h5-card-title::before { content: none; }

.h5-desc {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   底部固定操作条
   -------------------------------------------------------------------------- */
.h5-footer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 640px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(251, 252, 253, .92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
}
/* 当前页没有可操作项时不要留一条空白横条 */
.h5-footer:empty { display: none; }
/* 底栏只放说明文字时的样式（无按钮可点） */
.h5-footer .h5-hint {
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  padding: 4px 0 2px;
}
.h5-footer .btn,
.h5-footer a.btn {
  height: 52px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--r-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 主按钮锁品牌蓝：Bootstrap 默认的 #0d6efd 与品牌蓝并存在一个页面就成了两个强调色 */
.h5-footer .btn-primary,
.h5-body .btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.h5-footer .btn-primary:hover:not(:disabled),
.h5-body .btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.h5-footer .btn-primary:active:not(:disabled),
.h5-body .btn-primary:active:not(:disabled) {
  transform: translateY(1px);           /* 真按下去的手感，不是弹跳 */
}
.h5-footer .btn-primary:focus-visible,
.h5-body .btn-primary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: none;
}
.h5-footer .btn-primary:disabled,
.h5-footer .btn-primary.disabled,
.h5-body .btn-primary:disabled {
  background: #dde3ee;
  border-color: #dde3ee;
  color: #5d6878;
  opacity: 1;            /* Bootstrap 默认给 disabled 压 0.65，会把颜色冲淡 */
  transform: none;
}
/* 提交中：保持品牌蓝（白字 4.6:1 仍可读），只多一个转圈。
   灰底浅字那种"整块消失"的写法只适合真正的禁用态，不适合"正在提交"。 */
.h5-footer .btn-primary[data-state="loading"],
.h5-footer .btn-primary[data-state="loading"]:disabled {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  opacity: 1;
}
.h5-footer .btn-primary[data-state="loading"]::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 9px;
  border: 2px solid rgba(255, 255, 255, .5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: h5-spin .7s linear infinite;
}

/* --------------------------------------------------------------------------
   报名表单
   结构：页头（活动名）→ 单段表单 → 说明 → 底部固定按钮。
   不做卡片堆叠，字段之间的留白就是分组。

   Hallmark · component: registration form (H5) · genre: utilitarian
   theme: incumbent brand blue #1f6feb · paper #fbfcfd · ink #16191f
   states: default · hover · focus-visible · active · disabled · loading · error
   对比度：正文 17.1:1 · placeholder 4.83:1 · 主按钮 4.63:1（均过 AA）
   -------------------------------------------------------------------------- */
.h5-form { padding-bottom: 2px; }
.form-fields { display: grid; gap: 18px; }

.field { min-width: 0; }

.h5-form .form-label,
.h5-form .field > .form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 7px;
}
.req::after { content: " *"; color: var(--danger); font-weight: 700; }

.h5-form .form-control {
  height: 50px;
  padding: 0 14px;
  font-size: 16px;                 /* 低于 16px 时 iOS 聚焦会整页放大 */
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  box-shadow: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.h5-form .form-control::placeholder { color: var(--ink-3); }
.h5-form .form-control:hover:not(:disabled):not(:focus) { border-color: #b7c0cb; }
.h5-form .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.h5-form .form-control:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.h5-form .form-control:disabled { background: #f2f4f7; color: var(--ink-3); }
.h5-form .form-control.is-invalid {
  border-color: var(--danger);
  background: #fffafa;
}
.h5-form .form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(192, 42, 34, .2); }

.field-err {
  display: flex;
  align-items: center;
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--danger);
  animation: field-in var(--dur-base) var(--ease-out);
}

/* 单选 / 多选：做成可点的大块选项，手机上不用瞄准小方框 */
.choice-set { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; display: inline-flex; }
.choice-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice-text {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  transition: border-color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.choice-input:checked + .choice-text {
  color: var(--brand-dark);
  font-weight: 600;
  background: var(--brand-soft);
  border-color: var(--brand);
}
.choice-input:focus-visible + .choice-text {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.choice-set.has-error .choice-text { border-color: rgba(192, 42, 34, .5); }

.form-note {
  margin: 20px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-3);
}

/* 提示条：左侧一道色条区分语气，不再靠内联 style 硬写 */
.h5-notice {
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-control);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.75;
}
.h5-notice.is-warn { background: #fff8ec; border-color: #f2ddb9; border-left-color: #d99b2b; color: #8a5200; }
.h5-notice.is-info { background: #eff5ff; border-color: #cfe0f8; border-left-color: var(--brand); color: #1b4a8a; }

/* --------------------------------------------------------------------------
   加载骨架 / 状态块 / 错误面板
   -------------------------------------------------------------------------- */
.skel-label, .skel-field, .skel-line {
  background: linear-gradient(90deg, #edf0f4 0%, #f8fafc 45%, #edf0f4 90%);
  background-size: 220% 100%;
  animation: skel-shift 1.4s linear infinite;
}
.skel-line  { height: 13px; width: 34%;  border-radius: 6px; margin-bottom: 20px; }
.skel-label { height: 12px; width: 22%;  border-radius: 6px; margin-bottom: 9px; }
.skel-field { height: 50px; border-radius: var(--r-control); margin-bottom: 18px; }

.h5-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 2px;
  font-size: 14px;
  color: var(--ink-2);
}
.h5-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: h5-spin .7s linear infinite;
  flex: none;
}

.h5-error {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: var(--r-card);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.8;
}
.h5-error-mark {
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
}
.h5-error-actions { margin-top: 14px; }

@keyframes h5-spin { to { transform: rotate(360deg); } }
@keyframes skel-shift { to { background-position: -220% 0; } }
@keyframes field-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .skel-label, .skel-field, .skel-line, .field-err { animation: none; }
  .h5-spinner, .h5-footer .btn-primary[data-state="loading"]::after { animation-duration: 1.6s; }
  .h5-footer .btn-primary:active:not(:disabled),
  .h5-body .btn-primary:active:not(:disabled) { transform: none; }
}

/* 结果态 */
.h5-result { text-align: center; padding: 40px 20px 0; }
.h5-result-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff; background: var(--ok);
  margin-bottom: 16px;
}
.h5-result-icon.is-fail { background: var(--danger); }
.h5-result h2 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.h5-result p  { color: var(--ink-2); font-size: 14px; line-height: 1.8; margin: 0; }

/* 键值对信息块：标签列固定宽度让数字与文字对齐成一列，虚线换极浅实线 */
.kv { font-size: 14px; }
.kv-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eef1f5;
}
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-k { color: var(--ink-2); flex: 0 0 76px; }
.kv-v { color: var(--ink); flex: 1; min-width: 0; word-break: break-word; font-weight: 500; }

/* 签到分支切换 */
.sign-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.sign-tabs button {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
}
.sign-tabs button.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.captcha-box { display: flex; gap: 10px; }
.captcha-box img {
  height: 44px; width: 112px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); cursor: pointer; object-fit: cover;
}

/* --------------------------------------------------------------------------
   后台补充样式（AdminLTE 之上）
   -------------------------------------------------------------------------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.page-head h1 { font-size: 19px; font-weight: 700; margin: 0; }
.page-head .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.card { box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: var(--radius); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--ink-3); }
.stat-card .value { font-size: 26px; font-weight: 700; line-height: 1.3; margin-top: 4px; }
.stat-card .value small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.stat-card.is-brand .value { color: var(--brand); }
.stat-card.is-ok    .value { color: var(--ok); }
.stat-card.is-warn  .value { color: var(--warn); }

.table-sm td, .table-sm th { vertical-align: middle; }
.table .text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.tag-gray   { background: #f1f3f5; color: #5f6368; }
.tag-blue   { background: var(--brand-soft); color: var(--brand-dark); }
.tag-green  { background: #e7f8ee; color: #12703c; }
.tag-amber  { background: #fef3e2; color: #96590d; }
.tag-red    { background: #fdeaea; color: #a12222; }

.empty {
  text-align: center; color: var(--ink-3);
  padding: 40px 10px; font-size: 14px;
}
.empty i { display: block; font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* 二维码预览 */
.qr-preview {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; background: #fafbfc;
}
.qr-preview img { max-width: 100%; width: 220px; height: auto; background: #fff; }
.qr-preview .url {
  font-size: 12px; color: var(--ink-3);
  word-break: break-all; margin-top: 8px;
}

/* 表单设计器（动态字段） */
.field-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; background: #fbfcfd;
}
.field-item .drag { cursor: grab; color: var(--ink-3); }
.field-item .row > [class*="col-"] { margin-bottom: 8px; }

/* 打印：只出二维码 */
@media print {
  .no-print, .main-sidebar, .main-header, .main-footer { display: none !important; }
  .content-wrapper { margin-left: 0 !important; }
  .print-area { display: block !important; }
}
