@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #fdf5f8;
  --white: #ffffff;
  --line: #fce4ed;
  --line2: #f9c3d8;
  --text: #2a1520;
  --muted: #9a7080;
  --pink: #e8348c;
  --pink-h: #d01e7a;
  --pink-light: #ff6eb5;
  --pink-bg: #fff0f7;
  --pink-glow: rgba(232,52,140,.12);
  --yellow: #ffc233;
  --green: #1db56a;
  --red: #e03040;
  font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1,h2,h3,p { margin: 0; }
button,input,select,textarea { font: inherit; }
a { text-decoration: none; }

/* ── NAVBAR ── */
.navbar {
  position: sticky; top: 0; z-index: 200;
  height: 54px;
  background: var(--white);
  border-bottom: 1.5px solid var(--line);
  display: flex; align-items: center;
  padding: 0 20px; gap: 20px;
}

.nav-logo {
  display: flex; align-items: center; gap: 9px;
  color: var(--pink); font-weight: 900; font-size: 16px;
  flex-shrink: 0;
}
.nav-logo-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink) 0%, #b0186b 100%);
  color: #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 14px;
  box-shadow: 0 2px 8px var(--pink-glow);
}

.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  height: 36px; padding: 0 14px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.nav-link:hover, .nav-link.active { color: var(--pink); background: var(--pink-bg); }

.nav-search {
  flex: 1; max-width: 280px; margin-left: auto;
  position: relative;
}
.nav-search input {
  width: 100%; height: 36px;
  border: 1.5px solid var(--line2); border-radius: 18px;
  background: var(--bg); color: var(--text);
  padding: 0 16px 0 36px; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.nav-search input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-glow); }
.nav-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}

.nav-actions { display: flex; align-items: center; gap: 8px; }
.btn-login {
  height: 36px; padding: 0 16px; border-radius: 8px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-login:hover { border-color: var(--pink); color: var(--pink); }

.btn-register {
  height: 36px; padding: 0 18px; border-radius: 8px;
  border: none; background: var(--pink);
  color: #fff; font-size: 13px; font-weight: 800; cursor: pointer;
  box-shadow: 0 2px 10px var(--pink-glow); transition: all .15s;
}
.btn-register:hover { background: var(--pink-h); transform: translateY(-1px); }

.nav-wallet {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 18px;
  border: 1.5px solid var(--line2); background: var(--bg);
  font-size: 13px;
}
.nav-wallet span { color: var(--muted); font-size: 11px; }
.nav-wallet strong { color: var(--pink); font-weight: 800; }

/* ── PAGE WRAPPER ── */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 16px 60px; }

/* ── HERO BANNER ── */
.hero {
  border-radius: 20px; overflow: hidden;
  height: 260px; margin-bottom: 28px; position: relative;
  background: linear-gradient(135deg, #ffd6e8 0%, #ffb3d0 40%, #ffe4f2 100%);
  display: flex; align-items: center; justify-content: center;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 15% 50%, rgba(255,255,255,.65) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 30%, rgba(255,180,210,.8) 0%, transparent 45%);
}
.hero-body { position: relative; z-index: 1; text-align: center; }
.hero-title {
  font-size: 58px; font-weight: 900; line-height: 1;
  color: var(--pink);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 rgba(232,52,140,.15);
  letter-spacing: -1px;
}
.hero-sub {
  margin-top: 12px; display: inline-block;
  background: rgba(255,255,255,.85); border-radius: 20px;
  padding: 7px 22px; font-size: 15px; font-weight: 700; color: #a02060;
}

/* ── STATS ROW ── */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 6px var(--pink-glow);
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 900; color: var(--pink); line-height: 1.1; margin-top: 2px; }
.stat-unit  { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-icon  {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--pink-bg); border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 22px;
}

/* ── SECTION HEADER ── */
.section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-hd h2 { font-size: 17px; font-weight: 800; }
.btn-more {
  display: flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-more:hover { border-color: var(--pink); color: var(--pink); }

/* ── CATEGORY GRID (peachyy style) ── */
.cat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin-bottom: 32px;
}
.cat-card {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 18px; overflow: hidden; cursor: pointer;
  transition: box-shadow .2s, border-color .2s, transform .2s;
  box-shadow: 0 2px 10px rgba(232,52,140,.07);
}
.cat-card:hover {
  border-color: var(--pink-light);
  box-shadow: 0 6px 24px rgba(232,52,140,.15);
  transform: translateY(-2px);
}
.cat-card.selected { border-color: var(--pink); border-width: 2px; }

