/* ============================================================
   components.css —— 公共组件（卡片/按钮/表单/表格/状态条/仪表）
   对应 SDD-002 §6.3 §6.4 / M11-05 M11-06
   ============================================================ */

/* ==================== 顶部信息条（M6-01 / M7-09） ==================== */
.topbar {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 10;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 16px;
  background: var(--navy-bar);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}
.topbar__left   { display: flex; align-items: center; gap: 10px; }
.topbar__mid    { margin-left: 10px; }
.topbar__right  { margin-left: auto; text-align: left; line-height: 1.5; }
.topbar__id     { line-height: 1.5; }
.topbar__seat   { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; padding-left: 14px; }
.topbar__seat svg { width: 22px; height: 22px; }

/* ==================== 卡片（M11-05） ==================== */
.card {
  display: grid;
  grid-template-columns: 32% 1fr;
  width: min(860px, 84vw);
  min-height: 340px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* 宽卡片：设备测试 / 答题核对 */
.card--wide {
  grid-template-columns: 210px 1fr;
  width: min(1080px, 92vw);
  min-height: 500px;
}

/* ---- 左侧座位号区 ---- */
.card__badge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--white);
  border-right: 1px solid #f0f2f4;
}
.card__seat {
  font-size: 6rem;
  font-weight: 700;
  color: var(--seat-color);
  letter-spacing: .02em;
  line-height: 1;
}
.card__brand {
  position: absolute;
  top: 2px; left: 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
}
.card__brand-logo {
  height: 30px; width: auto;
  display: block;
}

/* ---- 右侧内容区 ---- */
.card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card__header {
  background: var(--green);
  color: #fff;
  padding: 9px 22px;
  font-size: .95rem;
  width: max-content;
  min-width: 120px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.card__content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px 34px;
  min-width: 0;
}
.card__info { flex: 1; min-width: 0; line-height: 2; color: var(--text-sub); }
.card__info p { margin: 0; }
.card__info span { color: var(--text-main); }

.card__actions {
  display: flex;
  gap: 16px;
  margin-top: 18px;
}
.card__actions--split .btn { min-width: 132px; }

/* 宽卡片的左侧竖栏（设备测试 / 核对） */
.card__side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 46px 12px 16px;
  background: var(--white);
  border-right: 1px solid #f0f2f4;
}
.card__side .card__brand { top: 16px; left: 16px; }
.card__side-name { font-size: 15px; color: var(--text-main); margin-top: 4px; }
.card__side-id   { font-size: 12px; color: var(--text-muted); }
.card__side-seat {
  margin-top: auto;
  font-size: 3.4rem;
  font-weight: 700;
  color: var(--seat-color);
  line-height: 1;
}

/* ==================== 头像 ==================== */
.avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--seat-color);
  flex: none;
}
.avatar svg { width: 100%; height: 100%; fill: currentColor; }
.avatar--sm { width: 30px; height: 30px; color: #fff; }
.avatar--md { width: 76px; height: 76px; }
.avatar--lg { width: 92px; height: 92px; }
.avatar__tag {
  position: absolute;
  bottom: 18%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

/* ==================== 表单 ==================== */
.field__label { font-size: 13px; color: var(--text-main); }
.field__label--inline { width: 110px; flex: none; text-align: right; }
.field__input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  border: none;
  border-bottom: 1px solid #9aa7b3;
  background: transparent;
  outline: none;
  transition: border-color var(--t-fast);
}
.field__input:focus { border-bottom-color: var(--btn-primary); }
.field__input--inline { width: 168px; }
.field__row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.field__error {
  min-height: 16px;
  font-size: 12px;
  color: var(--red);
}

/* ==================== 按钮 ==================== */
.btn {
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 26px;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(21, 101, 192, .3);
}
.btn--primary:hover { background: var(--btn-primary-hover); }
.btn--ghost {
  background: transparent;
  color: var(--btn-primary);
  border: 1px solid var(--btn-primary);
}
.btn--ghost:hover { background: rgba(21, 101, 192, .08); }
.btn--sm { padding: 6px 16px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ==================== 状态条（SDD §6.4） ==================== */
.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  padding: 0 16px;
  background: var(--navy-bar);
  color: #fff;
  font-size: 13px;
  flex: none;
}
.statusbar__icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-style: italic;
  flex: none;
}
.statusbar__icon--rec {
  border: none;
  border-radius: 0;
  width: 18px; height: 18px;
  background: none;
  font-size: 0;
  position: relative;
  /* 录音图标（record.gif，白色背景自适应） */
  background-image: url("record.gif");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
/* 录制时麦克风向外扩散的声波（小/中/大 三级） */
.statusbar__icon--rec::before,
.statusbar__icon--rec::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .85);
  pointer-events: none;
  animation: rec-wave 1.8s ease-out infinite;
}
.statusbar__icon--rec::after { animation-delay: .9s; }
@keyframes rec-wave {
  0%   { transform: scale(.4); opacity: .85; } /* 小 */
  50%  { transform: scale(1);  opacity: .45; } /* 中 */
  100% { transform: scale(1.8); opacity: 0; }  /* 大 */
}
.statusbar__label { font-weight: 600; flex: none; }
.statusbar__progress {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, .35);
  border-radius: 5px;
  overflow: hidden;
  margin: 0 6px;
}
.statusbar__bar {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 5px;
  transition: width .3s linear;
}
.statusbar__countdown { flex: none; font-size: 14px; }
.statusbar__countdown b { font-size: 15px; }

