/* =========================================================
   base.css — สไตล์ที่ทุกหน้าใช้ร่วมกัน
   (สี, ฟอนต์, แถบประกาศ, header, เมนูข้าง, footer, การ์ดสินค้า)
   ========================================================= */

/* ---------- สีและค่าหลักของทั้งเว็บ (อยากเปลี่ยนสี แก้ที่นี่ที่เดียว) ---------- */
:root {
  --c-blue: #AFC1D5;        /* แถบบน, เส้นขอบ, หัวข้อสีอ่อน */
  --c-blue-pale: #BCCDDF;   /* ปุ่มสั่งซื้อ, เส้นแบ่ง, ไอคอน */
  --c-blue-soft: #DEE8F4;   /* พื้นปุ่มยอดเงิน */
  --c-blue-strong: #5E96D2; /* ตัวเลขยอดเงิน */
  --c-avatar: #D1DEEE;      /* วงกลมรูปโปรไฟล์ */
  --c-sky: #A9D6F3;         /* พื้นรูปสินค้า */
  --c-text: #738DA9;        /* ตัวหนังสือหลัก */
  --c-gray: #838383;        /* ตัวหนังสือสีเทา */
  --c-muted: #C6D4DD;       /* ตัวหนังสือจางมาก */
  --c-green: #52CF64;       /* ตัวเลขเพิ่มขึ้น */
  --c-red: #FA6060;         /* ข้อความผิดพลาด / คำเตือน */
  --c-red-dark: #E04646;    /* ตัวหนังสือในกล่องแจ้งเตือนสีแดง */
  --c-red-soft: #FFF1F1;    /* พื้นกล่องแจ้งเตือนสีแดง */
  --c-cream: #FEFDF9;       /* พื้นการ์ด */
  --c-line: #D3DADD;        /* เส้นใต้ header */

  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.08);
  --page-pad: 25px;         /* ระยะขอบซ้ายขวาของหน้า */
  --container: 1100px;      /* ความกว้างสูงสุดของเนื้อหาบนคอม */

  --font-th: 'Mitr', sans-serif;
  --font-title: 'Titan One', 'Mitr', sans-serif;

  /* ขอบตัวหนังสือสีฟ้า (ใช้กับปุ่มติดต่อแอดมิน และป้ายสินค้าหมด) */
  --stroke-blue:
    1px 0 0 #A8C2DF, -1px 0 0 #A8C2DF, 0 1px 0 #A8C2DF, 0 -1px 0 #A8C2DF,
    1px 1px 0 #A8C2DF, -1px -1px 0 #A8C2DF, 1px -1px 0 #A8C2DF, -1px 1px 0 #A8C2DF,
    0 2px 6px rgba(80, 120, 170, 0.35);
}

/* ---------- ค่าเริ่มต้น ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-th);
  color: var(--c-text);
  background: #fff;
  line-height: 1.5;
  /* ให้ footer อยู่ล่างสุดของจอเสมอ แม้เนื้อหาในหน้าจะสั้น */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }
[hidden] { display: none !important; }

/* ซ่อน/แสดงตามสถานะล็อกอิน: ใส่ data-show="guest" หรือ data-show="user" ให้ element ได้เลย */
html.is-logged-in [data-show="guest"],
html:not(.is-logged-in) [data-show="user"] { display: none !important; }
/* เฉพาะแอดมิน / เฉพาะลูกค้า: ใส่ data-role="admin" หรือ data-role="customer" */
html.is-admin [data-role="customer"],
html:not(.is-admin) [data-role="admin"] { display: none !important; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--page-pad) * 2);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.divider {
  border: 0;
  border-top: 1px solid var(--c-blue-pale);
}