.cat-img {
  width: 100%; aspect-ratio: 16/6.5;
  object-fit: cover; display: block;
  background: linear-gradient(135deg, var(--pink-bg) 0%, #ffe8f2 100%);
}
.cat-img-placeholder {
  width: 100%; aspect-ratio: 16/6.5;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #ffd6e8 0%, #ffe8f0 100%);
  font-size: 48px;
}

.cat-body {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; gap: 10px;
}
.cat-info h3 { font-size: 15px; font-weight: 800; }
.cat-info p  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn-cat {
  flex-shrink: 0; height: 36px; padding: 0 16px; border-radius: 8px;
  border: none; background: var(--pink); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.btn-cat:hover { background: var(--pink-h); }

/* ── PRODUCT SECTION ── */
.product-section { margin-bottom: 32px; }

.product-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding: 14px 18px;
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 14px;
}
.product-section-hd h3 { font-size: 16px; font-weight: 800; }
.cat-back {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.cat-back:hover { border-color: var(--pink); color: var(--pink); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 18px; overflow: hidden;
  transition: all .2s; box-shadow: 0 1px 8px rgba(232,52,140,.06);
}
.product-card:hover {
  border-color: var(--pink-light);
  box-shadow: 0 6px 20px rgba(232,52,140,.13);
  transform: translateY(-3px);
}

.product-img {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; display: block;
  background: var(--pink-bg);
}

.product-body { padding: 13px 14px; }
.product-cat  { font-size: 11px; color: var(--pink); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.product-name { font-size: 14px; font-weight: 700; margin: 4px 0 6px; line-height: 1.35; }
.product-desc {
  font-size: 12px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 36px;
}
.product-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}
.product-price { font-size: 18px; font-weight: 900; color: var(--pink); }
.product-stock {
  font-size: 11px; color: var(--muted);
  background: var(--pink-bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 2px 8px;
}

.btn-buy {
  width: 100%; height: 40px; margin-top: 10px;
  border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--pink) 0%, #b5166a 100%);
  color: #fff; font-size: 13px; font-weight: 800; cursor: pointer;
  transition: all .15s;
  box-shadow: 0 2px 10px var(--pink-glow);
}
.btn-buy:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--pink-light) 0%, var(--pink) 100%);
  transform: translateY(-1px);
}
.btn-buy:disabled {
  background: #eee; color: var(--muted); cursor: not-allowed; box-shadow: none;
}

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-tab {
  height: 34px; padding: 0 14px; border-radius: 20px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.cat-tab:hover { border-color: var(--pink-light); color: var(--pink); }
.cat-tab.active { background: var(--pink); border-color: var(--pink); color: #fff; }

/* ── ORDERS ── */
.orders-list { display: grid; gap: 10px; }
.order-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 14px;
  transition: border-color .15s;
}
.order-card:hover { border-color: var(--pink-light); }
.order-id   { font-size: 14px; font-weight: 700; }
.order-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── LOGIN MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(30,5,20,.45); backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 22px;
  border: 2px solid var(--line2);
  padding: 28px; width: min(380px, calc(100% - 32px));
  box-shadow: 0 12px 48px rgba(232,52,140,.18);
  animation: popIn .2s ease;
}
@keyframes popIn {
  from { opacity:0; transform: scale(.94); }
  to   { opacity:1; transform: scale(1); }
}
.modal-title {
  font-size: 20px; font-weight: 900; color: var(--pink);
  margin-bottom: 4px;
}
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.modal label {
  display: grid; gap: 5px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 12px;
}
.modal input {
  width: 100%; height: 42px; border: 1.5px solid var(--line2);
  border-radius: 10px; background: var(--bg); color: var(--text);
  padding: 0 14px; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-glow); }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-close-modal {
  flex: 1; height: 42px; border-radius: 10px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-close-modal:hover { border-color: var(--pink); color: var(--pink); }
.btn-submit-login {
  flex: 2; height: 42px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--pink) 0%, #b5166a 100%);
  color: #fff; font-size: 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 2px 10px var(--pink-glow); transition: all .15s;
}
.btn-submit-login:hover { background: linear-gradient(135deg, var(--pink-light) 0%, var(--pink) 100%); }

