*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #ee4d2d;
  --orange-light: #fff2f0;
  --orange-mid: #ffd5cc;
  --bg: #f5f5f5;
  --white: #fff;
  --border: #e8e8e8;
  --text: #222;
  --text-2: #555;
  --text-3: #999;
  --green: #26aa63;
  --red: #e53935;
  --gold: #f5a623;
  --radius: 4px;
}

html { font-size: 14px; }
body { font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
}
.topbar-back {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); text-decoration: none; flex-shrink: 0;
}
.topbar-name {
  flex: 1; min-width: 0; font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-share {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); flex-shrink: 0;
}

/* ── SELLER CARD ── */
.seller-card {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px;
}
.seller-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

.avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Kanit', sans-serif; font-size: 24px; font-weight: 600;
  flex-shrink: 0; position: relative; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.online-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--white);
}

.seller-info { flex: 1; min-width: 0; }
.seller-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.seller-name { font-family: 'Kanit', sans-serif; font-weight: 600; font-size: 16px; }
.badge-verified {
  font-size: 11px; padding: 1px 8px; border-radius: 20px;
  background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9;
}
.badge-own {
  font-size: 11px; padding: 1px 8px; border-radius: 20px;
  background: var(--orange-light); color: var(--orange); border: 1px solid var(--orange-mid);
}
.seller-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rating-inline { color: var(--gold); font-size: 12px; }

.seller-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-chat {
  padding: 7px 16px; border-radius: var(--radius); font-size: 13px; font-family: 'Kanit', sans-serif;
  border: 1px solid var(--border); background: var(--white); color: var(--text); cursor: pointer;
}
.btn-follow {
  padding: 7px 16px; border-radius: var(--radius); font-size: 13px; font-family: 'Kanit', sans-serif;
  border: 1px solid var(--orange); background: var(--orange); color: #fff; cursor: pointer;
}
.btn-chat:hover { background: var(--bg); }
.btn-follow:hover { background: #d9401f; }

.seller-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 14px;
  padding: 10px 12px; background: var(--bg); border-radius: var(--radius);
}

.stats-row {
  display: flex; border-top: 1px solid var(--border); padding-top: 14px;
}
.stat-item { flex: 1; text-align: center; border-right: 1px solid var(--border); }
.stat-item:last-child { border-right: none; }
.stat-val { font-family: 'Kanit', sans-serif; font-size: 18px; font-weight: 600; color: var(--text); }
.stat-val.accent { color: var(--orange); }
.stat-lbl { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ── TABS ── */
.tabs {
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto; scrollbar-width: none; margin-top: 8px;
  position: sticky; top: 52px; z-index: 90;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0; padding: 12px 20px;
  font-size: 13px; font-family: 'Kanit', sans-serif; font-weight: 500;
  color: var(--text-3); border: none; border-bottom: 2px solid transparent;
  background: none; cursor: pointer; transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }
.tab-btn .count {
  display: inline-block; font-size: 11px; margin-left: 4px;
  background: var(--bg); color: var(--text-2); padding: 0 6px; border-radius: 10px;
}
.tab-btn.active .count { background: var(--orange-light); color: var(--orange); }

/* ── FILTER / SORT ── */
.filter-bar {
  background: var(--white); padding: 10px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; font-size: 12px; padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); cursor: pointer; white-space: nowrap; transition: all .15s;
}
.chip.active { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }

.sort-bar {
  background: var(--white); padding: 8px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sort-count { font-size: 12px; color: var(--text-3); }
.sort-count span { color: var(--text); font-weight: 500; }
.sort-select {
  font-size: 12px; font-family: 'Sarabun', sans-serif;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 10px; background: var(--white); color: var(--text-2); cursor: pointer; outline: none;
}
.sort-select:focus { border-color: var(--orange); }

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px; padding: 8px; background: var(--bg);
}
@media (min-width: 480px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(5, 1fr); } }

/* ── PRODUCT CARD ── */
.p-card {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 0 0 1px var(--border);
  transition: box-shadow .2s, transform .2s;
  position: relative;
}
.p-card:hover {
  box-shadow: 0 4px 20px rgba(238,77,45,.13), 0 0 0 1px var(--orange);
  transform: translateY(-2px);
}

/* Image */
.p-img-wrap {
  position: relative; width: 100%; padding-top: 68%;
  background: #f9f9f9; overflow: hidden;
}
.p-img-wrap img {
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  transition: transform .35s ease;
}
.p-card:hover .p-img-wrap img {
  transform: translate(-50%, -50%) scale(1.06);
}

/* Badges */
.feat-badge {
  position: absolute; top: 0; left: 0;
  background: linear-gradient(90deg, #ff6b35, var(--orange));
  color: #fff; font-size: 9px; font-family: 'Kanit', sans-serif; font-weight: 600;
  padding: 3px 9px; border-radius: 0 0 8px 0;
  box-shadow: 0 2px 6px rgba(238,77,45,.3);
}
.sold-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center;
}
.sold-label {
  font-family: 'Kanit', sans-serif; font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.5); padding: 3px 12px;
  border-radius: 4px; letter-spacing: 1px;
}
.discount-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--red); color: #fff;
  font-size: 10px; font-family: 'Kanit', sans-serif; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(229,57,53,.35);
}
.avail-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
}

