/* Sukree Wholesale Shop — ลูกค้า B2B (ไม่มีข้อมูลสต็อกใดๆ ในหน้านี้) */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --blue: #1565c0; --blue-d: #0d47a1; --green: #2e7d32; --red: #c62828;
  --amber: #ef6c00; --bg: #f4f6f9; --card: #fff; --line: #e3e8ef;
  --txt: #1e293b; --mut: #64748b; --r: 14px;
}
html, body { height: 100%; }
body { font-family: -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; }
.hidden { display: none !important; }

/* ── Auth ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #0d47a1, #1565c0 60%, #26a69a); padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 34px 28px; width: 100%;
  max-width: 400px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { font-size: 50px; margin-bottom: 6px; }
.login-card h1 { font-size: 23px; color: var(--blue-d); }
.login-sub { color: var(--mut); font-size: 13px; margin: 6px 0 20px; }
.login-card input { width: 100%; padding: 13px 15px; margin-bottom: 11px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; outline: none; }
.login-card input:focus { border-color: var(--blue); }
.btn-primary { width: 100%; padding: 13px; font-size: 16px; font-weight: 600; color: #fff;
  background: var(--blue); border: 0; border-radius: 10px; cursor: pointer; }
.btn-primary:active { background: var(--blue-d); }
.btn-primary:disabled { opacity: .5; }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }
.auth-switch { margin-top: 14px; font-size: 13.5px; color: var(--mut); }
.auth-switch a { color: var(--blue-d); font-weight: 600; }
.reg-note { margin-top: 12px; font-size: 12px; color: var(--mut); background: var(--bg);
  border-radius: 8px; padding: 8px; }

/* ── Topbar ── */
.topbar { position: sticky; top: 0; z-index: 30; background: #fff;
  border-bottom: 1px solid var(--line); padding: 10px 14px 8px; }
