/* 视频号双技能网页版 · 前端样式
   基于 TDesign 设计体系简化版：中性灰阶 + 品牌蓝，双主题（浅色 / 深色）
   所有颜色走 CSS 变量，切换 data-theme 即可换肤，与 verify/design token 对齐 */

:root {
  --bg-page: #eeeeee;
  --bg-container: #ffffff;
  --bg-container-hover: #f3f3f3;
  --bg-secondarycontainer: #f3f3f3;
  --bg-component: #e8e8e8;
  --bg-brand-light: #f2f3ff;
  --brand: #0052d9;
  --brand-hover: #366ef4;
  --brand-active: #003cab;
  --success: #2ba471;
  --success-light: #e3f9e9;
  --warning: #e37318;
  --warning-light: #fff1e9;
  --error: #d54941;
  --error-light: #fff0ed;
  --purple: #7347eb;
  --purple-light: #f2effe;
  --text-primary: rgba(0, 0, 0, 0.9);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-placeholder: rgba(0, 0, 0, 0.4);
  --text-disabled: rgba(0, 0, 0, 0.26);
  --text-anti: #ffffff;
  --border-level-1: #e8e8e8;
  --border-level-2: #dddddd;
  --shadow-1: 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
  --shadow-2: 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 5px 5px -3px rgba(0, 0, 0, 0.1);
  --radius-default: 3px;
  --radius-medium: 6px;
  --radius-round: 999px;
}

html[data-theme="dark"] {
  --bg-page: #181818;
  --bg-container: #242424;
  --bg-container-hover: #2c2c2c;
  --bg-secondarycontainer: #2c2c2c;
  --bg-component: #393939;
  --bg-brand-light: #1b2f51;
  --brand: #4582e6;
  --brand-hover: #2667d4;
  --brand-active: #699ef5;
  --success: #059465;
  --success-light: #193a2a;
  --warning: #cf6e2d;
  --warning-light: #4f2a1d;
  --error: #c64751;
  --error-light: #472324;
  --purple: #9e78fb;
  --purple-light: #382c5c;
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-placeholder: rgba(255, 255, 255, 0.35);
  --text-disabled: rgba(255, 255, 255, 0.22);
  --text-anti: #ffffff;
  --border-level-1: #393939;
  --border-level-2: #5e5e5e;
  --shadow-1: 0 4px 6px rgba(0, 0, 0, 0.06), 0 1px 10px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.12);
  --shadow-2: 0 8px 10px rgba(0, 0, 0, 0.12), 0 3px 14px rgba(0, 0, 0, 0.1), 0 5px 5px rgba(0, 0, 0, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 24px;
  background: var(--bg-container);
  border-bottom: 1px solid var(--border-level-1);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.brand-mark svg { width: 16px; height: 16px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-default);
  background: var(--bg-container);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-container-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: var(--text-anti);
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { background: var(--brand); opacity: 0.5; }

.btn-outline {
  background: var(--bg-container);
  border-color: var(--border-level-2);
}

.btn-lg { height: 40px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  padding: 0 10px;
}
.btn-ghost:hover { background: var(--bg-secondarycontainer); color: var(--text-primary); }

.card {
  background: var(--bg-container);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border-level-1);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-default);
  font-size: 12px;
  line-height: 1;
}
.tag-brand { background: var(--bg-brand-light); color: var(--brand); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-error { background: var(--error-light); color: var(--error); }
.tag-purple { background: var(--purple-light); color: var(--purple); }
.tag-muted { background: var(--bg-secondarycontainer); color: var(--text-secondary); }

/* ---------- 布局 ---------- */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-wide {
  max-width: 1200px;
}

.page-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
}

.page-sub {
  margin: 0 0 28px;
  color: var(--text-secondary);
  font-size: 14px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.stack > * + * { margin-top: 16px; }

/* ---------- 表单 ---------- */
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-placeholder);
}