/* ---- 闪烁红点（M7-03 / SDD §6.4） ---- */
.rec-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--rec-red);
  display: inline-block;
  animation: blink 1.2s infinite;
  flex: none;
}
.rec-dot--off { animation: none; opacity: .25; }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .2; }
}

/* ==================== 电平表（M5-05 / M5-07） ==================== */
.meter {
  position: relative;
  flex: 1;
  height: 10px;
  background: #d7dde3;
  border-radius: 5px;
  overflow: hidden;
  min-width: 60px;
}
.meter--wide  { max-width: 640px; }
.meter__fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, #43A047 0%, #7CB342 55%, #E53935 100%);
  transition: width .08s linear;
}

/* ==================== 表格（M8-02） ==================== */
.table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 200px;
  max-height: 300px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  position: sticky; top: 0;
  background: #f1f3f5;
  color: var(--text-sub);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f4;
  color: var(--text-sub);
}
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr.is-active { background: #e3f0ff; }
.table .cell-idx { color: var(--text-muted); }
.table .link {
  color: var(--btn-primary);
  text-decoration: underline;
  cursor: pointer;
}
.table .link:hover { color: var(--btn-primary-hover); }
.table td.is-empty { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* 自定义复选框 */
.checkbox {
  width: 15px; height: 15px;
  accent-color: var(--btn-primary);
  cursor: pointer;
  vertical-align: middle;
}

/* ==================== 设备控制条（M5-02 / M5-03，三行布局） ==================== */
.device-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  flex: none;
}
.device-bar__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 50%;
}
.device-bar__row--split { width: 100%; flex-wrap: nowrap; gap: 24px; }
.device-bar__cell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 50%;
  min-width: 0;
}
.device-bar__label { font-size: 12px; color: var(--text-sub); flex: none; }
.device-bar__select {
  font-family: inherit;
  font-size: 12px;
  color: var(--text-sub);
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  outline: none;
}
.device-bar__select:focus { border-color: var(--btn-primary); }
.device-bar .meter--bar { flex: none; width: 90px; }
.device-bar__range {
  flex: 1;
  min-width: 90px;
  max-width: 220px;
  accent-color: var(--btn-primary);
  cursor: pointer;
}
.device-bar .rec-dot { margin-left: 2px; }

/* ==================== 视频预览 ==================== */
.device-preview {
  position: relative;
  flex: 1;
  min-height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel-video);
}
.device-preview video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  background: var(--panel-video);
}
.device-preview__fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  color: #4a6076;
  background: repeating-linear-gradient(45deg, #dfe8f2, #dfe8f2 12px, #d5e1ee 12px, #d5e1ee 24px);
  line-height: 1.9;
}
.device-preview__fallback small { font-size: 12px; color: #6a7f95; }
.device-preview.is-fallback video { visibility: hidden; }
.device-preview.is-fallback .device-preview__fallback { display: flex; }

/* 设备测试页录像状态条（对齐答题页录像状态条样式） */
#dev-status { margin-top: 4px; border-radius: var(--radius-sm); }
#dev-status .statusbar__bar { background: var(--yellow, #ffd54f); }
#dev-status .statusbar__progress { background: rgba(255, 255, 255, .5); }

/* 设备测试页：录像 / 回放 / 完成 */
.device-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.device-acts[hidden] { display: none; }   /* 自动录像期间隐藏：重录/回放/完成 */
.device-acts .btn { min-width: 118px; }
.device-acts__hint { font-size: 12px; color: var(--text-muted); }

.device-preview__replay {
  position: absolute;
  inset: 0;
  background: #0b1a26;
}
.device-preview__replay video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.device-preview__replay-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(198, 40, 40, .85);
}

/* ==================== 全局提示条 ==================== */
.toast {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 10px 24px;
  border-radius: 20px;
  background: rgba(33, 37, 41, .88);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--card-shadow-sm);
  animation: pageIn .2s ease both;
}
.toast--error { background: rgba(211, 47, 47, .94); }

/* ==================== 录像完成确认信息框（考试端同款系统弹窗） ==================== */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog[hidden] { display: none; }
.dialog__mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 34, 51, .45);
}
.dialog--win .dialog__panel {
  position: relative;
  width: auto;
  max-width: calc(100vw - 48px);
  padding: 0;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  background: linear-gradient(180deg, #ddeaf8 0%, #c8dcf2 100%);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .38);
  animation: pageIn .18s ease both;
}
.msgbox {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 34px 6px 22px;
}
.msgbox__icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, #5aa2e6 0%, #1656a5 100%);
  border: 1px solid #0f3f7a;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.msgbox__text {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: #15365c;
}
.msgbox__actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 16px 24px 22px;
}
.msgbox__btn {
  min-width: 96px;
  height: 28px;
  font-family: inherit;
  font-size: 13px;
  color: #15365c;
  background: linear-gradient(180deg, #ffffff 0%, #e8f0fa 100%);
  border: 1px solid #7f9db9;
  border-radius: 2px;
  cursor: pointer;
}
.msgbox__btn:hover { background: linear-gradient(180deg, #ffffff 0%, #d3e3f7 100%); }