/* ===========================================================================
   GenZ Shop — Design System (ดึงธีมจริงจาก genzxshop.sync-x.xyz)
   ธีมมืด: พื้นดำ #000 · ตัวอักษรขาว · สีหลัก/ราคา/แบดจ์ แดง #e60039
   ฟอนต์ LINE Seed Sans TH
   =========================================================================== */
@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('/assets/fonts/LINESeedSansTH_W_Rg.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('/assets/fonts/LINESeedSansTH_W_Bd.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --accent: #e60039;          /* สีแบรนด์ แดง (ราคา/แบดจ์/ปุ่มหลัก) */
  --accent-rgb: 230, 0, 57;
  --accent-hover: #c70032;
  --accent-soft: rgba(230, 0, 57, .14);
  --primary: #e60039;
  --bg: #000000;              /* พื้นหลังดำ */
  --bg2: #0a0a0a;
  --card: #0a0a0a;            /* การ์ดดำ */
  --surface: #1f1f1f;
  --surface-hover: #252525;
  --text: #f5f5f5;
  --muted-fg: #a3a3a3;
  --subtle: #737373;
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .18);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, .15);
  --amber: #f59e0b;
  --radius: 12px;
  --radius-lg: 12px;
  --radius-2xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  font-family: 'LINE Seed Sans TH', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted-fg); }
.center { text-align: center; }
.hide { display: none !important; }
.grad-text {
  background: linear-gradient(90deg, var(--accent), #ff5d7d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav .container { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: #fff; }
.brand .logo {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--accent); color: #fff; border-radius: 10px; font-size: 19px;
}
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav-links a { padding: 8px 13px; border-radius: var(--radius); color: var(--muted-fg); font-weight: 600; font-size: 15px; }
.nav-links a:hover, .nav-links a.active { color: #fff; background: var(--surface); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.wallet-chip {
  display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb), .35); font-weight: 700; color: #ff7a98;
}
.wallet-chip b { color: #ff7a98; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px;
  cursor: pointer; transition: transform .06s ease, filter .15s ease, background .15s ease, border-color .15s;
  font-family: inherit;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-accent { background: #fff; border-color: #fff; color: #000; }
.btn-accent:hover { filter: brightness(.92); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--red-soft); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, .25); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
}
.section-title { font-size: 21px; font-weight: 700; margin: 30px 0 16px; display: flex; align-items: center; gap: 10px; color: #fff; }
.section-title .bar { width: 4px; height: 22px; border-radius: 6px; background: var(--accent); }

/* ---------- Hero banner (รูปจริงจากร้าน) ---------- */
.hero-banner {
  margin-top: 24px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); line-height: 0; background: var(--surface);
}
.hero-banner img { width: 100%; height: auto; display: block; aspect-ratio: 1920 / 1080; object-fit: cover; }
.hero-actions { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-badges { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  padding: 6px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted-fg);
}
/* hero แบบข้อความ (เผื่อใช้) */
.hero {
  margin-top: 24px; border-radius: var(--radius-lg); position: relative; overflow: hidden;
  background: radial-gradient(600px 300px at 85% 10%, rgba(var(--accent-rgb), .25), transparent 60%), #0a0a0a;
  border: 1px solid var(--border); padding: 42px 34px;
}
.hero h1 { font-size: 38px; font-weight: 700; line-height: 1.15; color: #fff; }
.hero p { color: var(--muted-fg); margin-top: 12px; font-size: 17px; max-width: 560px; }
.hero .hero-actions { margin-top: 22px; }

/* ---------- Announcement ---------- */
.announce {
  margin-top: 16px; padding: 12px 18px; border-radius: var(--radius); display: flex; gap: 10px; align-items: center;
  background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb), .3); color: #ff7a98; font-weight: 600;
}