.input, .textarea {
  width: 100%;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--border-level-2);
  border-radius: var(--radius-default);
  background: var(--bg-container);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.7; resize: vertical; }
.input:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--bg-brand-light);
}

/* ---------- 上传区 ---------- */
.dropzone {
  border: 1px dashed var(--border-level-2);
  border-radius: var(--radius-medium);
  background: var(--bg-container);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--brand);
  background: var(--bg-brand-light);
}
.dropzone-icon {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  border-radius: var(--radius-round);
  background: var(--bg-secondarycontainer);
  display: flex; align-items: center; justify-content: center;
}
.dropzone-title { font-size: 14px; font-weight: 500; }
.dropzone-hint { margin-top: 4px; font-size: 12px; color: var(--text-placeholder); }
.preview-img {
  margin-top: 12px;
  max-width: 160px;
  max-height: 160px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--border-level-1);
  display: none;
}

/* ---------- 进度 ---------- */
.progress {
  height: 6px;
  border-radius: var(--radius-round);
  background: var(--bg-component);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: var(--radius-round);
  background: var(--brand);
  transition: width 0.3s ease;
}
.progress-striped {
  background-image: linear-gradient(45deg, rgba(255,255,255,0.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.25) 75%, transparent 75%, transparent);
  background-size: 16px 16px;
  animation: progress-stripes 1s linear infinite;
}
@keyframes progress-stripes {
  from { background-position: 0 0; }
  to { background-position: 16px 0; }
}

/* ---------- 提示 ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-default);
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid transparent;
}
.alert-error { background: var(--error-light); color: var(--error); border-color: var(--error); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--bg-brand-light); color: var(--brand); border-color: var(--brand); }

.toast-wrap {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius-default);
  background: var(--bg-container);
  border: 1px solid var(--border-level-2);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  color: var(--text-primary);
  animation: toast-in 0.18s ease;
}
.toast.is-error { border-color: var(--error); color: var(--error); }
.toast.is-success { border-color: var(--success); color: var(--success); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 首页入口卡 ---------- */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.entry-card {
  display: block;
  padding: 24px;
  border-radius: var(--radius-medium);
  background: var(--bg-container);
  border: 1px solid var(--border-level-1);
  box-shadow: var(--shadow-1);
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.entry-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--brand);
}
.entry-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-medium);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.entry-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.entry-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.7; }
.entry-meta { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 结果列表 ---------- */
.result-list { list-style: none; margin: 0; padding: 0; }
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-level-1);
}
.result-item:first-child { border-top: none; }
.result-name { font-size: 14px; font-weight: 500; color: var(--text-primary); word-break: break-all; }
.result-meta { margin-top: 2px; font-size: 12px; color: var(--text-placeholder); }
.result-actions { display: flex; gap: 8px; flex: none; }

.result-frame {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border-level-1);
  border-radius: var(--radius-medium);
  background: var(--bg-container);
  margin-top: 12px;
}

/* ---------- 任务历史表 ---------- */
.table-wrap { overflow-x: auto; }
table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th, table.history td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-level-1);
  white-space: nowrap;
}
table.history th { color: var(--text-secondary); font-weight: 500; background: var(--bg-secondarycontainer); }
table.history td { color: var(--text-primary); }
table.history tr:hover td { background: var(--bg-container-hover); }

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-placeholder);
  font-size: 13px;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: var(--bg-container);
  border: 1px solid var(--border-level-1);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-2);
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.login-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-sub { margin: 0 0 24px; color: var(--text-secondary); font-size: 13px; }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--text-placeholder); text-align: center; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--text-secondary); }
.tiny { font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 767px) {
  .topbar { padding: 0 16px; height: 52px; }
  .brand-text { display: none; }
  .page { padding: 20px 16px 48px; }
  .page-title { font-size: 20px; }
  .entry-grid { grid-template-columns: 1fr; gap: 12px; }
  .result-item { flex-direction: column; align-items: flex-start; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; }
  .result-frame { height: 420px; }
}
