:root {
  --brand: #ea6d1f;
  --brand-dark: #c9560f;
  --ink: #1f2933;
  --ink-soft: #52606d;
  --line: #e4e7eb;
  --bg: #f5f7fa;
  --card: #ffffff;
  --ok: #12805c;
  --warn: #b7791f;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sarabun", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1760px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.topbar { background: var(--ink); color: #cbd2d9; font-size: 13px; }
.topbar .container { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; flex-wrap: wrap; }
.topbar a:hover { color: #fff; }

.header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.header .container { display: flex; align-items: center; gap: 20px; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; color: var(--ink); }
.logo .mark { background: var(--brand); color: #fff; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; }
.logo small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-soft); letter-spacing: .5px; }

.search { flex: 1; }
.search input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font: inherit; background: var(--bg); }

.header-actions { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.icon-link { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.icon-link:hover { color: var(--brand); }
.cart-badge { position: relative; }
.cart-badge .count { position: absolute; top: -8px; right: -10px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Nav ---------- */
.nav { background: var(--brand); }
.nav .container { display: flex; gap: 4px; flex-wrap: wrap; }
.nav .item { position: relative; }
.nav .item > a { display: block; padding: 12px 16px; color: #fff; font-weight: 600; font-size: 15px; }
.nav .item:hover > a { background: var(--brand-dark); }
.nav .dropdown { position: absolute; left: 0; top: 100%; background: #fff; min-width: 220px; box-shadow: var(--shadow); border-radius: 0 0 var(--radius) var(--radius); padding: 6px; display: none; z-index: 50; }
.nav .item:hover .dropdown { display: block; }
.nav .dropdown a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.nav .dropdown a:hover { background: var(--bg); color: var(--brand); }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(120deg, #1f2933, #323f4b); color: #fff; border-radius: var(--radius); padding: 44px 40px; margin: 24px 0; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { margin: 0; font-size: 32px; line-height: 1.25; }
.hero p { margin: 0; color: #cbd2d9; max-width: 560px; }
.hero .cta { display: inline-flex; align-self: flex-start; margin-top: 8px; }

/* ---------- Sections ---------- */
.section { margin: 34px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 22px; position: relative; padding-left: 14px; }
.section-head h2::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 5px; border-radius: 3px; background: var(--brand); }
.section-head a { color: var(--brand); font-weight: 600; font-size: 14px; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(16,24,40,.12); }
.card .thumb { aspect-ratio: 4/3; background: #eceff1; display: grid; place-items: center; color: #9aa5b1; font-size: 40px; position: relative; }
.card .body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .cat { font-size: 12px; color: var(--ink-soft); }
.card .name { font-weight: 600; font-size: 15px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 46px; }
.card .price { margin-top: auto; font-weight: 800; color: var(--brand); font-size: 18px; }
.card .price small { font-weight: 500; color: var(--ink-soft); font-size: 12px; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; color: #fff; }
.badge.hot { background: var(--danger); }
.badge.featured { background: var(--brand); }
.thumb .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: background .12s, opacity .12s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); margin: 20px 0; }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Layout helpers ---------- */
.layout-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel h3 { margin: 0 0 14px; font-size: 18px; }

/* ---------- Product detail ---------- */
.product-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.product-gallery { aspect-ratio: 1; background: #eceff1; border-radius: var(--radius); display: grid; place-items: center; color: #9aa5b1; font-size: 90px; }
.variant-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.variant-option { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.variant-option:hover { border-color: var(--brand); }
.variant-option input { accent-color: var(--brand); }
.variant-option.selected { border-color: var(--brand); background: #fff7f1; }
.variant-option .v-name { flex: 1; font-weight: 600; }
.variant-option .v-price { font-weight: 800; color: var(--brand); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 38px; height: 40px; border: 0; background: var(--bg); font-size: 18px; cursor: pointer; }
.qty input { width: 52px; height: 40px; border: 0; text-align: center; font: inherit; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }

.summary-row { display: flex; justify-content: space-between; padding: 7px 0; }
.summary-row.total { border-top: 2px solid var(--line); margin-top: 8px; padding-top: 14px; font-size: 20px; font-weight: 800; }
.summary-row.total .val { color: var(--brand); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input, .field textarea, .field select { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: var(--danger); font-size: 13px; margin-top: 4px; }

#map { height: 320px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 1; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin: 16px 0; font-weight: 600; }
.alert-success { background: #e3f9e5; color: var(--ok); }
.alert-error { background: #fbe9e7; color: var(--danger); }
.alert-info { background: #fff7f1; color: var(--brand-dark); border: 1px solid #f5d9c4; }

/* ---------- Status ---------- */
.status { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status.pending_payment { background: #fdf0e3; color: var(--warn); }
.status.pending_review { background: #fff3cd; color: var(--warn); }
.status.confirmed { background: #e3f0ff; color: #1c64f2; }
.status.shipping { background: #e0f2fe; color: #0369a1; }
.status.delivered { background: #e3f9e5; color: var(--ok); }
.status.cancelled { background: #fbe9e7; color: var(--danger); }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.steps .step { flex: 1; min-width: 120px; padding: 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--ink-soft); }
.steps .step.active { border-color: var(--brand); background: #fff7f1; color: var(--brand-dark); font-weight: 700; }
.steps .step.done { border-color: var(--ok); color: var(--ok); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.pagination .page-link { display: block; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; }
.pagination .page-item.active .page-link { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .page-item.disabled .page-link { opacity: .5; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty .big { font-size: 60px; margin-bottom: 10px; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #9aa5b1; margin-top: 50px; padding: 40px 0 24px; }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.footer h4 { color: #fff; margin: 0 0 12px; font-size: 16px; }
.footer a { color: #9aa5b1; display: block; padding: 3px 0; }
.footer a:hover { color: #fff; }
.footer .bottom { border-top: 1px solid #3e4c59; margin-top: 26px; padding-top: 16px; font-size: 13px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .layout-2 { grid-template-columns: 1fr; }
  .product-hero { grid-template-columns: 1fr; }
  .footer .cols { grid-template-columns: 1fr; }
  .search { order: 3; flex-basis: 100%; }
}
@media (max-width: 520px) {
  .grid, .grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 30px 22px; }
  .hero h1 { font-size: 24px; }
}

/* =======================================================================
   ปรับหน้าร้านให้เต็มจอ + ทันสมัย + รองรับมือถือ/แท็บเล็ต (เพิ่ม 2026-09-05)
   ส่วนนี้เพิ่มต่อท้าย ไม่ลบของเดิม — media query ท้ายไฟล์จะ override ของเดิม
   ======================================================================= */

/* กัน horizontal scroll ตอนใช้ full-bleed — overflow-x:clip ไม่ทำให้ sticky header พัง (ต่าง hidden) */
body { overflow-x: clip; }

/* ---------- Full-bleed helper (ขยายทะลุ .container ให้เต็มจอ) ---------- */
.full-bleed { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }

/* ---------- Full-bleed band (แถบพื้นหลังเต็มจอ) ---------- */
.section-band { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 44px 0; margin-top: 44px; margin-bottom: 44px; }
.section-band > .container { max-width: 1760px; }
.section-band.dark { background: linear-gradient(120deg, #1f2933, #323f4b); border-color: transparent; color: #fff; }
.section-band.soft { background: #fff7f1; border-color: #f5d9c4; }

/* ---------- Hamburger + Mobile drawer ---------- */
.nav-toggle { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 20px; color: var(--ink); }
.nav-toggle:hover { border-color: var(--brand); color: var(--brand); }

.drawer-overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); opacity: 0; visibility: hidden; transition: opacity .2s; z-index: 60; }
.drawer-overlay.open { opacity: 1; visibility: visible; }

.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 84%; max-width: 340px; background: #fff; z-index: 70; transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto; box-shadow: 0 0 40px rgba(16,24,40,.2); }
.drawer.open { transform: translateX(0); }
.drawer .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 800; }
.drawer .drawer-close { border: 0; background: none; font-size: 24px; cursor: pointer; line-height: 1; color: var(--ink-soft); }
.drawer .d-item { border-bottom: 1px solid var(--line); }
.drawer .d-item > a { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-weight: 600; }
.drawer .d-toggle { border: 0; background: none; font-size: 18px; padding: 14px 18px; cursor: pointer; color: var(--ink-soft); }
.drawer .d-head { display: flex; align-items: center; justify-content: space-between; }
.drawer .d-head > a { flex: 1; padding: 14px 18px; font-weight: 600; }
.drawer .d-sub { display: none; background: var(--bg); padding: 4px 0; }
.drawer .d-item.open .d-sub { display: block; }
.drawer .d-sub a { display: block; padding: 10px 30px; font-size: 14px; color: var(--ink-soft); }
.drawer .d-sub a:hover { color: var(--brand); }

/* ---------- Nav dropdown แบบแตะได้ (มือถือ) ---------- */
.nav .item.open > .dropdown { display: block; }

/* ---------- Hero banner slider ---------- */
.hero-slider { position: relative; margin: 20px 0 8px; border-radius: var(--radius); overflow: hidden; background: #eceff1; }
.hero-slider.full-bleed, .hero-fallback.full-bleed { border-radius: 0; margin-top: 0; }
.hero-fallback .hb-inner { max-width: 1760px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.hero-slider .slides { position: relative; width: 100%; aspect-ratio: 16 / 6; }
.hero-slider .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.hero-slider .slide.active { opacity: 1; }
.hero-slider .slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slider .slide .caption { position: absolute; left: 0; bottom: 0; right: 0; padding: 30px 34px; background: linear-gradient(0deg, rgba(16,24,40,.7), transparent); color: #fff; }
.hero-slider .slide .caption h2 { margin: 0 0 6px; font-size: 28px; }
.hero-slider .slide .caption p { margin: 0; color: #e4e7eb; }
.slider-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 999px; border: 0; background: rgba(255,255,255,.85); color: var(--ink); font-size: 22px; cursor: pointer; display: grid; place-items: center; z-index: 3; }
.slider-arrow:hover { background: #fff; color: var(--brand); }
.slider-arrow.prev { left: 14px; }
.slider-arrow.next { right: 14px; }
.slider-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; gap: 8px; justify-content: center; z-index: 3; }
.slider-dots button { width: 10px; height: 10px; border-radius: 999px; border: 0; background: rgba(255,255,255,.6); cursor: pointer; padding: 0; }
.slider-dots button.active { background: #fff; width: 26px; }
.hero-slider.single .slider-arrow, .hero-slider.single .slider-dots { display: none; }

.hero-fallback { background: linear-gradient(120deg, #1f2933, #323f4b); color: #fff; border-radius: var(--radius); padding: 54px 44px; margin: 20px 0 8px; display: flex; flex-direction: column; gap: 14px; }
.hero-fallback h1 { margin: 0; font-size: 34px; line-height: 1.25; }
.hero-fallback p { margin: 0; color: #cbd2d9; max-width: 620px; }
.hero-fallback .cta { display: inline-flex; align-self: flex-start; margin-top: 8px; }

/* ---------- Category tiles ---------- */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 12px; text-align: center; transition: transform .12s, box-shadow .12s, border-color .12s; }
.cat-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(16,24,40,.12); border-color: var(--brand); }
.cat-tile .ic { width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 16px; background: #fff7f1; display: grid; place-items: center; font-size: 30px; }
.cat-tile .thumb { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 16px; overflow: hidden; background: #fff7f1; }
.cat-tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-tile .t { font-weight: 700; font-size: 14px; color: var(--ink); }
.cat-tile .c { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Feature strip ---------- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature { display: flex; align-items: center; gap: 14px; }
.feature .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 24px; flex: none; }
.feature .t { font-weight: 700; font-size: 15px; }
.feature .d { font-size: 13px; color: var(--ink-soft); }

/* ---------- Responsive: จอกว้าง (ให้สินค้าแน่นเต็มจอแบบ Global House) ---------- */
@media (min-width: 1400px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Responsive: แท็บเล็ต / มือถือ ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  /* ซ่อนแถบเมนูแนวนอน แล้วใช้ hamburger + drawer แทน */
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  /* ให้ header ตกบรรทัด: แถวแรก = hamburger + โลโก้ + ปุ่ม, แถวสอง = ช่องค้นหาเต็มความกว้าง */
  .header .container { flex-wrap: wrap; gap: 12px; }
  .header-actions { margin-left: auto; gap: 14px; }
  .hero-slider .slide .caption h2 { font-size: 22px; }
}
@media (max-width: 760px) {
  .grid, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-slider .slides { aspect-ratio: 16 / 9; }
  /* หมวดหมู่เลื่อนแนวนอนบนมือถือ (เหมือน Global House) */
  .cat-tiles { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .cat-tiles .cat-tile { flex: 0 0 130px; scroll-snap-align: start; }
  .hero-fallback { padding: 34px 22px; }
  .hero-fallback h1 { font-size: 26px; }
}
@media (max-width: 480px) {
  .hero-slider .slide .caption { padding: 16px 18px; }
  .hero-slider .slide .caption h2 { font-size: 18px; }
  .hero-slider .slide .caption p { font-size: 13px; }
  .features { grid-template-columns: 1fr; }
  .logo { font-size: 19px; }
  .header-actions .icon-link span { display: none; } /* เหลือเฉพาะไอคอนบนจอเล็กมาก กัน header ล้น */
}
