/* GTM 容器產生器 — 頁面樣式
   色彩沿用站內 assets/css/main.css 的 CSS custom properties（米白底、綠 accent、
   Noto Sans TC），版型（stepper／card／btn）參考 tracking-helper-tool 的結構慣例。 */

:root {
  --bg-primary: #f6f4ef;
  --bg-secondary: #ebe9e1;
  --bg-card: #ffffff;
  --bg-accent: #d4ddd2;
  --text-primary: #1a1a1a;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a7a;
  --accent: #4a6b5a;
  --accent-light: #6b9b7e;
  --accent-dark: #2e4a3c;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --warning: #92600a;
  --warning-bg: #fdf1d8;
  --border: #d8d5cc;
  --shadow: rgba(26, 26, 26, 0.06);
  --shadow-md: rgba(26, 26, 26, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --font-zh: "Noto Sans TC", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-zh);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

a { color: var(--accent); }

[x-cloak] { display: none !important; }

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.back-bar { margin: 0 0 16px; font-size: 0.85rem; }
.back-bar a { color: var(--text-muted); text-decoration: none; }
.back-bar a:hover { color: var(--accent); }

.site-header { margin-bottom: 20px; }
.site-header h1 { font-size: 1.6rem; margin: 0 0 6px; font-family: var(--font-display); }
.site-header .subtitle { color: var(--text-secondary); margin: 0; font-size: 0.95rem; }

/* ───────── 進度指示 ───────── */
.stepper {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: 0 1px 2px var(--shadow);
  flex-wrap: wrap;
}
.step-item {
  flex: 1;
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}
.step-item.active { background: var(--accent); color: #fff; }
.step-item.done { color: var(--accent-dark); }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.7rem;
  flex-shrink: 0;
}
.step-item.active .step-num { background: rgba(255, 255, 255, 0.3); }

/* ───────── 卡片 ───────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px var(--shadow);
}
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card + .card { margin-top: 0; }

/* ───────── 表單 ───────── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.field-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

/* ───────── 選項卡（平台 / 事件 / 觸發方式）───────── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.option-card {
  display: block;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.option-card.selected {
  border-color: var(--accent);
  background: var(--bg-accent);
}
.option-card .option-title { font-weight: 600; }
.option-card .option-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: 4px; }

/* ───────── 系統切換區塊 ───────── */
.system-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.system-block:last-child { margin-bottom: 0; }
.system-block-header { display: flex; align-items: center; justify-content: space-between; }
.system-block-title { font-weight: 600; }
.system-fields { margin-top: 12px; }

.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 999px; transition: 0.15s;
}
.toggle-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.15s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ───────── 事件卡片 ───────── */
.event-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.event-card:last-child { margin-bottom: 0; }
.event-card-header { display: flex; align-items: center; justify-content: space-between; }
.event-card-title { font-weight: 600; }
.trigger-mode-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.trigger-mode-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.trigger-mode-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ───────── 流程 v2：掃描 teaser／預填徽章 ───────── */
.scan-teaser {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.teaser-platform { font-size: 0.95rem; margin-bottom: 8px; }
.confidence-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 600;
}
.teaser-tags-summary { list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.85rem; }
.teaser-tags-summary li { padding: 2px 0; }
.teaser-issues { list-style: none; margin: 0 0 10px; padding: 0; }
.teaser-issues li { margin-bottom: 6px; }
.prefill-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.7rem;
  font-weight: 500;
  vertical-align: middle;
}

/* ───────── 提示框 ───────── */
.tip-box {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.82rem;
  margin: 10px 0;
}
.tip-box-warning { background: var(--warning-bg); color: var(--warning); }
.tip-box-danger { background: var(--danger-bg); color: var(--danger); }
.tip-box-muted { background: var(--bg-secondary); color: var(--text-secondary); }

/* ───────── 按鈕 ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-secondary); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-lg { padding: 12px 26px; font-size: 0.95rem; }

.step-actions { display: flex; justify-content: space-between; margin-top: 20px; gap: 10px; }
.step-actions.single { justify-content: flex-end; }

/* ───────── 確認頁摘要 ───────── */
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.summary-row:last-child { border-bottom: none; }
.summary-row dt { color: var(--text-muted); }
.summary-row dd { margin: 0; text-align: right; }
.summary-event { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; font-size: 0.85rem; }
.summary-event:last-child { margin-bottom: 0; }

/* ───────── 結果頁 ───────── */
.result-filename { font-family: monospace; background: var(--bg-secondary); padding: 3px 8px; border-radius: 6px; font-size: 0.85rem; }
.install-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.install-step {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.install-step:last-child { border-bottom: none; }
.install-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}
.install-step-body { font-size: 0.88rem; }
.install-step-when { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

.warnings-list { margin: 0; padding-left: 18px; font-size: 0.85rem; color: var(--warning); }
.warnings-list li { margin-bottom: 4px; }

.mock-banner {
  background: var(--bg-accent);
  color: var(--accent-dark);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.78rem;
  margin-bottom: 14px;
  text-align: center;
}