/* ---------- แถบประกาศด้านบนสุด ---------- */
.topbar {
  min-height: 25px;
  background: var(--c-blue);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 12px;
  text-align: center;
  overflow-wrap: anywhere; /* ประกาศยาว = ขึ้นบรรทัดใหม่ ไม่โดนตัด */
}
.topbar svg { width: 14px; height: 14px; flex-shrink: 0; }
/* แถบเตือนแอดมิน (EasySlip ใช้ไม่ได้ / โควต้าใกล้หมด) ใต้ header */
.admin-warn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  background: #FFF8E3;
  border-bottom: 1px solid #F1D48A;
  color: #8A6400;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}
.admin-warn svg { width: 15px; height: 15px; flex-shrink: 0; }
.admin-warn b { flex-shrink: 0; font-weight: 600; white-space: nowrap; }

/* ---------- Header ---------- */
/* ให้ header เป็นลูกของ <body> โดยตรง จะได้ติดด้านบนจอได้ตลอดทั้งหน้า (ไม่ติดอยู่แค่ในกล่อง #site-top) */
#site-top { display: contents; }

/* header ติดด้านบนจอเวลาเลื่อนลง (แถบประกาศสีฟ้าเลื่อนหายไปตามปกติ) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--c-line);
  transition: box-shadow 0.2s;
}
/* เงาบางๆ ตอนเลื่อนลงแล้ว ให้เห็นว่า header ลอยอยู่เหนือเนื้อหา */
.site-header.is-stuck { box-shadow: 0 2px 8px rgba(115, 141, 169, 0.18); }
.site-header .container {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 22px;
  padding-right: 12px;
}
.menu-btn { display: flex; color: var(--c-blue-pale); }
.menu-btn svg { width: 20px; height: 20px; }
.logo img { width: 32px; height: 32px; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.search-btn {
  width: 33px;
  height: 25px;
  border: 1px solid var(--c-blue-pale);
  border-radius: 999px;
  background: var(--c-cream);
  color: var(--c-blue-pale);
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-btn svg { width: 17px; height: 17px; }
.login-icon {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--c-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-icon svg { width: 15px; height: 15px; }
.balance-pill {
  height: 25px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--c-blue);
  border-radius: 999px;
  background: var(--c-blue-soft);
  color: var(--c-blue-strong);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.balance-pill img { width: 15px; height: 15px; }

/* ---------- เมนูข้าง (กดปุ่ม ☰) ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  opacity: 0;
  transition: opacity 0.25s;
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(84vw, 340px);
  background: #fff;
  padding: 34px 22px 24px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-blue);
}
.drawer-close svg { width: 16px; height: 16px; }
.drawer-title { font-size: 22px; font-weight: 500; color: var(--c-text); margin-bottom: 6px; }
.drawer-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
}
.drawer-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.drawer-link[aria-current="page"] { color: var(--c-blue-strong); }
.drawer-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
  font-size: 13px;
  color: var(--c-blue);
}
.drawer-sep::before,
.drawer-sep::after { content: ''; flex: 1; border-top: 1px solid var(--c-blue-pale); }
.drawer-auth { display: grid; grid-template-columns: 1fr 1fr; }
.account-card { border: 1px solid var(--c-blue-pale); border-radius: 12px; padding: 12px 14px 8px; }
.account-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--c-avatar);
  color: var(--c-blue-strong);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.account-name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.account-balance { font-size: 11px; color: var(--c-blue); display: flex; align-items: center; gap: 5px; }
.account-balance img { width: 12px; height: 12px; opacity: 0.7; }
.account-card .drawer-link { font-size: 13px; padding: 5px 0; gap: 12px; }
.account-card .drawer-link svg { width: 18px; height: 18px; }

/* ---------- หน้าค้นหา (กดปุ่มแว่นขยาย) ---------- */
.search { position: fixed; inset: 0; z-index: 150; }
.search-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.78); }
.search-panel {
  position: relative;
  width: calc(100% - 16px);
  max-width: 720px;
  max-height: calc(100vh - 20px);
  margin: 10px auto 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--c-blue-pale);
  border-radius: 12px;
  overflow: hidden;
  animation: modal-in 0.15s ease-out;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 10px 0 10px;
  border-bottom: 1px solid var(--c-blue-pale);
  color: #AEBDCD;
}
.search-bar > svg { width: 20px; height: 20px; flex-shrink: 0; }
.search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px; /* 16px กัน iPhone ซูมหน้าจอ */
  color: var(--c-text);
}
.search-input::placeholder { color: #AEBDCD; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-blue);
}
.search-clear svg { width: 14px; height: 14px; }
.search-results { overflow-y: auto; padding: 6px 0 8px; }
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 8px;
}
.search-item:hover,
.search-item[aria-selected="true"] { background: #F2F6FB; }
.search-thumb {
  width: 31px;
  height: 23px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  background: var(--c-sky);
}
.search-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.search-name { font-size: 15px; font-weight: 500; color: var(--c-text); overflow-wrap: anywhere; }
.search-price { font-size: 14px; color: #AEBDCD; }
.search-soldout {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--c-red);
  border-radius: 3px;
  background: var(--c-red-soft);
  color: var(--c-red-dark);
  font-size: 10px;
  font-weight: 400;
  vertical-align: 2px;
}
.search-chevron { width: 18px; height: 18px; flex-shrink: 0; color: var(--c-text); }
.search-empty { padding: 18px 12px; text-align: center; font-size: 14px; color: var(--c-blue); }

/* ---------- Footer ---------- */
.site-footer .divider { border-top-color: var(--c-blue); }
.site-footer p {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--c-blue);
  padding: 20px 0 22px;
}

