@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&display=swap");

/* ═══════════════════════════════════════════════
   VARIABLES
═══════════════════════════════════════════════ */
:root {
  --orange: #ff6b00;
  --orange-l: #ff8534;
  --orange-dim: rgba(255, 107, 0, 0.1);
  --red: #c0392b;
  --red-l: #e74c3c;
  --r: 14px;
  --r-sm: 8px;
  --nav-h: 58px;
  --cat-h: 46px;
}

[data-theme="light"],
:root {
  --bg: #f2f3f7;
  --bg-card: #ffffff;
  --bg-input: #f0f1f5;
  --nav-bg: #ffffff;
  --border: #e6e7ec;
  --border-l: #f0f1f5;
  --text: #111827;
  --text-s: #4b5563;
  --text-xs: #9ca3af;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-h: 0 4px 16px rgba(0, 0, 0, 0.12), 0 12px 40px rgba(0, 0, 0, 0.08);
  --overlay: rgba(0, 0, 0, 0.5);
  --img-bg: #f5f6fa;
  --toggle-bg: #e0e2ea;
  --footer-bg: #111827;
}

[data-theme="dark"] {
  --bg: #0d0e14;
  --bg-card: #181924;
  --bg-input: #21222f;
  --nav-bg: #13141e;
  --border: #2a2b3d;
  --border-l: #22233a;
  --text: #f0f1f8;
  --text-s: #9095b0;
  --text-xs: #5a5f7a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-h: 0 4px 16px rgba(0, 0, 0, 0.5), 0 12px 40px rgba(0, 0, 0, 0.4);
  --overlay: rgba(0, 0, 0, 0.75);
  --img-bg: #21222f;
  --toggle-bg: #ff6b00;
  --footer-bg: #0a0b10;
}

/* ═══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  transition:
    background 0.2s,
    color 0.2s;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
}
img {
  display: block;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════ */
.navbar {
  background: var(--nav-bg);
  height: var(--nav-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background 0.2s;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  min-width: 0;
}
.nav-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-search {
  flex: 1;
  position: relative;
  min-width: 0;
}
.nav-search input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  font-family: "DM Sans", sans-serif;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.nav-search input::placeholder {
  color: var(--text-xs);
}
.nav-search input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--orange-dim);
  background: var(--bg-card);
}
.nav-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.nav-search .search-icon {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-xs);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.15s,
    background 0.15s;
}
.nav-search .search-icon:hover {
  color: var(--red);
  background: var(--orange-dim);
}
.nav-search .search-icon:active {
  transform: scale(0.92);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn-cart {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition:
    background 0.15s,
    transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-cart:hover {
  background: var(--red-l);
}
.btn-cart:active {
  transform: scale(0.96);
}

.cart-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}
.cart-badge.bump {
  animation: badge-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes badge-pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.9);
  }
  65% {
    transform: scale(0.82);
  }
  82% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

/* ── Flying dot: travels from Add-to-Cart button → cart icon ── */
.fly-dot {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 9999;
  will-change: transform, opacity;
}

