/* ============================================================
   Joy Selection — 活動網站樣式表
   設計：橘色系 + 奶油白，手機優先
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── CSS 變數 ─────────────────────────────────────────────── */
:root {
  --orange:        #CF5F28;
  --orange-dark:   #9E3D10;
  --orange-light:  #E8936A;
  --orange-pale:   #FAEADC;
  --peach:         #F5C08A;
  --cream:         #FAF0E8;
  --cream-dark:    #EDD8C4;
  --brown:         #5C2E0A;
  --text:          #3D1A0A;
  --text-mid:      #7A3A1A;
  --text-light:    #B06040;
  --white:         #FFFFFF;
  --shadow-sm:     0 2px 10px rgba(180, 80, 30, 0.12);
  --shadow-md:     0 6px 24px rgba(180, 80, 30, 0.18);
  --radius:        16px;
  --radius-pill:   50px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
}

body {
  font-family: 'Nunito', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--cream);
  min-height: 100vh;
  overscroll-behavior-y: none;
}

/* ── 頁面包裹 ─────────────────────────────────────────────── */
.page {
  min-height: 100vh;
  background-color: var(--cream);
  background-image: url('/assets/images/2-BG.png');
  background-size: 100% auto;
  background-position: top center;
  background-repeat: no-repeat;
}

/* 首頁用特殊背景 */
.page-home {
  background-image: url('/assets/images/1-BG.png');
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── 頁面 Header（內頁用）────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  max-width: 480px;
  margin: 0 auto;
}

.page-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--white);
  border: 2px solid var(--orange-pale);
  border-radius: 50%;
  color: var(--orange);
  text-decoration: none;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.page-back:active { transform: scale(0.92); }

.page-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--orange-dark);
  font-family: 'Nunito', sans-serif;
}

/* ── 首頁 ─────────────────────────────────────────────────── */
.home-hero {
  /* 預留空間給 1-BG.png 上半部的 Logo 區域                  */
  /* 圖片比例約 820:1800，Logo 約佔圖高 42%                   */
  padding-top: min(88vw, 424px);
}

.home-modules {
  padding: 0 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 2px solid var(--orange-pale);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.module-card:active {
  transform: scale(0.97);
  box-shadow: none;
}

.module-card--blessing {
  border-color: var(--peach);
  background: linear-gradient(135deg, var(--white) 60%, var(--orange-pale));
}

.module-icon {
  font-size: 34px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-pale);
  border-radius: 14px;
  flex-shrink: 0;
}

.module-card--blessing .module-icon {
  background: var(--peach);
}

.module-info { flex: 1; }

.module-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--orange-dark);
  display: block;
  font-family: 'Nunito', sans-serif;
}

.module-desc {
  font-size: 13px;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
  line-height: 1.4;
}

.module-arrow {
  color: var(--orange-light);
  font-size: 24px;
  font-weight: 700;
}

/* ── 內頁內容區 ───────────────────────────────────────────── */
.content {
  padding: 4px 20px 48px;
  max-width: 480px;
  margin: 0 auto;
}

/* ── 卡片 ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--orange-pale);
}

.card + .card { margin-top: 16px; }

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--orange-dark);
  margin-bottom: 16px;
  font-family: 'Nunito', sans-serif;
}

/* ── 表單 ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.required { color: var(--orange); margin-left: 3px; }

.optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--cream-dark);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;      /* ← 16px 防止 iOS 自動縮放 */
  color: var(--text);
  background: var(--cream);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--orange);
  background: var(--white);
}

.form-textarea {
  resize: none;
  min-height: 96px;
  line-height: 1.6;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.5;
}

/* Checkbox Row */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-row label {
  font-size: 14px;
  color: var(--text-mid);
  cursor: pointer;
  line-height: 1.4;
}

/* ── 按鈕 ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 28px;
  border-radius: var(--radius-pill);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, opacity 0.15s, background 0.2s;
  text-decoration: none;
  width: 100%;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--orange);
  color: var(--white);
}

.btn-primary:active { background: var(--orange-dark); }

.btn-secondary {
  background: var(--white);
  color: var(--orange);
  border: 2.5px solid var(--orange);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border: 2px solid var(--cream-dark);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 14px;
  width: auto;
}

.btn + .btn { margin-top: 12px; }

/* ── 搜尋列 ───────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
}

.search-bar .form-input { flex: 1; }

.search-bar .btn {
  width: auto;
  padding: 14px 20px;
  flex-shrink: 0;
}

/* ── 訊息提示 ─────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-success {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1.5px solid #A5D6A7;
}

.alert-error {
  background: #FEEFEF;
  color: #B71C1C;
  border: 1.5px solid #FFCDD2;
}

.alert-info {
  background: var(--orange-pale);
  color: var(--orange-dark);
  border: 1.5px solid var(--peach);
}

/* ── Find Your Seat ───────────────────────────────────────── */
.seat-result {
  text-align: center;
  padding: 28px 16px 20px;
}

.seat-table-badge {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  border-radius: 20px;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.seat-table-number {
  font-size: 88px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
  font-family: 'Nunito', sans-serif;
}

.seat-table-label {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-mid);
  margin-top: 2px;
}

.seat-name {
  font-size: 15px;
  color: var(--text-light);
  margin-top: 10px;
}