.topbar-row { display: flex; align-items: center; gap: 8px; }
.brand { font-size: 17px; font-weight: 700; color: var(--blue-d); white-space: nowrap;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.search-box { flex: 1; }
.search-box input { width: 100%; padding: 10px 16px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 24px; outline: none; background: var(--bg); }
.search-box input:focus { border-color: var(--blue); background: #fff; }
.btn-icon { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 17px; cursor: pointer; color: var(--mut); flex: none; position: relative; }
.cart-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.filter-row { display: flex; align-items: center; gap: 14px; padding-top: 8px; }
.categ-active { padding: 8px 14px; border-radius: 20px; background: var(--blue); color: #fff;
  border: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.categ-active .cx { opacity: .8; margin-left: 4px; font-weight: 400; }
.filter-circles { display: flex; gap: 16px; overflow-x: auto; padding: 10px 2px 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filter-circles::-webkit-scrollbar { display: none; }
.filter-circle { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 0; }
.filter-circle .fc-ic { width: 46px; height: 46px; border-radius: 50%; background: var(--bg);
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.filter-circle .fc-label { font-size: 11px; font-weight: 600; color: var(--mut); white-space: nowrap; }
.filter-circle:active .fc-ic { transform: scale(.92); }
.filter-circle.on .fc-ic { background: linear-gradient(135deg, var(--amber), var(--red)); border-color: transparent;
  box-shadow: 0 3px 10px rgba(198,40,40,.4); }
.filter-circle.on .fc-label { color: var(--red); font-weight: 700; }
.filter-row select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff; }
.result-count { margin-left: auto; font-size: 13px; color: var(--mut); }

/* ── Grid / Card ── */
main { padding: 14px; max-width: 1400px; margin: 0 auto; }
.banner-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.banner-strip.hidden { display: none; }
.banner-slide { flex: 0 0 auto; width: min(560px, 88vw); scroll-snap-align: start; cursor: pointer; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.banner-slide img { width: 100%; height: 150px; object-fit: cover; display: block; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}
.card { background: var(--card); border-radius: var(--r); overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); display: flex; flex-direction: column; }
.card:active { transform: scale(.97); }
.card-img { position: relative; aspect-ratio: 1; background: #fff;
  display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-img .noimg { font-size: 42px; opacity: .18; }
.badge-wrap {
  position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column;
  gap: 4px; max-width: 92%; align-items: flex-start;
}
.badge-promo { background: var(--amber); color: #fff;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 14px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(239,108,0,.4); }

/* ── Sale card (โปรโมชั่น) ── */
.sale-ribbon {
  position: absolute; top: 10px; left: 0; display: flex; align-items: center; gap: 5px;
  padding: 6px 16px 6px 12px; clip-path: polygon(0 0, 100% 0, 88% 50%, 100% 100%, 0 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,.3); z-index: 3; animation: ribbonShine 2.4s ease-in-out infinite;
}
.sale-ribbon.sale  { background: linear-gradient(135deg, #ffca28, var(--red)); }
.sale-ribbon.flash { background: linear-gradient(135deg, #4a148c, #7b1fa2 55%, var(--red)); }
.sale-ribbon .lbl { font-weight: 800; font-style: italic; font-size: 14.5px; letter-spacing: .5px;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); white-space: nowrap; }
.sale-ribbon .ic { font-size: 14px; }
@keyframes ribbonShine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.08); } }
.sale-date {
  position: absolute; top: 56px; left: 8px; background: #fff; color: var(--red);
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); white-space: nowrap; z-index: 3;
}
.sale-code {
  position: absolute; top: 10px; right: 10px; background: #fff; color: var(--blue-d);
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); z-index: 3;
}
.sale-price-bubble {
  position: absolute; bottom: 6px; right: 6px; width: 76px; height: 76px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e53935, var(--red)); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 4px 12px rgba(198,40,40,.4); z-index: 3; text-align: center; padding: 4px 6px;
}
.sale-price-bubble .p { font-size: 17px; font-weight: 800; line-height: 1.15; white-space: nowrap; color: #ffeb3b; }
.sale-price-bubble .u { font-size: 9.5px; font-weight: 500; opacity: .9; white-space: nowrap; }
.sale-cta {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(30,41,59,.38); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 22px; border-radius: 20px; z-index: 3; white-space: nowrap;
}
.wish-btn { position: absolute; top: 8px; right: 8px; z-index: 4; width: 32px; height: 32px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--line);
  font-size: 16px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center; }
.wish-btn.on { color: var(--red); }
.wish-btn:active { transform: scale(.9); }
.wish-btn.wish-inline { position: static; background: var(--bg); border: 1px solid var(--line);
  box-shadow: none; width: 30px; height: 30px; }
.wish-btn.wish-inline.on { background: #fdecea; border-color: var(--red); }
.foot-ic { display: flex; align-items: center; gap: 8px; }
.detail-wish-pos { position: absolute; top: 14px; right: 60px; }
#top10-grid, #promo-grid { grid-template-columns: repeat(5, 1fr); }
.card.sale-card .badge-best { top: 46px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-name { font-size: 17px; line-height: 1.35; font-weight: 600; min-height: 46px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-code { font-size: 12px; color: var(--mut); }
.card-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: auto; }
.card-price { font-size: 18px; font-weight: 700; color: var(--blue-d); }
.card-price .cur { font-size: 12px; font-weight: 400; color: var(--mut); }
.sentinel { height: 60px; }
.empty { text-align: center; color: var(--mut); padding: 60px 0; font-size: 16px; }

/* ── Overlay / detail ── */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.detail-card { background: #fff; border-radius: 20px; width: 100%; max-width: 720px;
  max-height: 92vh; overflow-y: auto; position: relative; padding: 22px; }
.detail-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: var(--bg); font-size: 16px; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-img { aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; }
.detail-img .noimg { font-size: 72px; opacity: .15; }
.detail-info h2 { font-size: 19px; line-height: 1.4; margin-bottom: 4px; }
.detail-name-en { font-size: 13.5px; color: var(--mut); margin-bottom: 8px; }
.sec-title { font-size: 13px; color: var(--mut); font-weight: 600; margin-top: 14px; }

/* หมวดหมู่สินค้าแบบ grid ไอคอน */
.categ-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  margin-top: 14px; }
.categ-card { background: var(--bg); border-radius: var(--r); padding: 16px 8px; text-align: center;
  cursor: pointer; transition: transform .1s; }
.categ-card:active { transform: scale(.95); }
.categ-icon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.categ-name { font-size: 13px; font-weight: 600; min-height: 34px; }
.categ-n { font-size: 11.5px; color: var(--mut); margin-top: 2px; }

/* หน่วย + จำนวน */
.unit-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.unit-name { font-weight: 600; font-size: 15px; }
.unit-price { color: var(--blue-d); font-weight: 700; }
.qty-ctl { display: flex; align-items: center; gap: 6px; }
.qty-ctl button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--blue-d); }
.qty-ctl input { width: 62px; height: 38px; text-align: center; font-size: 16px; font-weight: 600;
  border: 1.5px solid var(--line); border-radius: 10px; }
.promo-box { border: 1px solid #ffe0b2; background: #fff8f0; border-radius: 10px;
  padding: 10px 12px; margin-top: 8px; font-size: 13.5px; }
.promo-head { font-weight: 700; color: var(--amber); }
.gift-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.gift-img { width: 48px; height: 48px; border-radius: 8px; object-fit: contain;
  border: 1px solid var(--line); background: #fff; }
.gift-free { font-size: 13.5px; font-weight: 700; color: var(--red); }

/* ── Cart ── */
.cart-item { display: flex; gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--line); }
.cart-img { width: 54px; height: 54px; border-radius: 10px; object-fit: contain;
  border: 1px solid var(--line); flex: none; background: #fff; }
.cart-info { flex: 1; min-width: 0; }
.cart-name { font-size: 13.5px; font-weight: 500; }
.cart-sub { font-size: 12px; color: var(--mut); }
.cart-amt { font-weight: 700; color: var(--blue-d); white-space: nowrap; }
.cart-del { border: 0; background: none; color: var(--red); font-size: 16px; cursor: pointer; }
.cart-total { display: flex; justify-content: space-between; font-size: 17px; font-weight: 800;
  padding: 14px 0 6px; }
.cart-note { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px;
  font-size: 14px; font-family: inherit; margin-top: 8px; }

/* ── Coupons ── */
.coupon-row { display: flex; gap: 8px; margin: 12px 0; }
.coupon-row input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; }
.coupon-apply-btn { border: 0; background: var(--blue); color: #fff; font-weight: 700;
  font-size: 13.5px; padding: 0 16px; border-radius: 10px; cursor: pointer; }
.coupon-applied { display: flex; align-items: center; gap: 8px; background: #e8f5e9;
  color: var(--green); border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
.coupon-x { border: 0; background: none; color: var(--green); font-size: 15px; cursor: pointer; }
.coupon-card { border: 1.5px dashed var(--blue); border-radius: 12px; padding: 14px;
  margin-bottom: 12px; position: relative; }
.coupon-code-big { font-size: 19px; font-weight: 800; color: var(--blue-d); letter-spacing: .5px; }
.coupon-title { font-size: 14px; margin-top: 2px; }
.coupon-cond { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.coupon-use-btn { margin-top: 10px; border: 0; background: var(--blue); color: #fff;
  font-weight: 700; font-size: 13px; padding: 8px 16px; border-radius: 10px; cursor: pointer; }

/* ── Orders / timeline ── */
.ord-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px; cursor: pointer; position: relative; }
.ord-no { font-weight: 700; }
.ord-sub { font-size: 12.5px; color: var(--mut); margin-top: 3px; }
.ord-st { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 12px; background: #e3f2fd; color: var(--blue-d); }
.ord-st.DELIVERED { background: #e8f5e9; color: var(--green); }
.ord-st.CANCELLED { background: #ffebee; color: var(--red); }
.ord-st.NEW { background: #fff3e0; color: var(--amber); }
.reorder-btn { display: block; margin: 10px 0 0 auto; border: 1.5px solid var(--blue);
  background: #fff; color: var(--blue-d); font-weight: 700; font-size: 12.5px;
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-family: inherit; }
.reorder-btn:active { transform: scale(.96); }
.tl { margin-top: 10px; border-left: 2.5px solid #bbdefb; padding-left: 14px; }
.tl-item { position: relative; padding: 6px 0; font-size: 13.5px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 12px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--blue); }
.tl-when { font-size: 11.5px; color: var(--mut); }
.eta-box { background: #e8f5e9; color: var(--green); font-weight: 600; border-radius: 10px;
  padding: 8px 12px; margin-top: 8px; font-size: 13.5px; }

/* ── Lightbox (ขยายรูป) ── */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(10,15,25,.88);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 96%; max-height: 96%; object-fit: contain; border-radius: 12px;
  background: #fff; box-shadow: 0 10px 50px rgba(0,0,0,.5); }
.detail-img img, .gift-img { cursor: zoom-in; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 12px 22px; border-radius: 24px; font-size: 14px;
  z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.skel { background: linear-gradient(90deg,#eef1f5 25%,#f7f9fb 50%,#eef1f5 75%);
  background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: var(--r); height: 280px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ── Top 10 สินค้าขายดี ── */
.top10-sub { color: var(--mut); font-size: 13.5px; margin: 4px 0 16px; }
.rank-badge {
  background: var(--blue-d); color: #fff; font-weight: 700; font-size: 12px;
  padding: 4px 10px; border-radius: 14px; align-self: flex-start;
}
.badge-best {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; align-items: center; gap: 3px;
  background: linear-gradient(135deg, var(--amber), var(--red)); color: #fff;
  font-weight: 700; font-size: 12px; padding: 4px 10px 4px 6px; border-radius: 14px;
  box-shadow: 0 2px 8px rgba(198,40,40,.4);
  animation: badgePulse 1.8s ease-in-out infinite;
}
.badge-best .flame { animation: flameFlicker 1s ease-in-out infinite; display:inline-block; }
@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(198,40,40,.4), 0 0 0 0 rgba(239,108,0,.5); }
  50% { transform: scale(1.07); box-shadow: 0 2px 10px rgba(198,40,40,.45), 0 0 0 7px rgba(239,108,0,0); }
}
@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  30% { transform: scale(1.1) rotate(2deg); }
  60% { transform: scale(.95) rotate(-3deg); }
}
/* นาทีทอง ราคาพิเศษ */
.flash-box {
  border-radius: 12px; padding: 14px 16px; margin-top: 10px; color: #fff;
  background: linear-gradient(135deg, #4a148c, #7b1fa2 55%, var(--red));
  box-shadow: 0 6px 20px rgba(123,31,162,.35);
}
.flash-price { font-size: 26px; font-weight: 800; }
.flash-orig { font-size: 15px; text-decoration: line-through; opacity: .7; margin-left: 10px; }
.flash-window {
  font-size: 12.5px; margin-top: 8px; display: inline-block;
  background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: 10px;
}