/* ---------- หัวข้อหน้า ---------- */
.page-title {
  font-size: 28px;
  font-weight: 500;
  color: var(--c-text);
  line-height: 1.3;
  margin: 20px 0 16px;
}

/* หัวข้อมีเส้นใต้ + คำอธิบาย 2 บรรทัด (ประวัติการซื้อ, ประวัติเติมเงิน) */
.page-title-line { padding-bottom: 6px; border-bottom: 1px solid var(--c-blue-pale); margin-bottom: 14px; }
.page-sub { margin-bottom: 18px; font-size: 17px; line-height: 1.6; color: var(--c-blue); }

/* หัวข้อแบบมีปุ่มย้อนกลับ และเส้นใต้ (หน้าสินค้า, หมวดหมู่ ฯลฯ) */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-blue-pale);
}
.page-head h1 {
  min-width: 0;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--c-text);
  overflow-wrap: anywhere;
}
.back-btn {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--c-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-btn svg { width: 15px; height: 15px; }

/* สถานะกำลังโหลด / ไม่พบข้อมูล */
.loading { padding: 40px 0; text-align: center; color: var(--c-blue); font-size: 14px; }
.empty-state {
  margin: 24px 0 40px;
  padding: 28px 20px;
  text-align: center;
  background: var(--c-cream);
  border: 1px solid var(--c-blue);
  border-radius: 12px;
}
.empty-state h2 { font-size: 18px; font-weight: 500; color: var(--c-text); }
.empty-state p { font-size: 13px; color: var(--c-blue); margin-top: 4px; }
.empty-state .btn-primary { display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 0 22px; }

/* ---------- ฟอร์ม (เข้าสู่ระบบ, สมัครสมาชิก, เปลี่ยนรหัสผ่าน) ---------- */
.form-page { max-width: 440px; margin: 0 auto; padding-bottom: 32px; }
.form-card {
  background: var(--c-cream);
  border: 1px solid var(--c-blue);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 16px 19px 20px;
}
.field + .field { margin-top: 18px; }
.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 1.4;
  color: var(--c-blue);
}
.input-wrap { position: relative; }
.input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--c-blue);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 16px; /* ต้อง 16px ขึ้นไป ไม่งั้น iPhone จะซูมหน้าจอตอนแตะช่องกรอก */
  color: var(--c-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--c-blue-strong); box-shadow: 0 0 0 3px rgba(94, 150, 210, 0.18); }
