/* =========================================================
   活動報到管理系統 — 切版原型共用樣式
   基本 Material Design 概念（搭配 Bootstrap 5）
   ⚠️ 原型用途，placeholder 假資料，不接後端
   ========================================================= */

:root {
  --md-primary: #1976d2;
  --md-primary-dark: #115293;
  --md-primary-light: #e3f0fc;
  --md-accent: #00897b;
  --md-bg: #f4f6f8;
  --md-surface: #ffffff;
  --md-text: #212121;
  --md-text-secondary: #5f6b76;
  --md-border: #e2e6ea;
  --md-success: #2e7d32;
  --md-warning: #ed6c02;
  --md-danger: #c62828;
  --md-radius: 10px;
  --md-shadow-1: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --md-shadow-2: 0 3px 8px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.06);
  --md-shadow-3: 0 8px 24px rgba(0,0,0,.16);
}

* { box-sizing: border-box; }

body {
  font-family: "Roboto", "Noto Sans TC", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--md-bg);
  color: var(--md-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top App Bar ---------- */
.app-bar {
  background: var(--md-primary);
  color: #fff;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--md-shadow-2);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.app-bar .brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-bar .brand .material-symbols-outlined { font-size: 24px; }
.app-bar .spacer { flex: 1; }
.app-bar .bar-actions { display: flex; align-items: center; gap: 14px; }
.app-bar .bar-actions a { color: #fff; text-decoration: none; opacity: .92; font-size: .9rem; }
.app-bar .bar-actions a:hover { opacity: 1; }
.app-bar .role-chip {
  background: rgba(255,255,255,.18);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .78rem;
}

/* ---------- Layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.page-narrow { max-width: 460px; }
.page-mid { max-width: 760px; }
.page-title { font-size: 1.4rem; font-weight: 600; margin: 4px 0 4px; }
.page-subtitle { color: var(--md-text-secondary); font-size: .9rem; margin-bottom: 22px; }
.section-label { font-size: .8rem; font-weight: 600; color: var(--md-text-secondary); text-transform: uppercase; letter-spacing: .6px; margin: 26px 0 10px; }

/* ---------- Card ---------- */
.md-card {
  background: var(--md-surface);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow-1);
  padding: 22px 24px;
  margin-bottom: 18px;
  border: 1px solid var(--md-border);
}
.md-card.flat { box-shadow: none; }
.md-card-header { font-weight: 600; font-size: 1.02rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.md-card-header .material-symbols-outlined { color: var(--md-primary); font-size: 22px; }

/* ---------- Buttons (Material-ish) ---------- */
.btn-md {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: box-shadow .15s, background .15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn-md .material-symbols-outlined { font-size: 19px; }
.btn-primary-md { background: var(--md-primary); color: #fff; box-shadow: var(--md-shadow-1); }
.btn-primary-md:hover { background: var(--md-primary-dark); box-shadow: var(--md-shadow-2); color:#fff; }
.btn-outline-md { background: #fff; color: var(--md-primary); border: 1px solid var(--md-primary); }
.btn-outline-md:hover { background: var(--md-primary-light); }
.btn-text-md { background: transparent; color: var(--md-primary); padding: 9px 12px; }
.btn-text-md:hover { background: var(--md-primary-light); }
.btn-danger-md { background: var(--md-danger); color: #fff; }
.btn-danger-md:hover { background: #9b1c1c; color:#fff; }
.btn-block-md { width: 100%; justify-content: center; }
.btn-lg-md { padding: 13px 22px; font-size: 1rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--md-text-secondary); margin-bottom: 6px; font-weight: 500; }
.field .req { color: var(--md-danger); }
.field .opt { color: var(--md-text-secondary); font-weight: 400; font-size: .72rem; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=tel], .field input[type=datetime-local], .field input[type=file],
.field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c8ced3;
  border-radius: 8px;
  font-size: .92rem;
  background: #fff;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(25,118,210,.14);
}
.field .hint { font-size: .76rem; color: var(--md-text-secondary); margin-top: 5px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .field { flex: 1; min-width: 180px; }

/* ---------- Chips / Status ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 16px; padding: 3px 11px; font-size: .78rem; font-weight: 500; }
.chip .material-symbols-outlined { font-size: 15px; }
.chip-success { background: #e6f4ea; color: var(--md-success); }
.chip-muted { background: #eceff1; color: #607d8b; }
.chip-warning { background: #fff3e0; color: var(--md-warning); }
.chip-info { background: var(--md-primary-light); color: var(--md-primary-dark); }

/* ---------- Tables ---------- */
table.md-table { width: 100%; border-collapse: collapse; background: #fff; }
table.md-table thead th {
  text-align: left; font-size: .78rem; color: var(--md-text-secondary);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
  padding: 12px 14px; border-bottom: 2px solid var(--md-border); white-space: nowrap;
}
table.md-table tbody td { padding: 12px 14px; border-bottom: 1px solid #eef1f3; font-size: .9rem; }
table.md-table tbody tr:hover { background: #fafbfc; }

/* ---------- QR / scanner ---------- */
.qr-frame {
  width: 230px; height: 230px; margin: 0 auto;
  border-radius: 14px; background: #fff; border: 1px solid var(--md-border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--md-shadow-1);
}
.qr-frame .qr-mock {
  width: 190px; height: 190px;
  background-image:
    linear-gradient(45deg,#222 25%,transparent 25%,transparent 75%,#222 75%),
    linear-gradient(45deg,#222 25%,transparent 25%,transparent 75%,#222 75%);
  background-size: 20px 20px; background-position: 0 0,10px 10px;
  border: 8px solid #fff; outline: 3px solid #222;
}
.scanner-viewport {
  position: relative; width: 100%; max-width: 360px; aspect-ratio: 3/4; margin: 0 auto;
  background: #11181f; border-radius: 16px; overflow: hidden; display: flex;
  align-items: center; justify-content: center; color: #9fb0bd;
}
.scanner-viewport .reticle {
  position: absolute; width: 62%; aspect-ratio: 1; border-radius: 18px;
  box-shadow: 0 0 0 4000px rgba(0,0,0,.35); border: 3px solid rgba(255,255,255,.85);
}
.scanner-viewport .scan-line { position: absolute; width: 62%; height: 2px; background: #4fc3f7; box-shadow: 0 0 8px #4fc3f7; }
.scanner-hint { text-align: center; color: var(--md-text-secondary); font-size: .85rem; margin-top: 12px; }

/* ---------- Misc ---------- */
.placeholder-img {
  background: repeating-linear-gradient(45deg,#eef1f3,#eef1f3 12px,#e6eaed 12px,#e6eaed 24px);
  border: 1px dashed #b8c1c9; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #8a97a2; font-size: .85rem; text-align: center;
}
.muted { color: var(--md-text-secondary); }
.divider { height: 1px; background: var(--md-border); margin: 18px 0; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* prototype banner */
.proto-banner {
  background: #fff8e1; border: 1px solid #ffe082; color: #8a6d00;
  font-size: .8rem; padding: 7px 16px; text-align: center;
}

/* big tap buttons (參加者/工讀生 行動裝置) */
.tap-grid { display: grid; gap: 14px; }
.tap-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 16px; border-radius: 14px; background: #fff;
  border: 1px solid var(--md-border); box-shadow: var(--md-shadow-1);
  color: var(--md-text); text-decoration: none; font-weight: 500;
}
.tap-btn .material-symbols-outlined { font-size: 38px; color: var(--md-primary); }
.tap-btn:hover { box-shadow: var(--md-shadow-2); }

/* ---------- 參加者端：三 block 版型（banner / 中段 / 活動說明圖）---------- */
.participant-page {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 14px 0 28px;
}
/* 每個 block 寬度完整貼合 95%、無 card、無圓角 */
.pblock { width: 95%; }
.pblock-banner { aspect-ratio: 16 / 7; }      /* 上方 banner 圖 */
.pblock-desc { aspect-ratio: 16 / 9; }         /* 下方活動說明圖 */
.pblock .placeholder-img { width: 100%; height: 100%; border-radius: 0; }
.participant-page .scanner-viewport { max-width: 100%; width: 100%; border-radius: 0; }

/* 我的 QR：每位一張 QR（本人 / 眷屬1 / 眷屬2）— 左 QR + 右三行；非 card、無圓角 */
.qr-row {
  width: 95%; display: flex; gap: 16px; align-items: center;
  background: transparent; border: none; border-radius: 0;
  padding: 10px 0; box-shadow: none;
}
.participant-page .qr-row + .qr-row { border-top: 1px solid var(--md-border); }
.qr-row .qrbox {
  flex: 0 0 auto; width: 108px; height: 108px; border-radius: 0;
  background: #fff; border: 1px solid var(--md-border);
  display: flex; align-items: center; justify-content: center;
}
.qr-row .qrbox .qr-mock { width: 92px; height: 92px; outline-width: 2px; border-width: 5px; }
.qr-row .qr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.qr-row .qr-info .line-meta { font-size: .78rem; color: var(--md-text-secondary); }
.qr-row .qr-info .line-name { font-size: 1.05rem; font-weight: 700; }

/* family list rows (toggle) */
.member-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--md-border); border-radius: 12px;
  margin-bottom: 10px; background: #fff;
}
.member-row .who { display: flex; align-items: center; gap: 12px; }
.member-row .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--md-primary-light);
  color: var(--md-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.member-row .name { font-weight: 600; }
.member-row .sub { font-size: .78rem; color: var(--md-text-secondary); }
