/* =======================================================================
 *  MQ 報名系統 — 前端樣式
 * ======================================================================= */

:root {
  --coral: #e2725b;
  --coral-dark: #c95a44;
  --coral-soft: #f6d9d0;
  --cream: #fcf7f3;
  --ink: #2f2a28;
  --muted: #8a807b;
  --line: #ece2db;
  --white: #ffffff;
  --green: #3c9a6a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(64, 40, 30, 0.08);
  --shadow-sm: 0 4px 14px rgba(64, 40, 30, 0.07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 760px; }

/* 錨點捲動時避開固定式頁首 */
section[id] { scroll-margin-top: 80px; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }

a { color: var(--coral-dark); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(252, 247, 243, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--coral); color: #fff; font-weight: 900; letter-spacing: .5px;
}
.brand-text { font-size: 1rem; }
.header-line {
  font-size: .9rem; font-weight: 500; padding: 7px 14px;
  border: 1px solid var(--coral); border-radius: 999px; color: var(--coral-dark);
}
.header-line:hover { background: var(--coral); color: #fff; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; text-align: center; }
.eyebrow { color: var(--coral-dark); font-weight: 700; letter-spacing: 2px; font-size: .85rem; margin: 0 0 14px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.9rem); font-weight: 900; }
.hero .lead { max-width: 640px; margin: 18px auto 30px; color: #5d534e; font-size: 1.05rem; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 11px 22px; font-size: .98rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: .18s ease; text-align: center;
}
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-primary { background: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-secondary:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--coral); color: var(--coral-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Info ---------- */
.info { padding: 30px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.info-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm);
}
.info-card h2 { font-size: 1.25rem; }
.info-card.consultant { background: linear-gradient(160deg, #fff, #fbeee8); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 6px 0 6px 28px; position: relative; }
.check-list li::before {
  content: "✓"; position: absolute; left: 0; top: 6px;
  color: var(--coral); font-weight: 900;
}
.disclaimer { font-size: .82rem; color: var(--muted); margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- 流程 ---------- */
.section-title { text-align: center; font-size: 1.6rem; font-weight: 900; margin: 10px 0 26px; }
.steps-overview { padding: 36px 0; }
.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.flow li {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; font-size: .92rem; box-shadow: var(--shadow-sm);
}
.flow-num {
  display: inline-grid; place-items: center; width: 34px; height: 34px; margin-bottom: 8px;
  border-radius: 50%; background: var(--coral-soft); color: var(--coral-dark); font-weight: 900;
}

/* ---------- 報名表單 ---------- */
.register { padding: 30px 0 80px; }

.stepper { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 26px; }
.step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: .82rem; color: var(--muted); position: relative; font-weight: 500;
}
.step span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--line); color: var(--muted); font-weight: 700;
}
.step.is-active { color: var(--coral-dark); }
.step.is-active span { border-color: var(--coral); background: var(--coral); color: #fff; }
.step.is-done span { border-color: var(--green); background: var(--green); color: #fff; }

/* 卡片面板 */
.panel {
  display: none; background: var(--white); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px; box-shadow: var(--shadow);
}
.panel.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-title { font-size: 1.25rem; }
.panel-hint { color: var(--muted); font-size: .9rem; margin: -4px 0 18px; }
.panel-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

/* 方案卡 */
.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan-card {
  display: flex; gap: 14px; align-items: flex-start; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  transition: .16s ease; background: var(--white);
}
.plan-card:hover { border-color: var(--coral-soft); }
.plan-card.selected { border-color: var(--coral); background: #fffaf8; box-shadow: var(--shadow-sm); }
.plan-card input { margin-top: 4px; accent-color: var(--coral); width: 18px; height: 18px; }
.plan-card .plan-body { flex: 1; }
.plan-card .plan-name { font-weight: 700; font-size: 1.05rem; }
.plan-card .plan-name .tag {
  display: inline-block; margin-left: 8px; font-size: .72rem; font-weight: 700;
  background: var(--coral-soft); color: var(--coral-dark); padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.plan-card .plan-summary { font-size: .9rem; color: #5d534e; margin: 4px 0; }
.plan-card .plan-desc { font-size: .82rem; color: var(--muted); }
.plan-card .plan-price { font-weight: 900; font-size: 1.15rem; color: var(--coral-dark); white-space: nowrap; }
.plan-card .plan-price small { font-weight: 500; font-size: .72rem; color: var(--muted); display: block; text-align: right; }

/* 受測者欄位區塊 */
.person-block {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  background: #fffdfc;
}
.person-block > h4 {
  margin: 0 0 16px; font-size: 1rem; color: var(--coral-dark);
  display: flex; align-items: center; gap: 8px;
}
.person-block > h4 .badge {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--coral); color: #fff; font-size: .8rem; font-weight: 700;
}

/* 表單欄位 */
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.field-label .req, .field > label .req { color: var(--coral); margin-left: 3px; }
.field-help { font-size: .8rem; color: var(--muted); margin: -2px 0 8px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field textarea,
input.text-input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 1rem; background: var(--white); color: var(--ink); transition: .15s;
}
.field input:focus, .field textarea:focus, input.text-input:focus {
  outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft);
}
.field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.row2 .field { margin-bottom: 0; }

/* 單選 / 複選 */
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; background: var(--white);
  transition: .14s;
}
.choice:hover { border-color: var(--coral-soft); }
.choice input { accent-color: var(--coral); }
.choice.checked { border-color: var(--coral); background: #fffaf8; color: var(--coral-dark); font-weight: 500; }
.choice-other-input { margin-top: 8px; }

.invalid { border-color: #d9534f !important; box-shadow: 0 0 0 3px rgba(217, 83, 79, .15) !important; }
.error-text { color: #d9534f; font-size: .82rem; margin-top: 5px; }

/* 摘要 / 金額 */
.summary-box {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fffdfc; margin-bottom: 18px;
}
.summary-box .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .95rem; }
.summary-box .row.head { font-weight: 700; border-bottom: 1px dashed var(--line); margin-bottom: 6px; padding-bottom: 10px; }
.summary-box .ppl { font-size: .86rem; color: var(--muted); }

.discount-field { margin-bottom: 8px; }
.discount-row { display: flex; gap: 10px; }
.discount-row input { flex: 1; }
.discount-msg { font-size: .86rem; margin: 8px 0 0; min-height: 1.2em; }
.discount-msg.ok { color: var(--green); font-weight: 500; }
.discount-msg.err { color: #d9534f; }

.price-box {
  border: 2px solid var(--coral-soft); border-radius: var(--radius); padding: 18px 20px;
  background: #fffaf8; margin: 16px 0 20px;
}
.price-box .line { display: flex; justify-content: space-between; padding: 4px 0; }
.price-box .line.discount { color: var(--green); }
.price-box .line.total { font-size: 1.3rem; font-weight: 900; color: var(--coral-dark); border-top: 1px solid var(--coral-soft); margin-top: 8px; padding-top: 12px; }
.price-box .line.total .num::before { content: "NT$ "; font-size: .8rem; }

.agree { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: #5d534e; margin-bottom: 6px; cursor: pointer; }
.agree input { margin-top: 4px; accent-color: var(--coral); width: 18px; height: 18px; }

/* 完成頁 */
.done-box { text-align: center; padding: 10px; }
.done-icon { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; background: var(--green); display: grid; place-items: center; color: #fff; font-size: 2.2rem; }
.done-box h3 { font-size: 1.5rem; }
.done-id { display: inline-block; font-weight: 900; letter-spacing: 1px; background: var(--coral-soft); color: var(--coral-dark); padding: 4px 14px; border-radius: 999px; margin: 6px 0 18px; }
.pay-card { text-align: left; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fffdfc; margin: 18px 0; }
.pay-card h4 { margin: 0 0 12px; color: var(--coral-dark); }
.pay-card .pay-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.pay-card .pay-row:last-child { border-bottom: none; }
.pay-card .pay-amount { font-size: 1.4rem; font-weight: 900; color: var(--coral-dark); }
.line-cta { display: inline-flex; align-items: center; gap: 8px; background: #06c755; color: #fff; padding: 12px 24px; border-radius: 999px; font-weight: 700; margin-top: 6px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0; text-align: center; color: var(--muted); font-size: .9rem; background: #fbf4ef; }
.site-footer p { margin: 4px 0; }

/* ---------- Overlay ---------- */
.overlay { position: fixed; inset: 0; background: rgba(252, 247, 243, .85); display: grid; place-items: center; z-index: 100; gap: 14px; }
.overlay[hidden] { display: none; }
.overlay p { font-weight: 700; color: var(--coral-dark); }
.spinner { width: 44px; height: 44px; border: 4px solid var(--coral-soft); border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- RWD ---------- */
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; }
  .stepper .step { font-size: 0; }
  .stepper .step span { font-size: .9rem; }
  .plan-card { flex-wrap: wrap; }
  .plan-card .plan-price { width: 100%; text-align: left; }
  .plan-card .plan-price small { text-align: left; }
  .field.row2 { grid-template-columns: 1fr; gap: 16px; }
  .panel { padding: 20px; }
}