.input-wrap .input { padding-right: 46px; }
.toggle-pass {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 38px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-blue);
}
.toggle-pass svg { width: 20px; height: 20px; }
.field-hint { margin-top: 6px; font-size: 10px; line-height: 1.6; color: var(--c-blue); }
.field-hint:empty { display: none; }

/* ช่องที่กรอกไม่ถูกต้อง: ขอบและคำอธิบายเป็นสีแดง */
.field.has-error .input { border-color: var(--c-red); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px rgba(250, 96, 96, 0.18); }
.field.has-error .field-hint { color: var(--c-red); }

/* กล่องแจ้งเตือนสีแดงเหนือปุ่ม */
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 12px;
  border: 1px solid #F9C9C9;
  border-radius: 10px;
  background: var(--c-red-soft);
  color: var(--c-red-dark);
  font-size: 13px;
  line-height: 1.5;
}
.form-alert[hidden] { display: none; }
.form-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.btn-primary {
  width: 100%;
  height: 40px;
  margin-top: 20px;
  border-radius: 12px;
  background: var(--c-blue-pale);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--c-blue); }
.btn-primary:disabled { opacity: 0.65; cursor: wait; }
.btn-secondary {
  height: 40px;
  border: 1px solid var(--c-blue);
  border-radius: 12px;
  background: #fff;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-secondary:disabled { opacity: 0.6; }

.form-links { margin-top: 18px; text-align: center; font-size: 15px; line-height: 1.7; color: var(--c-blue); }
.form-links a { color: var(--c-text); font-weight: 500; }
.form-note { font-size: 13px; }

/* ---------- ป๊อปอัปกลางจอ (js/modal.js) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 22px 24px; /* เว้นด้านบนไว้ให้ปุ่มปิดวงกลมที่ยื่นออกมา */
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.78); }
.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 340px;
  max-height: calc(100vh - 90px);
  background: var(--c-cream);
  border: 2px solid var(--c-blue);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: modal-in 0.18s ease-out;
}
.modal-inner { overflow-y: auto; padding: 18px 12px 16px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }

/* ปุ่มปิดวงกลมใหญ่ ยื่นออกมาที่มุมขวาบน (ตามดีไซน์ป๊อปอัปข้อมูลการสั่งซื้อ) */
.modal-close {
  position: absolute;
  top: -40px;
  right: -20px;
  z-index: 1;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--c-text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.modal-close svg { width: 40px; height: 40px; }
.modal-close:disabled { opacity: 0.7; }
.modal-title { padding-right: 60px; font-size: 22px; font-weight: 500; line-height: 1.4; color: var(--c-text); }
.modal-subtitle { padding-right: 60px; font-size: 12px; color: var(--c-blue); line-height: 1.5; }
.modal-body { margin-top: 12px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions > * { flex: 1; margin-top: 0; }
.modal-actions .btn-primary { display: flex; align-items: center; justify-content: center; }

/* ตารางสรุป (ใช้ในป๊อปอัปยืนยันการสั่งซื้อ) */
.summary { background: #fff; border: 1px solid var(--c-blue-pale); border-radius: 12px; padding: 10px 14px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--c-text); }
.summary-row span:first-child { color: var(--c-blue); }
.summary-row strong { font-weight: 500; text-align: right; }
.summary-row.is-total strong { font-size: 17px; }
.summary hr { border: 0; border-top: 1px dashed var(--c-blue-pale); margin: 6px 0; }
.text-red { color: var(--c-red) !important; }
.modal-note { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--c-blue); }

/* ---------- ปุ่มเลขหน้า (ประวัติการซื้อ, ประวัติเติมเงิน) ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 4px 0 28px; }
.page-num,
.page-arrow {
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border: 1px solid var(--c-text);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--c-text);
  background: #fff;
}
.page-num.is-current { background: var(--c-text); color: #fff; }
.page-arrow { background: var(--c-blue); border-color: var(--c-text); color: var(--c-text); }
.page-arrow svg { width: 13px; height: 13px; }
.page-arrow[aria-disabled="true"] { opacity: 0.45; }

/* ป้ายสีเหลืองเล็กๆ เช่น "คืนเครดิตแล้ว" */
.badge-refund {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #FFF4D6;
  color: #A86B00;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- การ์ดสินค้า (ใช้ทั้งหน้าแรกและหน้ารายการสินค้า) ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
}
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--c-cream);
  border: 1px solid var(--c-blue);
  border-radius: 16px;
  padding: 9px 8px 6px;
}
.product-card .bow {
  position: absolute;
  left: -15px;
  top: -12px;
  width: 45px;
  pointer-events: none;
  z-index: 2;
}
.product-img {
  position: relative;
  display: block;
  aspect-ratio: 300 / 220;
  border-radius: 10px;
  overflow: hidden;
  background: var(--c-sky);
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-name { font-size: 12.5px; font-weight: 600; line-height: 1.4; margin-top: 7px; }
.product-price { font-size: 13px; font-weight: 500; line-height: 1.6; margin-bottom: 8px; }
.btn-buy {
  display: block;
  margin-top: auto; /* ดันปุ่มลงล่างสุด ให้ปุ่มทุกการ์ดในแถวเดียวกันอยู่ระดับเดียวกัน */
  height: 25px;
  line-height: 25px;
  border-radius: 12px;
  background: var(--c-blue-pale);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}
.product-stock { text-align: center; font-size: 9px; color: var(--c-muted); margin-top: 2px; }

/* สินค้าหมด: รูปจางลง มีป้าย "สินค้าหมด" และกดสั่งซื้อไม่ได้ */
.product-card.is-soldout .product-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
}
.soldout-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  text-shadow: var(--stroke-blue);
}
.btn-buy[aria-disabled="true"] { background: #E9EDEF; cursor: not-allowed; }

/* ---------- จอใหญ่ขึ้น (แท็บเล็ต / คอม) ---------- */
@media (min-width: 640px) {
  .page-title { font-size: 32px; margin-top: 32px; }
  .field-hint { font-size: 12px; }
  .product-name { font-size: 14px; }
  .product-price { font-size: 15px; }
  .btn-buy { height: 32px; line-height: 32px; font-size: 14px; }
  .product-stock { font-size: 11px; }
}
@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
}
@media (min-width: 1024px) {
  .site-footer p { font-size: 12px; }
  .site-header .container { height: 56px; padding: 0 var(--page-pad); }
  .logo img { width: 40px; height: 40px; }
  .search-btn { width: 40px; height: 30px; }
  .login-icon { width: 30px; height: 30px; }
  .balance-pill { height: 30px; font-size: 14px; padding: 0 14px 0 10px; }
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 28px; }
}

/* ---------- กล่องแจ้งตอนแอดมินปิดระบบชั่วคราว (เติมเงิน / สมัครสมาชิก) ---------- */
.closed-box { margin: 8px 0 22px; padding: 22px 18px; border: 1px solid #F3B6B6; border-radius: 14px; background: #FFFBFB; text-align: center; }
.closed-box svg { width: 42px; height: 42px; color: var(--c-red); }
.closed-box h2 { margin: 6px 0 4px; font-size: 20px; font-weight: 500; color: var(--c-red-dark); }
.closed-box p { font-size: 14px; line-height: 1.6; color: var(--c-text); overflow-wrap: anywhere; }
.closed-box small { display: block; margin-top: 8px; font-size: 12px; color: var(--c-blue); }

/* ---------- ยังไม่มีสินค้า (เช่น สินค้าแนะนำหน้าแรก) ---------- */
.grid-empty { grid-column: 1 / -1; padding: 20px 14px; border: 1px dashed var(--c-blue-pale); border-radius: 12px; font-size: 14px; color: var(--c-blue); text-align: center; }