/* ── DELIVERY DIALOG ── */
.dialog {
  width: min(620px, calc(100% - 24px));
  border: 2px solid var(--line2); border-radius: 20px;
  padding: 24px; background: var(--white); color: var(--text);
  box-shadow: 0 12px 48px rgba(232,52,140,.15);
}
.dialog::backdrop { background: rgba(30,5,20,.45); backdrop-filter: blur(5px); }
.dialog h2 { font-size: 18px; font-weight: 900; color: var(--pink); margin: 8px 0 16px; }
.dialog pre {
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; line-height: 1.65;
  font-size: 13px; max-height: 55vh; overflow-y: auto;
}
.btn-dialog-close {
  float: right; width: 34px; height: 34px;
  border: 1.5px solid var(--line2); border-radius: 50%;
  background: var(--bg); color: var(--muted);
  display: grid; place-items: center; font-size: 17px; cursor: pointer;
  transition: all .15s;
}
.btn-dialog-close:hover { border-color: var(--pink); color: var(--pink); }

/* ── TOPUP ── */
.topup-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.info-box {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 20px;
}
.info-box h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.info-box p  { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── TOAST ── */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  display: grid; gap: 8px; z-index: 9999; pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 700;
  background: var(--white); border: 2px solid var(--line2);
  box-shadow: 0 4px 20px rgba(232,52,140,.12);
  animation: slideIn .2s ease;
}
.toast.ok  { border-color: var(--green); color: var(--green); }
.toast.err { border-color: var(--red);   color: var(--red); }
@keyframes slideIn {
  from { opacity:0; transform:translateX(16px); }
  to   { opacity:1; transform:translateX(0); }
}

/* ── EMPTY STATE ── */
.empty {
  padding: 40px 20px; text-align: center;
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 18px;
}
.empty p { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .cat-grid   { grid-template-columns: 1fr; }
  .topup-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page { padding: 16px 10px 50px; }
  .hero-title { font-size: 36px; }
  .hero { height: 180px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .nav-search { max-width: 160px; }
}

/* ── TOPUP NEW ── */
.topup-method-card {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 24px 20px;
  text-align: center; cursor: pointer;
  transition: all .2s; box-shadow: 0 1px 6px var(--pink-glow);
}
.topup-method-card:hover {
  border-color: var(--pink-light);
  box-shadow: 0 4px 16px rgba(232,52,140,.14);
  transform: translateY(-2px);
}
.topup-method-img { font-size: 52px; margin-bottom: 12px; }
.topup-method-name { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.topup-fee {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; border-radius: 20px; padding: 3px 10px;
}
.fee-charge { background: #fff0f0; color: var(--red); }
.fee-charge span, .fee-free span { font-weight: 500; font-size: 11px; }
.fee-free { background: #f0fdf4; color: var(--green); }

.topup-form-box {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 20px; max-width: 500px;
  box-shadow: 0 1px 6px var(--pink-glow);
}
.topup-form-box input[type="text"] {
  width: 100%; height: 44px; border: 1.5px solid var(--line2);
  border-radius: 10px; padding: 0 14px; font-size: 14px;
  background: var(--bg); outline: none; margin-bottom: 0;
  transition: border-color .15s, box-shadow .15s;
}
.topup-form-box input[type="text"]:focus {
  border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-glow);
}
.topup-form-label { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.topup-fee-note {
  text-align: center; font-size: 12px; color: var(--muted);
  margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-back-topup {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1.5px solid var(--line2); background: var(--white);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-back-topup:hover { border-color: var(--pink); color: var(--pink); }

.slip-upload-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 140px; border: 2px dashed var(--line2); border-radius: 14px;
  background: var(--bg); cursor: pointer; transition: all .15s; padding: 20px;
  text-align: center;
}
.slip-upload-area:hover { border-color: var(--pink); background: var(--pink-bg); }
.slip-upload-area img { max-height: 120px; border-radius: 8px; }