/* Card Info */
.p-info { padding: 9px 10px 10px; }

.p-title {
  font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 35px; margin-bottom: 5px;
}

/* ชื่อร้าน + ดาว */
.p-shop-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px; gap: 4px;
}
.p-shop-name {
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}
.p-shop-name i { font-size: 9px; color: var(--orange); flex-shrink: 0; }
.p-shop-rating {
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0;
}
.star-ic { color: var(--gold); font-size: 11px; }
.p-shop-rcnt { font-size: 10px; color: var(--text-3); }
.p-no-review { font-size: 10px; color: var(--text-3); }

/* Price block */
.p-price-block {
  display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px;
}
.p-original-price {
  font-size: 10px; color: var(--text-3); text-decoration: line-through; line-height: 1.2;
}
.p-price {
  font-family: 'Kanit', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--orange); line-height: 1.1;
}
.p-discount-pct {
  font-size: 10px; font-family: 'Kanit', sans-serif; font-weight: 600;
  color: var(--red); line-height: 1.2;
}

/* Bottom row */
.p-bottom-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 7px; border-top: 1px solid var(--border);
}
.p-views { font-size: 11px; color: var(--text-3); }
.p-view-btn {
  flex-shrink: 0;
  font-size: 10px; font-family: 'Kanit', sans-serif; font-weight: 500;
  padding: 4px 10px; border-radius: 5px;
  background: var(--orange-light); color: var(--orange);
  border: 1px solid var(--orange-mid); transition: all .15s;
}
.p-card:hover .p-view-btn { background: var(--orange); color: #fff; border-color: var(--orange); }

.empty-state { grid-column: 1/-1; text-align: center; padding: 48px 16px; color: var(--text-3); }
.empty-state i { font-size: 36px; margin-bottom: 10px; opacity: .3; display: block; }

/* ── REVIEW TAB ── */
.review-summary {
  background: var(--white); padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px;
}
.review-big-score {
  font-family: 'Kanit', sans-serif; font-size: 44px; font-weight: 600;
  color: var(--orange); line-height: 1; text-align: center; flex-shrink: 0;
}
.stars-display { display: flex; gap: 2px; margin: 4px 0; justify-content: center; }
.star-i { font-size: 13px; color: var(--gold); }
.star-i.empty { color: #ddd; }
.rev-cnt { font-size: 12px; color: var(--text-3); text-align: center; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bar-num { font-size: 12px; color: var(--gold); width: 8px; text-align: right; }
.bar-track { flex: 1; height: 4px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--gold); border-radius: 4px; }
.bar-cnt { font-size: 11px; color: var(--text-3); width: 20px; text-align: right; }

.review-list { background: var(--white); }
.review-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 12px;
}
.rev-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange-light); color: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Kanit', sans-serif; font-size: 14px; font-weight: 600;
}
.rev-body { flex: 1; min-width: 0; }
.rev-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rev-name { font-weight: 500; font-size: 13px; }
.rev-stars { display: flex; gap: 1px; }
.rev-star { font-size: 12px; color: var(--gold); }
.rev-star.empty { color: #ddd; }
.rev-comment { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.rev-date { font-size: 11px; color: var(--text-3); margin-top: 5px; }

.no-review { text-align: center; padding: 48px 16px; color: var(--text-3); }
.no-review i { font-size: 36px; opacity: .2; display: block; margin-bottom: 10px; }

/* ── ABOUT TAB ── */
.about-section { background: var(--white); margin-top: 8px; }
.about-shop-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.about-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Kanit', sans-serif; font-size: 20px; font-weight: 600; overflow: hidden;
}
.about-avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-shop-name { font-family: 'Kanit', sans-serif; font-weight: 600; font-size: 15px; }
.about-shop-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.info-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.info-icon { width: 18px; text-align: center; color: var(--text-3); font-size: 13px; flex-shrink: 0; }
.info-label { font-size: 12px; color: var(--text-3); margin-bottom: 1px; }
.info-val { font-size: 13px; color: var(--text); font-weight: 500; }

.desc-block { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.desc-block p { font-size: 13px; color: var(--text-2); line-height: 1.7; }

.guarantee-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.guarantee-icon {
  width: 36px; height: 36px; border-radius: var(--radius); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.guarantee-title { font-size: 13px; font-weight: 500; color: var(--text); }
.guarantee-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ── MOBILE BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white); border-top: 1px solid var(--border);
  height: 56px; display: flex; align-items: center; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-3); text-decoration: none; font-size: 10px;
  font-family: 'Kanit', sans-serif; padding: 0 8px; min-width: 44px;
  transition: color .15s;
}
.nav-item:hover, .nav-item.active { color: var(--orange); }
.nav-item i { font-size: 20px; }

.nav-add {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--orange); color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; margin-top: -8px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(238,77,45,.3);
}

.main-wrap { padding-bottom: 72px; }
@media (min-width: 768px) { .main-wrap { padding-bottom: 0; } }

.tab-content { display: none; }
.tab-content.active { display: block; }