/* ---------- Stats strip ---------- */
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.stat-box { text-align: center; padding: 18px; }
.stat-box .num { font-size: 25px; font-weight: 700; color: #fff; }
.stat-box .lbl { color: var(--muted-fg); font-size: 13px; margin-top: 4px; }

/* ---------- Category pills ---------- */
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-pill {
  padding: 9px 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 7px; transition: .15s; font-size: 14px; color: var(--text);
}
.cat-pill:hover { border-color: var(--accent); color: #fff; }
.cat-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-pill.active .muted { color: rgba(255, 255, 255, .85); }

/* ---------- Product grid (5 คอลัมน์ตามต้นฉบับ) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.product {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; transition: transform .3s ease, box-shadow .2s ease, border-color .2s;
  display: flex; flex-direction: column;
}
.product:hover { transform: scale(1.02); box-shadow: var(--shadow); border-color: rgba(var(--accent-rgb), .5); }
.product .thumb {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; font-size: 56px; overflow: hidden;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), #141414);
}
.product .thumb img { height: 100%; width: 100%; object-fit: cover; transition: transform .5s ease; }
.product:hover .thumb img { transform: scale(1.05); }
.pbadges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; z-index: 2; pointer-events: none; }
.pbadge { padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; backdrop-filter: blur(8px); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.pbadge.pop { background: rgba(var(--accent-rgb), .92); color: #fff; }
.pbadge.stock { background: rgba(0, 0, 0, .55); color: #86efac; border: 1px solid rgba(255, 255, 255, .15); }
.pbadge.out { background: rgba(0, 0, 0, .7); color: #fca5a5; border: 1px solid rgba(255, 255, 255, .12); }
.product .body { padding: 13px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product .name { font-weight: 700; font-size: 14px; min-height: 40px; color: #fff; line-height: 1.4; }
.product .meta { display: flex; justify-content: space-between; align-items: center; }
.product .price { font-size: 18px; font-weight: 700; color: var(--accent); }
.product .buycta { width: 100%; margin-top: 2px; border-radius: var(--radius-lg); }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.tag-stock { background: var(--green-soft); color: #86efac; }
.tag-out { background: var(--red-soft); color: #fca5a5; }
.tag-type { background: var(--accent-soft); color: #ff7a98; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input, select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius); font-size: 15px; font-family: inherit;
  background: #141414; border: 1px solid var(--border); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25); }
textarea { resize: vertical; min-height: 90px; }
select option { background: #141414; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 30px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 25px; font-weight: 700; margin-bottom: 6px; color: #fff; }
.auth-switch { text-align: center; margin-top: 16px; color: var(--muted-fg); }
.auth-switch a { color: #ff7a98; font-weight: 700; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 100;
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px);
}
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); border-radius: var(--radius-2xl); }
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 14px; color: #fff; }
.modal-close { float: right; cursor: pointer; font-size: 22px; color: var(--muted-fg); background: none; border: 0; line-height: 1; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: var(--radius); font-weight: 600; box-shadow: var(--shadow-lg);
  background: #141414; border: 1px solid var(--border); min-width: 240px; animation: slideIn .25s ease; color: var(--text);
}
.toast.ok { border-left: 4px solid var(--green); }
.toast.err { border-left: 4px solid var(--red); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; white-space: nowrap; }
thead th { background: #141414; color: var(--muted-fg); font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); }
tbody tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: rgba(255, 255, 255, .03); }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.completed, .pill.success, .pill.active { background: var(--green-soft); color: #86efac; }
.pill.pending { background: rgba(245, 158, 11, .15); color: #fcd34d; }
.pill.failed, .pill.banned { background: var(--red-soft); color: #fca5a5; }
.pill.admin { background: var(--accent-soft); color: #ff7a98; }
.pill.member { background: var(--surface); color: var(--muted-fg); }

/* ---------- Footer ---------- */
.footer { margin-top: 60px; padding: 30px 0; border-top: 1px solid var(--border); color: var(--muted-fg); }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; }

/* ---------- Code box ---------- */
.codebox {
  background: #141414; border: 1px dashed var(--accent); border-radius: var(--radius); padding: 13px;
  font-family: 'Consolas', monospace; font-size: 14px; word-break: break-all; color: #ff9db3;
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}

/* ---------- Dashboard layout ---------- */
.dash { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: #0a0a0a; border-right: 1px solid var(--border); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { margin-bottom: 22px; padding: 0 8px; }
.side a {
  display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: var(--radius);
  color: var(--muted-fg); font-weight: 600; margin-bottom: 3px; font-size: 15px;
}
.side a:hover { background: var(--surface); color: #fff; }
.side a.active { background: var(--accent-soft); color: #ff7a98; }
.side .sep { height: 1px; background: var(--border); margin: 12px 6px; }
.main { padding: 26px 30px; overflow-x: hidden; background: #000; min-height: 100vh; }
.main-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.main-head h1 { font-size: 25px; font-weight: 700; color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { padding: 18px 20px; }
.kpi .k-lbl { color: var(--muted-fg); font-size: 14px; }
.kpi .k-num { font-size: 26px; font-weight: 700; margin-top: 6px; color: #fff; }
.kpi .k-ico { font-size: 22px; float: right; opacity: .9; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }

/* ---------- Spinner / empty ---------- */
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted-fg); padding: 50px 20px; }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .nav-links { display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column;
    background: #0a0a0a; padding: 12px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-right .hide-sm { display: none; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 29px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; width: 248px; left: -268px; transition: left .2s; box-shadow: var(--shadow-lg); }
  .side.open { left: 0; }
  .main { padding: 18px; }
  #dash-toggle { display: inline-flex !important; }
  .toolbar input, .toolbar select { min-width: 140px; flex: 1; }
}
