/* ===================================================================
   REGAL SHOP — 尊榮黑金 design system (v2)
   炭黑背景 + 金色鑲邊，簽名視覺：金框卡片頂部的菱形封印標記
   =================================================================== */

:root {
  --bg-void: #080706;
  --bg-surface: #15130e;
  --bg-surface-raised: #1d1a13;
  --gold: #c9a961;
  --gold-bright: #eecf8a;
  --gold-dim: #8a6f3f;
  --bronze: #6b5228;
  --cream: #f3ecdc;
  --muted: #a89c88;
  --muted-dim: #6e6455;
  --success: #5fb987;
  --danger: #d47272;
  --border-hairline: rgba(201, 169, 97, 0.2);
  --border-hairline-strong: rgba(201, 169, 97, 0.4);

  --gold-foil: linear-gradient(135deg, var(--bronze) 0%, var(--gold) 45%, var(--gold-bright) 55%, var(--gold) 65%, var(--bronze) 100%);

  --font-display: "Noto Serif TC", serif;
  --font-body: "Noto Sans TC", sans-serif;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg-void);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(201, 169, 97, 0.10), transparent 60%),
    radial-gradient(ellipse 70% 40% at 100% 100%, rgba(201, 169, 97, 0.05), transparent 60%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { animation: fadeSlideIn 0.45s ease both; }

/* === 頂部品牌列 === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-hairline);
  background: linear-gradient(180deg, rgba(201, 169, 97, 0.06), transparent);
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 5px; height: 5px;
  background: var(--gold);
  box-shadow: 0 0 6px rgba(238, 207, 138, 0.6);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.topbar .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 1.5px;
  background: var(--gold-foil);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar .brand-mark span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--gold-bright);
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.topbar .sub {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface-raised);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  font-size: 16px;
}
.icon-btn:hover { border-color: var(--gold); transform: translateY(-1px); }

/* === 版面容器 === */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

/* === Hero（商城首頁用） === */
.hero {
  text-align: center;
  padding: 12px 8px 32px;
}
.hero .hero-crest {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  padding: 2px;
  background: var(--gold-foil);
  display: flex; align-items: center; justify-content: center;
}
.hero .hero-crest span {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px; color: var(--gold-bright);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.35;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}
.hero p.tagline {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  letter-spacing: 0.03em;
}

/* === 金框卡片：本站的簽名視覺元素 === */
.gold-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1.5px;
  background: var(--gold-foil);
  margin-bottom: 16px;
}
.gold-card::before {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 7px; height: 7px;
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(238, 207, 138, 0.55);
  z-index: 2;
}
.gold-card > .inner {
  background: var(--bg-surface);
  border-radius: calc(var(--radius-lg) - 1.5px);
  padding: 22px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
  font-weight: 600;
}

h2.section-title {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 0 0 16px;
  color: var(--cream);
  letter-spacing: 0.01em;
}

/* === 商品分類：卡片式方格 === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.category-tile {
  padding: 18px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
  text-align: center;
}
.category-tile:hover { border-color: var(--gold); transform: translateY(-3px); }
.category-tile .cat-icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: rgba(201, 169, 97, 0.08);
  border: 1px solid var(--border-hairline);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.category-tile .cat-name {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.category-tile .cat-count {
  font-size: 11px;
  color: var(--muted);
}

/* 舊版清單樣式（後台等處沿用） */
.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.category-row:hover { border-color: var(--gold); }
.category-row .left { display: flex; align-items: center; gap: 12px; }
.category-row .count {
  font-size: 12px;
  color: var(--bg-void);
  background: var(--gold);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
}

/* === 商品卡片 === */
.product-card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  margin-bottom: 12px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.product-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold-foil);
  opacity: 0;
  transition: opacity 0.18s ease;
}
a.product-card:hover {
  border-color: var(--border-hairline-strong);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.5);
}
a.product-card:hover::before { opacity: 1; }
.product-card h3 {
  font-size: 15.5px;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.product-card p.desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
}
.product-card .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.price-tag {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 16.5px;
  letter-spacing: 0.01em;
}
.tag {
  font-size: 11px;
  padding: 3.5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tag.auto { color: var(--success); border-color: rgba(95, 185, 135, 0.35); }

/* === 表單元件 === */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface-raised);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
input::placeholder, textarea::placeholder { color: var(--muted-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
  letter-spacing: 0.01em;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.btn-primary {
  background: var(--gold-foil);
  color: var(--bg-void);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-hairline);
  color: var(--cream);
  font-weight: 600;
}
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger {
  background: var(--danger);
  color: #1a0a0a;
}

/* === 錢包餘額顯示 === */
.balance-display {
  text-align: center;
  padding: 30px 0 22px;
  position: relative;
}
.balance-display .label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.balance-display .amount {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  color: var(--gold-bright);
  margin: 8px 0;
  letter-spacing: 0.01em;
}

/* === 表格 (後台用) === */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--border-hairline);
}
th { color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: 0.02em; text-transform: uppercase; }
tr:hover td { background: rgba(201, 169, 97, 0.03); }

.status-pill {
  display: inline-block;
  padding: 2.5px 11px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-hairline);
  letter-spacing: 0.02em;
}
.status-pending { color: #d4b872; }
.status-paid { color: #7ec4e0; }
.status-completed { color: var(--success); }
.status-cancelled { color: var(--danger); }

/* === 提示訊息 === */
.alert {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-error { background: rgba(212, 114, 114, 0.1); border: 1px solid rgba(212, 114, 114, 0.3); color: #e6a3a3; }
.alert-success { background: rgba(95, 185, 135, 0.1); border: 1px solid rgba(95, 185, 135, 0.3); color: var(--success); }

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted-dim);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.divider-gold {
  height: 1px;
  background: var(--gold-foil);
  opacity: 0.4;
  border: none;
  margin: 22px 0;
}

.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