/* ── Cart item slide-in when newly added ── */
.cart-item {
  display: flex;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-l);
  align-items: flex-start;
  overflow: hidden;
}
.cart-item.item-enter {
  animation: item-enter 0.38s cubic-bezier(0.22, 0.68, 0, 1.15) both;
}
@keyframes item-enter {
  0% {
    opacity: 0;
    transform: translateX(32px) scale(0.94);
  }
  55% {
    opacity: 1;
  }
  78% {
    transform: translateX(-3px) scale(1.02);
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* ── Add-to-cart button success pulse ── */
@keyframes btn-success-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  60% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Home page: category bar blends into the page instead of a solid card color */
body.is-home .category-bar {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════
   CATEGORY BAR
═══════════════════════════════════════════════ */
.category-bar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  z-index: 190;
  transition: background 0.2s;
}
.category-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-tabs::-webkit-scrollbar {
  display: none;
}
.cat-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 12.5px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-s);
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.cat-tab:hover {
  border-color: var(--red-l);
  color: var(--red-l);
}
.cat-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════
   MAIN CONTAINER
═══════════════════════════════════════════════ */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  transition: opacity 0.15s ease;
  scroll-margin-top: calc(var(--nav-h) + 8px);
}
.main-container.is-loading {
  opacity: 0.5;
  pointer-events: none;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text);
}
.section-title h2 span {
  color: var(--red);
  font-size: 16px;
}
.see-all {
  color: var(--red);
  font-weight: 700;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════
   HERO SLIDESHOW
═══════════════════════════════════════════════ */
.slideshow {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 20px;
  aspect-ratio: 16/6;
  background: var(--img-bg);
  box-shadow: var(--shadow);
}
@media (max-width: 600px) {
  .slideshow {
    aspect-ratio: 16/7;
  }
}
.slideshow-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.slide-clickable {
  cursor: pointer;
}
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}
.slide-caption {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.12) 55%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 28px;
  gap: 3px;
  pointer-events: none;
}
.slide-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(28px, 6vw, 52px);
  color: #fff;
  letter-spacing: 2px;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  max-width: 55%;
}
.slide-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  max-width: 50%;
  line-height: 1.4;
}
.ss-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}
.ss-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: none;
  cursor: pointer;
  transition:
    background 0.2s,
    width 0.2s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.ss-dot.active {
  background: #fff;
  width: 20px;
  border-radius: 4px;
}
.ss-dot:hover {
  background: rgba(255, 255, 255, 0.75);
}

/* ═══════════════════════════════════════════════
   GROUP CARDS (Home)
═══════════════════════════════════════════════ */
.groups-section {
  margin-bottom: 24px;
}
.groups-section-label {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-xs);
  margin-bottom: 10px;
  padding-left: 2px;
}
.groups-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group-card-hero {
  height: 200px;
}
.group-card-feature {
  height: 160px;
}
.groups-row-small {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.group-card-small {
  height: 140px;
}
.group-card {
  display: block;
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(160deg, #1e1e2e 0%, #141420 100%);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
}
.group-card--soon {
  cursor: default;
  background: linear-gradient(160deg, #c8cacf 0%, #a0a3ab 100%);
}
.group-card--soon:hover {
  transform: none;
  box-shadow: none;
}
.group-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.48) 0%,
    rgba(0, 0, 0, 0.16) 50%,
    rgba(0, 0, 0, 0.02) 100%
  );
}
.group-card-body {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.group-card-badge {
  display: inline-flex;
  align-items: center;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
  width: fit-content;
}
.group-card-name {
  font-family: "Bebas Neue", sans-serif;
  font-size: 28px;
  color: #fff;
  letter-spacing: 2px;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.group-card-hero .group-card-name {
  font-size: 28px;
}
.group-card-feature .group-card-name {
  font-size: 26px;
}
.group-card-small .group-card-name {
  font-size: 20px;
}
.group-card-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════
   GROUP DETAIL BANNER
═══════════════════════════════════════════════ */
.group-detail-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--bg-card);
  background-size: cover;
  background-position: center;
  min-height: 160px;
  display: flex;
  align-items: flex-end;
}
.group-detail-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.18) 55%,
    transparent 100%
  );
}
.group-detail-body {
  position: relative;
  z-index: 1;
  padding: 18px 20px;
  width: 100%;
}
.group-detail-name {
  font-family: "Bebas Neue", sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
.group-detail-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 10px;
  line-height: 1;
}