.seat-map-wrap {
  margin-top: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--orange-pale);
}

.seat-map-img {
  width: 100%;
  display: block;
}

.seat-map-placeholder {
  background: var(--orange-pale);
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 700;
  padding: 32px 20px;
  text-align: center;
  border-radius: var(--radius);
}

.not-found-guide {
  text-align: center;
  padding: 24px 16px;
}

.not-found-guide .emoji { font-size: 48px; display: block; margin-bottom: 12px; }
.not-found-guide p { font-size: 15px; color: var(--text-light); line-height: 1.7; }

/* ── The Book ─────────────────────────────────────────────── */
.book-intro {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 24px;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cream-dark);
}

/* Profile Card */
.profile-code-wrap {
  text-align: center;
  margin-bottom: 20px;
}

.profile-code {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-size: 42px;
  font-weight: 900;
  padding: 8px 28px;
  border-radius: var(--radius-pill);
  font-family: 'Nunito', sans-serif;
  letter-spacing: 8px;
}

.profile-field {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cream-dark);
  align-items: flex-start;
}

.profile-field:last-child { border-bottom: none; }

.profile-field-icon {
  font-size: 22px;
  width: 30px;
  flex-shrink: 0;
  text-align: center;
}

.profile-field-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 3px;
}

.profile-field-value {
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

/* Registration Success */
.code-reveal {
  text-align: center;
  padding: 28px 16px 20px;
}

.code-big {
  font-size: 88px;
  font-weight: 900;
  color: var(--orange);
  font-family: 'Nunito', sans-serif;
  line-height: 1;
  letter-spacing: 10px;
}

.code-reveal-label {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ── Checker Strip 裝飾條 ─────────────────────────────────── */
.checker-strip {
  height: 14px;
  background:
    repeating-conic-gradient(var(--orange) 0% 25%, var(--white) 0% 50%)
    0 0 / 14px 14px;
  margin: 20px 0;
}

/* ── Blessing Receipt 收據 ────────────────────────────────── */
.receipt-wrap {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--orange-pale);
}

.receipt-top {
  background: var(--orange);
  padding: 28px 24px 20px;
  text-align: center;
  color: var(--white);
}

.receipt-top h1 {
  font-size: 24px;
  font-weight: 900;
  font-family: 'Nunito', sans-serif;
}

.receipt-no {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-top: 6px;
  opacity: 0.9;
}

.receipt-checker {
  height: 12px;
  background:
    repeating-conic-gradient(var(--orange-dark) 0% 25%, var(--orange-light) 0% 50%)
    0 0 / 12px 12px;
}

.receipt-body { padding: 20px 20px 0; }

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed var(--cream-dark);
}

.receipt-row:last-child { border-bottom: none; }

.receipt-label {
  font-size: 13px;
  color: var(--text-light);
  flex-shrink: 0;
  margin-right: 12px;
}

.receipt-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.receipt-message-box {
  background: var(--orange-pale);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
  font-size: 15px;
  color: var(--brown);
  line-height: 1.8;
  text-align: center;
  font-style: italic;
  word-break: break-all;
}

.receipt-quote-mark {
  font-size: 28px;
  color: var(--orange-light);
  line-height: 0.5;
  display: block;
}

.receipt-footer {
  background: var(--cream);
  padding: 14px 20px 18px;
  text-align: center;
  border-top: 1px solid var(--cream-dark);
}

.receipt-brand {
  font-size: 16px;
  font-weight: 900;
  color: var(--orange);
  font-family: 'Nunito', sans-serif;
}

.receipt-footer-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

.screenshot-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

/* ── 後台 Admin ───────────────────────────────────────────── */
.admin-page {
  background: var(--cream);
  min-height: 100vh;
}

.admin-header {
  background: var(--orange-dark);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  font-size: 18px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
}

.admin-body {
  padding: 20px 24px 40px;
  max-width: 1000px;
  margin: 0 auto;
}

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--orange-pale);
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.stat-number {
  font-size: 32px;
  font-weight: 900;
  color: var(--orange);
  font-family: 'Nunito', sans-serif;
  display: block;
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.admin-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--orange-pale);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.admin-table th {
  background: var(--orange);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--cream-dark);
  vertical-align: top;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td { background: var(--orange-pale); }

.admin-msg-text {
  max-width: 240px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text-mid);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-paid    { background: #E8F5E9; color: #2E7D32; }
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-yes     { background: var(--orange-pale); color: var(--orange-dark); }
.badge-no      { background: var(--cream-dark); color: var(--text-light); }

/* Toggle Deliver Button */
.btn-deliver {
  background: transparent;
  border: 1.5px solid var(--cream-dark);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-deliver:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-deliver.delivered {
  background: var(--orange-pale);
  border-color: var(--orange);
  color: var(--orange-dark);
}

/* ── 工具 Utilities ───────────────────────────────────────── */
.text-center  { text-align: center; }
.text-orange  { color: var(--orange); }
.text-light   { color: var(--text-light); }
.font-bold    { font-weight: 700; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }

.divider {
  border: none;
  border-top: 1px solid var(--cream-dark);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
}

.empty-state p {
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.7;
}

/* ── 大螢幕置中 ───────────────────────────────────────────── */
@media (min-width: 480px) {
  .page {
    background-size: 480px auto;
  }
}