/* ═══════════════════════════════════════════════
   PRODUCTS GRID
═══════════════════════════════════════════════ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
  }
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-l);
  -webkit-tap-highlight-color: transparent;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-h);
}

.product-img-wrap {
  background: var(--img-bg);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  box-sizing: border-box;
  transition: transform 0.3s;
}
.product-card:hover .product-img-wrap img {
  transform: scale(1.06);
}
.img-fallback {
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}
.product-badge.new {
  background: #22c55e;
}
.product-badge.hot {
  background: var(--red);
}
.product-badge.sale {
  background: var(--red);
}

.product-info {
  padding: 9px 10px 4px;
}
.product-name {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.product-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.price-khr {
  font-size: 16px;
  font-weight: 800;
  color: var(--red);
}
.price-usd {
  font-size: 11px;
  color: var(--text-xs);
  font-weight: 500;
}
.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 2px;
}
.sold-count {
  font-size: 10px;
  color: var(--text-xs);
  font-weight: 500;
}
.stock-in {
  font-size: 10px;
  color: #22c55e;
  font-weight: 700;
}
.stock-out {
  font-size: 10px;
  color: #ef4444;
  font-weight: 700;
}

.add-btn {
  display: block;
  width: calc(100% - 18px);
  margin: 6px 9px 10px;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.add-btn:hover {
  background: var(--red-l);
}
.add-btn.sold-out {
  background: var(--border);
  color: var(--text-xs);
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════
   EMPTY STATE & PAGINATION
═══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-xs);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 28px 0 8px;
  flex-wrap: wrap;
}
.page-numbers {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-btn {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.page-btn:hover,
.page-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.page-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.page-btn.page-prev,
.page-btn.page-next {
  font-weight: 800;
  padding: 7px 16px;
}
.page-dots {
  align-self: center;
  color: var(--text-xs);
  font-weight: 600;
  padding: 0 2px;
}

/* ═══════════════════════════════════════════════
   PRODUCT DETAIL SHEET
═══════════════════════════════════════════════ */
.pd-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.pd-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.pd-sheet {
  background: var(--bg-card);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 93vh;
  max-height: 93dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  border-top: 1px solid var(--border);
}
.pd-overlay.active .pd-sheet {
  transform: translateY(0);
}
.pd-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}
.pd-back {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--bg-input);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: var(--text);
}
.pd-hero {
  background: var(--img-bg);
  width: 100%;
  padding: 16px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  position: relative;
  touch-action: pan-y;
}
.pd-hero #pd-main-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.pd-img-fallback {
  font-size: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.pd-fullview {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
}

.pd-info-wrap {
  padding: 14px 16px 40px;
}
.pd-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.pd-price-khr {
  font-size: 26px;
  font-weight: 900;
  color: var(--red);
}
.pd-price-usd {
  font-size: 15px;
  color: var(--text-xs);
  font-weight: 500;
}
.pd-in-stock {
  color: #22c55e;
  font-weight: 800;
  font-size: 12px;
}
.pd-out-stock {
  color: #ef4444;
  font-weight: 800;
  font-size: 12px;
}

.pd-preview-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-xs);
  margin: 12px 0 7px;
  text-transform: uppercase;
}
.pd-thumbs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.pd-thumbs::-webkit-scrollbar {
  display: none;
}
.pd-thumb {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--img-bg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: border-color 0.15s;
}
.pd-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pd-thumb.active {
  border-color: var(--red);
}
.pd-thumb:hover {
  border-color: var(--red-l);
}

.pd-name {
  font-size: 17px;
  font-weight: 700;
  margin: 12px 0 6px;
  line-height: 1.35;
  color: var(--text);
}
.pd-desc {
  font-size: 13px;
  color: var(--text-s);
  line-height: 1.7;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.pd-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pd-qty-label {
  font-weight: 700;
  font-size: 14px;
}
.pd-qty-ctrl {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
}
.pd-qty-btn {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  transition: background 0.1s;
}
.pd-qty-btn:hover {
  background: var(--bg-input);
}
.pd-qty-val {
  width: 38px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
}

.pd-add-btn {
  display: block;
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: background 0.15s;
}
.pd-add-btn:hover {
  background: var(--red-l);
}
.pd-add-btn:disabled {
  background: var(--border);
  color: var(--text-xs);
  cursor: not-allowed;
  opacity: 0.7;
}

.pd-selected-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  margin: 3px 0 8px;
}
.pd-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}
.pd-variant-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  font-family: "DM Sans", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.pd-variant-btn:hover {
  border-color: var(--red-l);
  color: var(--red-l);
}
.pd-variant-btn.active {
  border-color: var(--red);
  background: var(--red-dim);
  color: var(--red);
}

/* ═══════════════════════════════════════════════
   LIGHTBOX
   .lightbox is the scrollable viewport (overflow: auto
   in BOTH axes). .lightbox-inner is at least 100% of the
   viewport and centers its content with flex — but once
   the zoomed image is larger than the viewport, the inner
   frame grows with it, which is what gives .lightbox real
   scrollable area on every side instead of just clipping.
═══════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 999;
  display: none;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: zoom-out;
  -webkit-overflow-scrolling: touch;
}
.lightbox-inner {
  min-width: 100%;
  min-height: 100%;
  width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox img {
  max-width: calc(100vw - 40px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  transition: max-width 0.2s, max-height 0.2s, transform 0.22s ease, opacity 0.22s ease;
  will-change: transform, opacity;
}
.lightbox img.zoomed {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  cursor: zoom-out;
  border-radius: 0;
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lightbox-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  pointer-events: none;
  white-space: nowrap;
}

.lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s, transform 0.15s;
}
.lightbox-arrow:hover  { background: rgba(255, 255, 255, 0.22); }
.lightbox-arrow:active { transform: translateY(-50%) scale(0.9); }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }

/* ═══════════════════════════════════════════════
   CART PANEL
═══════════════════════════════════════════════ */
.cart-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 380px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  z-index: 600;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  transition: right 0.28s ease;
  border-left: 1px solid var(--border);
}
.cart-panel.open {
  right: 0;
}
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cart-header h3 {
  font-size: 16px;
  font-weight: 800;
}
.close-btn {
  background: var(--bg-input);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover {
  background: var(--border);
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}
.cart-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-xs);
}
.cart-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 10px;
}
.cart-item-img-wrap {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--img-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-item-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.cart-ph {
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-item-price {
  color: var(--red);
  font-weight: 800;
  font-size: 13px;
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.qty-sm-btn {
  background: var(--bg-input);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-sm-btn:hover {
  background: var(--border);
}
.qty-val {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
}
.remove-item {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  margin-left: 4px;
}
.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-total {
  margin-bottom: 11px;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-xs);
  margin-bottom: 4px;
}
.cart-total-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 13px;
}
.cart-grand-khr {
  font-size: 20px;
  font-weight: 900;
  color: var(--orange);
}
.cart-grand-usd {
  font-size: 13px;
  color: var(--text-xs);
  margin-left: 4px;
}
.btn-checkout {
  display: block;
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: background 0.15s;
}
.btn-checkout:hover {
  background: var(--red-l);
}
#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 550;
  display: none;
}

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 12.5px;
  z-index: 9999;
  transition: transform 0.25s;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.success {
  background: #22c55e;
  color: #fff;
}
.toast.error {
  background: #ef4444;
  color: #fff;
}

/* ═══════════════════════════════════════════════
   CHECKOUT MODAL
═══════════════════════════════════════════════ */
.co-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 700;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.co-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.co-sheet {
  background: var(--bg-card);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  padding: 0 0 32px;
  border-top: 1px solid var(--border);
}
.co-overlay.active .co-sheet {
  transform: translateY(0);
}
.co-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}
.co-title {
  font-size: 16px;
  font-weight: 800;
}
.co-items {
  padding: 10px 16px;
}
.co-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-l);
}
.co-item:last-child {
  border-bottom: none;
}
.co-item-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: var(--img-bg);
  border-radius: 10px;
  padding: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.co-item-info {
  flex: 1;
  min-width: 0;
}
.co-item-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.co-item-price {
  font-size: 12px;
  color: var(--text-s);
}
.co-item-price strong {
  color: var(--red);
}
.co-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--orange-dim);
  border-top: 1.5px solid rgba(255, 107, 0, 0.18);
  border-bottom: 1.5px solid rgba(255, 107, 0, 0.18);
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 14px;
}
.co-total-khr {
  font-size: 20px;
  font-weight: 900;
  color: var(--red);
}
.co-total-usd {
  font-size: 12px;
  color: var(--text-xs);
  margin-left: 5px;
}
.co-form {
  padding: 0 16px 10px;
}
.co-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.co-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-s);
  margin-bottom: 4px;
}
.co-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.2s;
}
.co-input::placeholder {
  color: var(--text-xs);
}
.co-input:focus {
  border-color: var(--red);
  background: var(--bg-card);
}
#co-status {
  margin: 8px 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
}
.co-status-ok {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  text-align: center;
  padding: 14px;
}
.co-status-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
.co-status-err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
[data-theme="dark"] .co-status-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}
[data-theme="dark"] .co-status-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
[data-theme="dark"] .co-status-err {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.co-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 32px);
  margin: 0 16px;
  background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: opacity 0.15s;
  box-shadow: 0 3px 12px rgba(42, 171, 238, 0.3);
}
.co-send-btn:hover {
  opacity: 0.9;
}
.co-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
footer {
  background: var(--footer-bg);
  color: rgba(255, 255, 255, 0.55);
  padding: 32px 16px 20px;
  margin-top: 36px;
}
.footer-grid {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}
.footer-col h4 {
  color: #fff;
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.footer-col ul {
  list-style: none;
}
.footer-col ul li {
  margin-bottom: 6px;
}
.footer-col ul li a {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12.5px;
  transition: color 0.15s;
}
.footer-col ul li a:hover {
  color: var(--red);
}
.footer-tg-btn {
  background: #1877f2;
  box-shadow: 0 3px 10px rgba(24, 119, 242, 0.3);
}
.footer-tg-btn:hover {
  transform: scale(1.12);
  opacity: 0.9;
}
.footer-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  transition:
    transform 0.15s,
    opacity 0.15s;
  margin-top: 6px;
}
.footer-social-btn:hover {
  transform: scale(1.12);
  opacity: 0.9;
}
.footer-fb-btn {
  background: #1877f2;
  box-shadow: 0 3px 10px rgba(24, 119, 242, 0.3);
}
.footer-tt-btn {
  background: #010101;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}
.footer-social-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  gap: 10px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — TABLET  ≤ 768px
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .footer-grid > *:first-child {
    grid-column: 1/-1;
  }
  .cart-panel {
    width: 340px;
    right: -340px;
  }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — MOBILE  ≤ 600px
═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  .cart-panel {
    width: 100%;
    right: -100%;
  }
  .co-field-row {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .footer-grid > *:first-child {
    grid-column: auto;
  }
  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
  .group-card-hero {
    height: 170px;
  }
  .group-card-feature {
    height: 140px;
  }
  .group-card-small {
    height: 120px;
  }
  .group-detail-banner {
    min-height: 130px;
  }
  .group-detail-name {
    font-family: "Bebas Neue", sans-serif;
    font-size: 20px;
  }
  
  .lightbox-arrow { width: 36px; height: 36px; font-size: 16px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE  ≤ 380px
═══════════════════════════════════════════════ */
@media (max-width: 380px) {
  .navbar {
    padding: 0 10px;
    gap: 7px;
  }
  .nav-logo img {
    height: 30px;
  }
  .btn-cart {
    padding: 7px 11px;
    font-size: 12px;
  }
  .cart-badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  .products-grid {
    gap: 8px;
  }
  .price-khr {
    font-size: 14px;
  }
}