/* ==========================================================================
   PKN SHOP - BLACK & NEON GREEN AUTOMOTIVE PERFORMANCE THEME
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-dark: #07090b;
  --bg-card: #0e1317;
  --bg-card-hover: #141c22;
  --bg-surface: #12191f;
  
  --color-primary: #00ff88;
  --color-primary-glow: rgba(0, 255, 136, 0.35);
  --color-emerald: #10b981;
  --color-accent: #00e5ff;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 255, 136, 0.3);

  /* Hairline rules used by the editorial product cards on the home page */
  --rule: rgba(255, 255, 255, 0.10);
  --rule-strong: rgba(255, 255, 255, 0.20);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-glow: 0 0 25px rgba(0, 255, 136, 0.15);
  --font-heading: 'Kanit', sans-serif;
  --font-body: 'Kanit', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Container */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Inline SVG icons used in place of emoji throughout the site */
.ico {
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.star-rating .ico {
  vertical-align: -0.2em;
}

/* Utility bar — the thin announcement + contact strip above the header */
.top-bar {
  background: #04070a;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 40px;
}

.top-bar-promo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-bar-tag {
  color: var(--color-primary);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.72rem;
  white-space: nowrap;
}

.top-bar-promo span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-shrink: 0;
}

.top-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.top-bar-link:hover {
  color: var(--color-primary);
}

.top-bar-link svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

.top-bar-link strong {
  color: #fff;
  font-weight: 600;
}

/* The bar scrolls away; only the header itself sticks */
@media (max-width: 860px) {
  .top-bar-promo {
    display: none;
  }
  .top-bar-inner {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .top-bar-links {
    gap: 14px;
  }
  .top-bar-link {
    font-size: 0.74rem;
  }
}

/* Header & Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(7, 9, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

/* 1fr | auto | 1fr keeps the nav dead-centre in the header no matter how
   wide the logo on the left or the actions on the right get */
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}

.logo-img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: var(--radius-sm);
  transition: filter 0.2s ease;
}

.logo:hover .logo-img {
  filter: brightness(1.12) drop-shadow(0 0 10px var(--color-primary-glow));
}

.logo-badge {
  background: linear-gradient(135deg, var(--color-primary), var(--color-emerald));
  color: #000;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 900;
  box-shadow: var(--shadow-glow);
}

.logo-text span {
  color: var(--color-primary);
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  list-style: none;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
  position: relative;
  padding: 6px 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--color-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
  border-radius: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.cart-icon-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* ไอคอนภายในปุ่มไม่ต้องเลื่อนแนวตั้งแบบไอคอนที่อยู่ในบรรทัดข้อความ */
.cart-icon-btn .ico,
.cart-icon-btn svg {
  vertical-align: 0;
  display: block;
}

.cart-icon-btn:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
  color: var(--color-primary);
}

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--color-primary);
  color: #04150b;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  border: 2px solid var(--bg-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  pointer-events: none;
}

/* ตะกร้าว่าง = ไม่ต้องโชว์เลข 0 ให้รก */
.cart-badge.is-zero {
  display: none;
}

.admin-btn-link {
  background: rgba(0, 255, 136, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(0, 255, 136, 0.3);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-btn-link:hover {
  background: var(--color-primary);
  color: #000;
  box-shadow: var(--shadow-glow);
}

/* Mobile Toggle - ปุ่มเมนู 3 ขีด โผล่เฉพาะจอ <=768px (ดู media query ด้านล่าง) */
.mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 0;
  line-height: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Hero Section — full-bleed banner. The photo bleeds off the right edge
   instead of sitting in a box, and a left-to-right gradient keeps the copy
   readable over it. */
.hero-section {
  position: relative;
  overflow: hidden;
  background: #05080a;
  border-bottom: 1px solid var(--border-color);
}

.hero-media {
  position: absolute;
  top: 0;
  right: 0;
  width: 62%;
  height: 100%;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
}

/* Solid on the copy side, clear over the photo */
.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #05080a 0%, rgba(5, 8, 10, 0.92) 22%, rgba(5, 8, 10, 0.45) 55%, rgba(5, 8, 10, 0.1) 100%);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 520px;
  padding: 64px 0;
}

.hero-content {
  max-width: 620px;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.12);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.3rem, 5.2vw, 4rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.hero-title .hero-line {
  display: block;
}

.hero-title .highlight {
  color: var(--color-primary);
  text-shadow: 0 0 25px rgba(0, 255, 136, 0.4), 0 0 45px rgba(0, 255, 136, 0.2);
}

.hero-subtitle {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 48ch;
  margin-bottom: 22px;
}

.hero-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.trust-item svg {
  color: var(--color-primary);
}

.trust-item:hover {
  border-color: var(--color-primary);
  background: rgba(0, 255, 136, 0.05);
}

/* Short accent rule under the content */
.hero-rule {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary) 0%, rgba(0, 255, 136, 0.2) 100%);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
  margin-top: 14px;
}

.btn-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-emerald));
  color: #051009;
  box-shadow: var(--shadow-glow);
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(0, 255, 136, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

/* Promise band — flat strip under the hero that scrolls continuously.
   The set of four is cloned by the script into an unbroken loop. */
.features-section {
  background: #0a0e11;
  border-bottom: 1px solid var(--border-color);
  padding: 0;
}

/* Heading above the scrolling band */
.features-head {
  padding: 58px 0 32px;
  text-align: center;
}

.features-head .section-title {
  margin-bottom: 8px;
}

.features-head .section-subtitle {
  margin-top: 0;
}

.marquee {
  position: relative;
  overflow: hidden;
}

/* Items fade in and out at the edges instead of being cut off mid-word */
.marquee::before,
.marquee::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 110px;
  z-index: 2;
  pointer-events: none;
}

.marquee::before {
  left: 0;
  background: linear-gradient(90deg, #0a0e11 0%, rgba(10, 14, 17, 0) 100%);
}

.marquee::after {
  right: 0;
  background: linear-gradient(270deg, #0a0e11 0%, rgba(10, 14, 17, 0) 100%);
}

.marquee-track {
  display: flex;
  width: max-content;
}

/* The animation only switches on once the script has cloned the set, so
   without JS the band stays a plain static row rather than scrolling away */
.marquee-track.is-scrolling {
  animation: promise-scroll 63s linear infinite;
}

/* Shift by exactly one set — the script sets the distance from the clone
   count so the two can never drift out of sync */
@keyframes promise-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--marquee-shift, -25%));
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track.is-scrolling {
    animation: none;
  }
}

.marquee-set {
  display: flex;
  flex: 0 0 auto;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 0 0 340px;
  width: 340px;
  padding: 26px;
  border-right: 1px solid var(--border-color);
  transition: background 0.25s ease;
}

.feature-card:hover {
  background: rgba(0, 255, 136, 0.04);
}

.feature-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.feature-text {
  min-width: 0;
}

.feature-text h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
  letter-spacing: -0.005em;
}

.feature-text p {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 35px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: #fff;
}

.section-title span {
  color: var(--color-primary);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Products Grid */
.products-section {
  padding: 70px 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}

.product-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 255, 136, 0.2);
}

.product-img-wrapper {
  height: 200px;
  background: #090c0e;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 15px;
}

.product-svg-icon {
  width: 90px;
  height: 90px;
  color: var(--color-primary);
  opacity: 0.85;
  transition: transform 0.3s ease;
}

.product-card:hover .product-svg-icon {
  transform: scale(1.1);
  opacity: 1;
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 255, 136, 0.15);
  color: var(--color-primary);
  border: 1px solid var(--border-glow);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.product-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-category {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
  line-height: 1.3;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.product-price {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  font-family: var(--font-heading);
}

.add-cart-btn {
  background: rgba(0, 255, 136, 0.12);
  color: var(--color-primary);
  border: 1px solid var(--border-glow);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-cart-btn:hover {
  background: var(--color-primary);
  color: #000;
  box-shadow: var(--shadow-glow);
}

/* ==========================================================================
   EDITORIAL PRODUCT SECTION (home page only)
   Scoped to .products-section--editorial so /products/ keeps its original look.
   Same black + neon green palette; the layout language comes from the
   reference board: small letter-spaced kickers, hairline rules instead of
   glow, photos doing the work, and a rule-divided strip along the card foot.
   ========================================================================== */

.products-section--editorial {
  padding: 30px 0 90px;
}

/* --- Kicker above the heading --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.eyebrow::after {
  content: '/';
  color: var(--color-primary);
  font-weight: 700;
  letter-spacing: 0;
}

/* --- Section head: bigger type, closed by a hairline --- */
.products-section--editorial .section-header {
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 44px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.products-section--editorial .section-title {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
}

.products-section--editorial .section-subtitle {
  line-height: 1.7;
  margin-top: 10px;
  max-width: 52ch;
}

/* Quiet underlined action in place of the boxed button */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-main);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}

.link-arrow:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* --- Cards --- */
/* --- Mosaic ---------------------------------------------------------------
   A fixed row height lets the feature tile span 2x2 while the standard tiles
   pack around it; grid-auto-flow: dense backfills any gap it leaves.

   The reference board can bleed a photo to the edges of a big tile because it
   uses lifestyle photography, which crops well at any aspect. These are
   catalogue shots — a part centred on a light background, often with a label —
   so a tall crop cuts the product in half, and a dark scrim over a light photo
   turns the copy to mud. The feature tile is therefore a scaled-up version of
   the normal card: photo on top at a wide aspect, copy below on solid ground.
   -------------------------------------------------------------------------- */
.products-section--editorial .product-grid {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 470px;
  grid-auto-flow: row dense;
  gap: 22px;
}

.products-section--editorial .product-card {
  border-color: var(--rule);
  border-radius: var(--radius-xl);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.products-section--editorial .product-card:hover {
  border-color: var(--rule-strong);
  transform: translateY(-3px);
  box-shadow: none;
}

/* The card is a flex column: the body takes exactly the height its text needs
   and the photo absorbs every remaining pixel. Card heights stay locked to the
   grid and nothing clips, at either tile size. */
.products-section--editorial .product-img-wrapper {
  flex: 1 1 auto;
  height: auto;
  min-height: 170px;
  padding: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.products-section--editorial .product-img-wrapper img {
  transition: transform 0.5s var(--ease);
}

.products-section--editorial .product-card:hover .product-img-wrapper img {
  transform: scale(1.045);
}

.products-section--editorial .product-badge {
  top: 14px;
  left: 14px;
  background: rgba(4, 7, 9, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--rule-strong);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 13px;
  border-radius: var(--radius-full);
}

.products-section--editorial .product-body {
  flex: 0 0 auto;
  padding: 24px 24px 0;
}

/* Category reads as a kicker, not a coloured tag */
.products-section--editorial .product-category {
  font-size: 0.66rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.18em;
}

/* Clamped to two lines so every body is the same height and the photos across
   a row all land on the same baseline */
.products-section--editorial .product-name {
  font-size: 1.12rem;
  margin-bottom: 10px;
  line-height: 1.32;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.products-section--editorial .product-desc {
  line-height: 1.65;
  margin-bottom: 22px;
}

/* Foot of the card: a full-bleed strip under a hairline */
.products-section--editorial .product-footer {
  margin-left: -24px;
  margin-right: -24px;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--rule);
}

.products-section--editorial .product-price {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.products-section--editorial .add-cart-btn {
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}

.products-section--editorial .add-cart-btn:hover {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
}

/* --- The feature tile: same card, scaled up --- */
.products-section--editorial .product-card--feature {
  grid-column: span 2;
  grid-row: span 2;
}

.products-section--editorial .product-card--feature .product-body {
  padding: 30px 32px 0;
}

.products-section--editorial .product-card--feature .product-category {
  margin-bottom: 14px;
}

.products-section--editorial .product-card--feature .product-name {
  font-size: 1.6rem;
  line-height: 1.26;
  margin-bottom: 14px;
}

.products-section--editorial .product-card--feature .product-desc {
  -webkit-line-clamp: 4;
  font-size: 0.92rem;
  line-height: 1.75;
  max-width: 52ch;
  margin-bottom: 26px;
}

.products-section--editorial .product-card--feature .product-footer {
  margin-left: -32px;
  margin-right: -32px;
  padding: 20px 32px;
}

.products-section--editorial .product-card--feature .product-price {
  font-size: 1.5rem;
}

.products-section--editorial .product-card--feature .add-cart-btn {
  width: 46px;
  height: 46px;
}

/* --- Responsive: 4 -> 3 -> 2 -> 1 column --- */
@media (max-width: 1100px) {
  .products-section--editorial .product-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 460px;
  }
}

@media (max-width: 860px) {
  .products-section--editorial .product-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 450px;
  }
  .products-section--editorial .product-card--feature .product-name {
    font-size: 1.4rem;
  }
  .products-section--editorial .product-card--feature .product-desc {
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 600px) {
  .products-section--editorial .section-header {
    align-items: flex-start;
  }
  /* One column: rows size to content, so the photo needs a definite height —
     a flexible one would collapse against an auto-height row. */
  .products-section--editorial .product-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .products-section--editorial .product-img-wrapper {
    flex: 0 0 auto;
    height: 230px;
    min-height: 0;
  }
  .products-section--editorial .product-card--feature {
    grid-column: auto;
    grid-row: auto;
  }
  .products-section--editorial .product-card--feature .product-img-wrapper {
    height: 270px;
  }
  .products-section--editorial .product-card--feature .product-body {
    padding: 26px 22px 0;
  }
  .products-section--editorial .product-card--feature .product-name {
    font-size: 1.28rem;
  }
  .products-section--editorial .product-card--feature .product-footer {
    margin-left: -22px;
    margin-right: -22px;
    padding: 16px 22px;
  }
}

/* Category Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  /* หนา 600 ตลอดทุกสถานะ ไม่ให้ตัวหนังสือขยาย/หดตอนเลือก แล้วดันชิปตัวอื่นขยับ */
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* แถวชิปตัวเลือกในหน้ารายละเอียดสินค้า: คอลัมน์กว้างเท่ากันเป๊ะ
   ตำแหน่งจึงคงที่ ไม่ว่าจะเลือกอันไหนอยู่ */
.pdm-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

/* Hover เป็นแค่เส้นขอบ ไม่ถมสีเขียว เพื่อไม่ให้สับสนกับชิปที่เลือกอยู่ (หลักเดียวกับ .cc-chip) */
.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-chip.active {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

/* CC Number Pad (injector capacity picker) */
.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  grid-auto-rows: min-content;
  gap: 5px;
  height: 152px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.cc-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 0;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* Hover stays an outline so the selected chip is never ambiguous */
.cc-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.cc-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #000;
  box-shadow: var(--shadow-glow);
}

/* Search Box */
.search-box-wrapper {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px 12px 42px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  display: flex;
  align-items: center;
}

/* Cart Page & Table */
.cart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-top: 30px;
}

.cart-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item-row:last-child {
  border-bottom: none;
}

.cart-item-icon {
  width: 60px;
  height: 60px;
  background: #090c0e;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-title {
  font-weight: 600;
  font-size: 1rem;
}

.cart-item-price {
  color: var(--color-primary);
  font-weight: 700;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.qty-btn {
  background: none;
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-weight: 700;
  border-radius: 4px;
}

.qty-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.qty-val {
  font-weight: 600;
  width: 24px;
  text-align: center;
}

.remove-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* Order Summary Box */
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  height: fit-content;
}

.summary-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.summary-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 14px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.summary-row.total span:last-child {
  color: var(--color-primary);
  font-family: var(--font-heading);
}

/* Form inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-size: 0.95rem;
}

/* Payment Option Cards (Checkout) */
.payment-options-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-option-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.payment-option-card:hover {
  border-color: rgba(0, 255, 136, 0.4);
  background: rgba(0, 255, 136, 0.02);
}

.payment-option-card.is-selected {
  background: rgba(0, 255, 136, 0.06);
  border-color: var(--color-primary);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
}

.payment-option-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  outline: none;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  transition: all 0.2s ease;
}

.payment-option-card input[type="radio"]::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: scale(0);
  transition: 0.15s transform ease-in-out;
  background-color: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.payment-option-card.is-selected input[type="radio"] {
  border-color: var(--color-primary);
}

.payment-option-card input[type="radio"]:checked::before {
  transform: scale(1);
}

.payment-option-info {
  flex-grow: 1;
}

.payment-option-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.payment-option-card.is-selected .payment-option-title {
  color: var(--color-primary);
}

.payment-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.payment-option-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 255, 136, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(0, 255, 136, 0.3);
  margin-left: auto;
  flex-shrink: 0;
}

.payment-option-card.is-selected .payment-option-badge {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

/* Payment QR & Bank Box */
.payment-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  max-width: 550px;
  margin: 0 auto;
}

.qr-placeholder {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin: 20px 0;
}

.qr-placeholder svg {
  width: 180px;
  height: 180px;
}

.bank-info-box {
  background: var(--bg-dark);
  border: 1px dashed var(--border-glow);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  text-align: left;
}

.bank-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

/* Slip Upload Dropzone */
.slip-upload-area {
  border: 2px dashed var(--border-glow);
  background: rgba(0, 255, 136, 0.03);
  padding: 30px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.slip-upload-area:hover {
  background: rgba(0, 255, 136, 0.08);
  border-color: var(--color-primary);
}

.slip-preview-img {
  width: 200px;
  height: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: 16px;
  display: none;
  border: 2px solid var(--border-glow);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.25);
  background: #000;
}

/* Reviews Page */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.reviewer-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.star-rating {
  color: #f59e0b;
}

.review-comment {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Contact Page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.contact-icon-box {
  width: 48px;
  height: 48px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.3rem;
}

/* Admin Dashboard Table & Modals */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 35px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius-md);
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.data-table th, .data-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.data-table th {
  background: #090d10;
  color: var(--text-muted);
  font-weight: 600;
}

.status-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-block;
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-shipped {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.status-completed {
  background: rgba(0, 255, 136, 0.18);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.4);
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-tab-btn {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-tab-btn:hover {
  color: #fff;
  border-color: rgba(0, 255, 136, 0.4);
}

.admin-tab-btn.active {
  background: rgba(0, 255, 136, 0.1);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

/* Admin Media & Gallery Preview */
.admin-gallery-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  min-height: 50px;
  padding: 8px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
}

.admin-gallery-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
}

.admin-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-gallery-thumb .thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.admin-gallery-thumb.is-main {
  border-color: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.admin-gallery-thumb.is-main::after {
  content: 'รูปหลัก';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-primary);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 1px 0;
}

/* Admin Order Details Modal */
/* .admin-order-grid and the whole order-detail modal now live in the
   "ADMIN ORDER DETAIL MODAL" section at the bottom of this file. */

/* ==========================================================================
   ADMIN SLIP LIGHTBOX (FULLSCREEN POPUP)
   ========================================================================== */
.admin-slip-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 5, 7, 0.94);
  backdrop-filter: blur(12px);
  z-index: 3500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  box-sizing: border-box;
  cursor: zoom-out;
}

.admin-slip-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-slip-lb-header {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 19, 24, 0.92);
  border: 1px solid var(--border-glow);
  padding: 8px 22px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 2;
  box-shadow: 0 4px 25px rgba(0,0,0,0.7);
  pointer-events: none;
}

.admin-slip-lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: all 0.2s ease;
}

.admin-slip-lb-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.08);
}

.admin-slip-lb-img {
  max-width: min(1100px, 94vw);
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 35px rgba(0, 255, 136, 0.25);
  background: #000;
  cursor: default;
  transition: transform 0.25s ease;
}

.admin-slip-lb-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  background: rgba(0,0,0,0.75);
  padding: 5px 16px;
  border-radius: 999px;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.08);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: #050709;
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
}

/* Modal Overlay */
/* Set by syncModalScrollLock() while a modal is open. position:fixed is what
   actually stops the scroll on iOS Safari; overflow:hidden alone is ignored there. */
body.modal-open {
  position: fixed;
  overflow: hidden;
  width: 100%;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  width: 90%;
  max-width: 550px;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-glow);
  max-height: 90vh;
  overflow-y: auto;
}

/* Responsive */
/* Promise strip folds to 2x2, keeping its hairlines square */
@media (max-width: 900px) {
  .cart-grid, .contact-grid {
    grid-template-columns: 1fr;
  }
  /* Photo slides fully behind the copy and the fade turns vertical */
  .hero-media {
    width: 100%;
  }
  .hero-media::after {
    background: linear-gradient(180deg, rgba(5, 8, 10, 0.72) 0%, rgba(5, 8, 10, 0.88) 55%, #05080a 100%);
  }
  .hero-grid {
    min-height: 440px;
    padding: 56px 0;
  }
  .hero-content {
    max-width: none;
  }
}
/* จอมือถือ: ตัดบรรทัดหัวข้อหลักตามวลี ไม่ให้ภาษาไทยขาดกลางคำ
   (เฉพาะ <=600px เท่านั้น จอ 601px ขึ้นไปยังเป็นดีไซน์เดิมทุกอย่าง) */
@media (max-width: 600px) {
  .hero-grid {
    min-height: 380px;
    padding: 44px 0;
  }
  .hero-subtitle {
    max-width: none;
  }
  .btn-hero {
    padding: 13px 24px;
  }
  .hero-rule {
    margin-top: 28px;
  }
  .features-head {
    padding: 40px 0 24px;
  }
  /* Narrower panels so more of the loop is visible on a phone */
  .feature-card {
    flex: 0 0 268px;
    width: 268px;
    padding: 20px 22px;
    gap: 12px;
  }
  .marquee::before,
  .marquee::after {
    width: 48px;
  }

  /* หัวข้อหมวดที่มีปุ่ม "ดูทั้งหมด" วางคู่กัน: จอแคบให้ปุ่มลงมาอยู่บรรทัดล่าง
     แทนที่จะถูกบีบจนข้อความในปุ่มตกบรรทัด */
  .section-header-split {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .section-header-split .btn {
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .logo-img {
    height: 34px;
  }
  .nav-menu {
    display: none;
  }
  .mobile-toggle {
    display: inline-flex;
  }
  /* จอมือถือ: ย้ายตะกร้าลงไปเป็นปุ่มลอยมุมขวาล่าง แทนไอคอนบนหัวเว็บ */
  .header-actions .cart-icon-btn {
    display: none;
  }
  /* Nav is hidden here, so drop the centring grid and just push the
     cart back out to the right edge */
  .header-inner {
    display: flex;
    justify-content: space-between;
  }
}

/* Product Detail Modal Styling */
.product-detail-modal-box {
  max-width: 850px !important;
  width: 95% !important;
  padding: 0 !important;
  /* ล็อกความสูงคงที่ ป้อปอัพทุกสินค้าจึงขนาดเท่ากันเป๊ะ ไม่ยืด-หดตามความยาวเนื้อหา
     ส่วนที่ยาวเกินให้เลื่อนใน .pdm-info แทน (สินค้ายาวสุดคือหัวฉีดเขียว ที่เหลือ 440-571px) */
  height: 560px;
  height: min(560px, 88dvh);
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.pdm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-card);
  flex: 1;
  min-height: 0;   /* ยอมให้หดเท่ากล่อง ไม่งั้นเนื้อหาจะดันกล่องให้สูงตามเดิม */
  overflow: hidden;
}

.pdm-gallery {
  background: #050709;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
  min-height: 0;
  overflow: hidden;
}

.pdm-main-img-wrapper {
  width: 100%;
  height: 320px;
  flex: 0 1 auto;   /* หดได้ถ้าจอเตี้ยจนพื้นที่ไม่พอ แทนที่จะล้นออกนอกกล่อง */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #090c0e;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.pdm-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdm-thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.pdm-thumb-btn {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: #0e1317;
  padding: 0;
  transition: all 0.2s ease;
}

.pdm-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hover ให้ขอบจางกว่า เพื่อให้เห็นชัดว่ารูปไหนกำลังถูกเลือกอยู่ */
.pdm-thumb-btn:hover {
  border-color: rgba(0, 255, 136, 0.45);
}

.pdm-thumb-btn.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

/* ส่วนข้อมูลคือที่เดียวในป้อปอัพที่เลื่อนได้ (padding ล่างยกไปไว้ที่ .pdm-actions
   เพื่อให้ปุ่มที่ sticky อยู่เกาะติดขอบล่างพอดี ไม่ลอยเหนือ padding) */
.pdm-info {
  padding: 30px 30px 0;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* .pdm-info เป็น flex column ที่มีความสูงจำกัด ลูกทุกตัวจึงโดนบีบ (flex-shrink)
   ให้พอดีกล่องแทนที่จะล้นออกมาให้เลื่อน - สั่งห้ามบีบ เนื้อหาจะได้ความสูงเต็มจริง */
.pdm-info > * {
  flex-shrink: 0;
}

/* กล่องคำอธิบายสินค้า (เดิมเป็น inline style ใน app.js ย้ายมาที่นี่เพื่อให้
   media query มือถือปรับได้ - inline style จะชนะ CSS เสมอ) */
.pdm-desc {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}

/* แถวปุ่มท้ายป้อปอัพ - margin-top:auto ดันให้ติดขอบล่างเมื่อเนื้อหาสั้น
   ส่วน sticky ทำให้ยังกดได้ตลอดเมื่อเนื้อหายาวจนต้องเลื่อน */
.pdm-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
  position: sticky;
  bottom: 0;
  padding: 12px 0 30px;
  background: var(--bg-card);
}

/* เงาไล่สีเหนือปุ่ม บอกให้รู้ว่าเนื้อหายังเลื่อนต่อได้ ไม่ใช่ข้อความโดนตัดทิ้ง
   (ถ้าเนื้อหาสั้นจนไม่ต้องเลื่อน จะเป็นสีพื้นทับสีพื้น มองไม่เห็นอยู่แล้ว) */
.pdm-actions::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 20px;
  background: linear-gradient(to top, var(--bg-card), transparent);
  pointer-events: none;
}

/* แถบสูง 0 ที่เกาะบนสุดของกล่องที่เลื่อนได้ ปุ่มปิดจึงลอยอยู่มุมขวาบนตลอดเวลา */
.pdm-close-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 0;          /* สูง 0 เพื่อไม่ให้ดันเนื้อหาลง ปุ่มจะล้นออกมาทับด้านบนแทน */
  overflow: visible;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.pdm-close-btn {
  margin: 16px 16px 0 0;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: none;
  color: #fff;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pdm-close-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* ---- ป้อปอัพสินค้าบนมือถือ ----
   โครงหลัก (ล็อกความสูง / ข้อมูลเลื่อนได้ / ปุ่มติดขอบล่าง) อยู่ในกฎด้านบนแล้ว
   ตรงนี้ปรับแค่ขนาดกับการวางเลย์เอาต์ให้เหมาะกับจอแคบ */
@media (max-width: 768px) {
  .product-detail-modal-box {
    /* จอมือถือใช้พื้นที่ให้เต็มกว่าเดสก์ท็อป dvh ตัดแถบ URL ที่ยืด-หดออกไปแล้ว */
    height: 88vh;
    height: 88dvh;
  }

  .pdm-grid {
    grid-template-columns: 1fr;
    /* ส่วนรูปสูงคงที่ 300px ที่เหลือเป็นของข้อมูล
       (min() ไว้กันจอเตี้ยมาก ๆ ไม่ให้รูปกินพื้นที่จนไม่เหลือที่ให้ข้อมูล) */
    grid-template-rows: 300px 1fr;
    grid-template-rows: min(300px, 45dvh) 1fr;
  }

  .pdm-gallery {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
  }
  /* รูปหลักยืดเต็มพื้นที่ที่เหลือของส่วนรูป สินค้าที่ไม่มีทัมบ์เนลจึงได้รูปใหญ่ขึ้น
     แต่ความสูงรวมของส่วนรูปยังเท่ากันทุกตัว */
  .pdm-main-img-wrapper {
    flex: 1;
    height: auto;
    min-height: 0;
  }
  /* ทัมบ์เนลเลื่อนแนวนอนแทนการตกบรรทัด กันไม่ให้ส่วนรูปสูงไม่เท่ากัน */
  .pdm-thumbs {
    flex: none;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    justify-content: safe center;
    scrollbar-width: none;
  }
  .pdm-thumbs::-webkit-scrollbar {
    display: none;
  }
  .pdm-thumb-btn {
    flex: 0 0 auto;
  }

  .pdm-info {
    padding: 20px 18px 0;
  }
  /* คำอธิบายไหลยาวได้เลย ไม่ต้องมีกล่องเลื่อนซ้อนกล่องเลื่อน */
  .pdm-desc {
    max-height: none;
    overflow: visible;
  }
  .pdm-actions {
    padding: 12px 0 18px;
  }

  /* บนรูปสินค้าสีอ่อน ปุ่มปิดต้องยังเห็นชัด */
  .pdm-close-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
  }
}

/* ==========================================================================
   CART ITEM SPECS - ชิปบอกรุ่น/ขนาดที่ลูกค้าเลือกในหน้าตะกร้า
   ========================================================================== */
.cart-item-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid var(--border-glow);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
}

.spec-chip .spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.spec-chip .spec-label::after {
  content: ':';
}

/* ==========================================================================
   PRIVACY POLICY PAGE - หน้านโยบายความเป็นส่วนตัว
   ========================================================================== */
.privacy-heading {
  color: #fff;
  font-size: 1.08rem;
  font-family: var(--font-heading);
  margin: 28px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--color-primary);
}

.privacy-text {
  line-height: 1.85;
  margin-bottom: 10px;
}

.privacy-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.privacy-list li {
  position: relative;
  padding-left: 20px;
  line-height: 1.85;
  margin-bottom: 6px;
}

.privacy-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.75em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}

.privacy-list strong {
  color: #fff;
}


/* ==========================================================================
   MOBILE NAV DRAWER + FLOATING CART
   ใช้เฉพาะจอ <=768px เท่านั้น (element สร้างจาก app.js ส่วนการแสดงผลเปิด/ปิด
   ด้วย media query ด้านบน) เดสก์ท็อปจึงไม่ได้รับผลกระทบใด ๆ
   ========================================================================== */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.mobile-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(78vw, 300px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 16px 24px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -18px 0 44px rgba(0, 0, 0, 0.55);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s ease, visibility 0.28s ease;
  overflow-y: auto;
}

.mobile-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-drawer-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
}

.mobile-drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  line-height: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.mobile-drawer-close:hover {
  color: var(--color-primary);
}

.mobile-drawer .nav-link {
  display: block;
  padding: 13px 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
}

.mobile-drawer .nav-link.active {
  color: var(--color-primary);
  background: rgba(0, 255, 136, 0.08);
}

/* ขีดใต้ของ nav-link บนหัวเว็บ ไม่ต้องใช้ในเมนูนี้ */
.mobile-drawer .nav-link.active::after {
  display: none;
}

/* ล็อกไม่ให้หน้าเลื่อนตอนเมนูเปิด ใช้คนละคลาสกับ modal-open เพื่อไม่ให้ชนกัน */
body.drawer-open {
  overflow: hidden;
}

/* ---- ปุ่มตะกร้าลอยมุมขวาล่าง (เฉพาะมือถือ) ---- */
.fab-cart {
  display: none; /* เดสก์ท็อปไม่ใช้ - เปิดใน media query <=768px */
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #051009;
  background: linear-gradient(135deg, var(--color-primary), var(--color-emerald));
  box-shadow: 0 8px 26px rgba(0, 255, 136, 0.32);
  text-decoration: none;
  line-height: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-cart svg {
  display: block;
  vertical-align: 0;
}

.fab-cart:active {
  transform: scale(0.94);
}

/* ปุ่มเป็นวงกลม r=29px ป้ายเลขจึงต้องเยื้อง 29 - 29/1.414 - 11 = -2.5px ถึงจะแนบขอบพอดี */
.fab-cart .fab-cart-badge {
  position: absolute;
  top: -2.5px;
  right: -2.5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  border: 2px solid var(--bg-dark);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ต้องอยู่ท้ายไฟล์ หลัง .fab-cart { display: none } ไม่งั้นจะถูก override กลับ */
@media (max-width: 768px) {
  .fab-cart {
    display: inline-flex;
  }
}


/* ==========================================================================
   CART ROW - จอมือถือ
   แถวสินค้าเดิมเป็น flex แนวนอน 5 ช่อง (รูป | ชื่อ | จำนวน | ราคารวม | ปุ่มลบ)
   ต้องใช้ความกว้าง ~439px จอ 390px จึงล้นออกไป 119px รูปกับปุ่มลบถูกบีบจนเละ
   จอ <=600px เลยจัดใหม่เป็นตาราง 2 แถว:  [รูป | ชื่อ | ลบ] / [จำนวน | ราคารวม]
   ========================================================================== */
@media (max-width: 600px) {
  .cart-item-row {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon info   remove"
      "qty  total  total";
    column-gap: 12px;
    row-gap: 14px;
    align-items: center;
  }

  .cart-item-row .cart-item-icon {
    grid-area: icon;
    align-self: start;
  }

  .cart-item-row .cart-item-info {
    grid-area: info;
    min-width: 0;
  }

  .cart-item-row .remove-btn {
    grid-area: remove;
    align-self: start;
    flex-shrink: 0;
  }

  .cart-item-row .qty-control {
    grid-area: qty;
    justify-self: start;
  }

  .cart-item-row .cart-item-total {
    grid-area: total;
    min-width: 0 !important;   /* ทับ inline style min-width:100px ที่ทำให้ล้น */
  }

  .cart-item-title {
    font-size: 0.95rem;
    line-height: 1.35;
  }
}


/* ==========================================================================
   HERO - โหมด iPad / แท็บเล็ตแนวตั้ง (601px - 900px)
   ช่วงนี้ .hero-grid เป็นคอลัมน์เดียวอยู่แล้ว แต่เนื้อหายังชิดซ้ายและหัวข้อยาว
   เป็นบรรทัดเดียวชนขอบ จึงจัดกึ่งกลางและตัดบรรทัดตามวลีเหมือนโหมดมือถือ
   ขอบเขต 601-900px เท่านั้น: <=600px คือมือถือ, >=901px คือเดสก์ท็อป 2 คอลัมน์
   ========================================================================== */
@media (min-width: 601px) and (max-width: 900px) {
  .hero-content {
    text-align: center;
  }

  /* หัวข้อปล่อยให้ตัดบรรทัดเองตามปกติ (ไม่บังคับแยกวลีเหมือนโหมดมือถือ) */

  .btn-group {
    justify-content: center;
  }
}


/* ==========================================================================
   PRODUCT IMAGE LIGHTBOX - ดูรูปสินค้าขนาดเต็มจากป้อปอัพรายละเอียดสินค้า
   ========================================================================== */
.pdm-main-img-wrapper.zoomable {
  position: relative;
  cursor: zoom-in;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pdm-main-img-wrapper.zoomable:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.18);
}

.pdm-zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(5, 7, 9, 0.78);
  border: 1px solid var(--border-glow);
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.pdm-main-img-wrapper.zoomable:hover .pdm-zoom-hint {
  opacity: 1;
}

/* ตัว lightbox ต้องอยู่เหนือป้อปอัพสินค้า (.modal-overlay = 2000) */
.pdm-lightbox {
  z-index: 2500;
  background: rgba(0, 0, 0, 0.92);
  padding: 56px 16px;
  cursor: zoom-out;
}

.pdm-lb-img {
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  cursor: default;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.pdm-lightbox.active .pdm-lb-img {
  transform: scale(1);
}

.pdm-lb-close,
.pdm-lb-nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdm-lb-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  z-index: 2;
}

.pdm-lb-close:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.pdm-lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
}

.pdm-lb-nav.prev { left: 16px; }
.pdm-lb-nav.next { right: 16px; }

.pdm-lb-nav:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #04120a;
}

.pdm-lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(5, 7, 9, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
}

@media (max-width: 768px) {
  .pdm-lightbox { padding: 52px 8px; }
  .pdm-lb-img { max-width: 96vw; max-height: 78vh; }
  .pdm-lb-nav { width: 38px; height: 38px; }
  .pdm-lb-nav.prev { left: 6px; }
  .pdm-lb-nav.next { right: 6px; }
}


/* ==========================================================================
   PRODUCT CARD - กรอบรูปสินค้าจอมือถือ
   เดิมกรอบสูงคงที่ 200px + object-fit:cover จอมือถือการ์ดกว้างเกือบเต็มจอ
   (~350px) รูปสินค้าเกือบทั้งหมดเป็นสี่เหลี่ยมจัตุรัส 1:1 จึงถูกครอปหัว-ท้าย
   ทิ้งไปเกินครึ่ง <=600px เลยขยายกรอบเป็นจัตุรัสตามความกว้างการ์ด และเปลี่ยน
   เป็น contain เพื่อให้เห็นรูปเต็มใบ (ต้องใช้ !important เพราะ object-fit
   ถูกกำหนดเป็น inline style จาก getProductImageHTML() ใน js/app.js)
   ========================================================================== */
@media (max-width: 600px) {
  .product-img-wrapper {
    height: auto;
    aspect-ratio: 1 / 1;
    padding: 10px;
  }

  .product-img-wrapper img {
    object-fit: contain !important;
  }

  /* สินค้าที่ยังไม่มีรูปจะใช้ไอคอน SVG แทน ขยายตามกรอบใหม่ไม่ให้ดูลอย */
  .product-svg-icon {
    width: 120px;
    height: 120px;
  }
}


/* ==========================================================================
   PRODUCT GRID - จอมือถือแสดงสินค้า 2 ใบต่อแถว
   เดิม <=600px ทั้งหน้าแรก (.products-section--editorial) และหน้าสินค้า
   (.products-section) ตกลงมาเหลือคอลัมน์เดียว การ์ดใบเดียวกินเต็มจอ ต้องเลื่อน
   ยาวมากกว่าจะเห็นสินค้าหลายชิ้น จึงจัดใหม่เป็น 2 คอลัมน์ พร้อมย่อระยะขอบ/
   ขนาดตัวอักษรในการ์ดให้พอดีกับความกว้างครึ่งจอ (~165px บนจอ 390px)
   ต้องอยู่ท้ายไฟล์ เพราะทับบล็อก @media (max-width:600px) ของ editorial ด้านบน
   ========================================================================== */
@media (max-width: 600px) {
  .product-grid,
  .products-section--editorial .product-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    gap: 12px;
  }

  /* กรอบรูปเป็นจัตุรัสตามความกว้างการ์ด (object-fit:contain ถูกตั้งไว้แล้ว
     ในบล็อก PRODUCT CARD ด้านบน) */
  .product-img-wrapper,
  .products-section--editorial .product-img-wrapper {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    padding: 8px;
  }

  .product-svg-icon {
    width: 72px;
    height: 72px;
  }

  .product-badge,
  .products-section--editorial .product-badge {
    top: 8px;
    left: 8px;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    padding: 3px 8px;
  }

  /* --- เนื้อในการ์ด: ย่อทุกระยะให้พอดีครึ่งจอ --- */
  .product-body {
    padding: 12px;
  }

  /* การ์ดหน้าแรกมีแถบล่างแบบเต็มขอบ จึงไม่เว้น padding ล่าง
     flex:1 1 auto ให้เนื้อการ์ดยืดเต็มความสูงแถว (เดิมรูปเป็นตัวยืด แต่มือถือ
     ล็อกรูปเป็นจัตุรัสแล้ว) แถบราคาจึงยังชิดขอบล่างเสมอทุกใบในแถว */
  .products-section--editorial .product-body {
    flex: 1 1 auto;
    padding: 12px 12px 0;
  }

  .product-category,
  .products-section--editorial .product-category {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
  }

  .product-name,
  .products-section--editorial .product-name {
    font-size: 0.88rem;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .product-desc,
  .products-section--editorial .product-desc {
    font-size: 0.72rem;
    line-height: 1.55;
    margin-bottom: 12px;
  }

  .product-footer {
    padding-top: 10px;
  }

  /* แถบล่างของการ์ด editorial เป็นแบบเต็มขอบ ต้องดึงลบเท่ากับ padding ใหม่ */
  .products-section--editorial .product-footer {
    margin-left: -12px;
    margin-right: -12px;
    padding: 10px 12px;
    gap: 8px;
  }

  .product-price,
  .products-section--editorial .product-price {
    font-size: 1.05rem;
  }

  .add-cart-btn,
  .products-section--editorial .add-cart-btn {
    width: 34px;
    height: 34px;
  }

  .add-cart-btn svg {
    width: 17px;
    height: 17px;
  }

  /* --- ยกเลิก "การ์ดเด่น" ในโหมดมือถือ ---------------------------------------
     หน้าแรกกำหนดให้สินค้าชิ้นที่ 1, 8, 15... เป็นการ์ดเด่นขนาด 2x2 (ดู index.html
     ตัวแปร isFeature) บนเดสก์ท็อปที่มี 4 คอลัมน์มันคือจังหวะของโมเสก แต่พอเหลือ
     2 คอลัมน์ การ์ดเด่นกินเต็มความกว้างจนแถวนั้นมีสินค้าใบเดียว จอมือถือจึงรีเซ็ต
     ทุกค่ากลับเท่าการ์ดปกติ ให้เรียงเป็นคู่เสมอทั้งหน้า
     (กฎการ์ดเด่นด้านบนมี specificity 0,3,0 ต้องเขียนทับทีละข้อด้วยระดับเดียวกัน)
     -------------------------------------------------------------------------- */
  .products-section--editorial .product-card--feature {
    grid-column: auto;
    grid-row: auto;
  }

  .products-section--editorial .product-card--feature .product-img-wrapper {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .products-section--editorial .product-card--feature .product-body {
    padding: 12px 12px 0;
  }

  .products-section--editorial .product-card--feature .product-category {
    margin-bottom: 6px;
  }

  .products-section--editorial .product-card--feature .product-name {
    font-size: 0.88rem;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .products-section--editorial .product-card--feature .product-desc {
    -webkit-line-clamp: 2;
    font-size: 0.72rem;
    line-height: 1.55;
    max-width: none;
    margin-bottom: 12px;
  }

  .products-section--editorial .product-card--feature .product-footer {
    margin-left: -12px;
    margin-right: -12px;
    padding: 10px 12px;
  }

  .products-section--editorial .product-card--feature .product-price {
    font-size: 1.05rem;
  }

  .products-section--editorial .product-card--feature .add-cart-btn {
    width: 34px;
    height: 34px;
  }
}

/* ==========================================================================
   ADMIN ORDER DETAIL MODAL (.od-*)
   โครงหน้าต่าง: หัวเรื่องปักหมุดบนสุด -> เนื้อหา 2 คอลัมน์ที่เลื่อนได้
   -> แถบบันทึกสถานะปักหมุดล่างสุด ทำให้ปุ่มสำคัญอยู่ในสายตาเสมอ
   ========================================================================== */
.od-box {
  max-width: 940px;
  width: min(94vw, 940px);
  max-height: min(92vh, 940px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-color: var(--border-glow);
}

/* ---------- Header ---------- */
.od-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.07), transparent);
  flex-shrink: 0;
}

.od-eyebrow {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.od-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-primary);
  margin: 0 0 8px;
  word-break: break-all;
}

.od-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.od-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.od-meta-item .ico {
  color: var(--text-dim);
}

.od-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.od-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

/* ---------- Scrollable body ---------- */
.od-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
}

.admin-order-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch;
  gap: 16px;
}

.od-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---------- Cards ---------- */
.od-card {
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
}

.od-card--pay {
  background: linear-gradient(160deg, rgba(0, 255, 136, 0.08), rgba(255, 255, 255, 0.02));
  border-color: var(--border-glow);
}

.od-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.od-card-title .ico {
  color: var(--color-primary);
  flex-shrink: 0;
}

.od-card-title .od-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  padding: 1px 9px;
}

/* ---------- Customer fields ---------- */
.od-fields {
  display: grid;
  gap: 10px;
  margin: 0;
}

.od-field dt {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 1px;
}

.od-field dd {
  margin: 0;
  font-size: 0.9rem;
  color: #fff;
  line-height: 1.5;
  word-break: break-word;
}

.od-field dd.od-accent {
  color: var(--color-primary);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.od-note {
  display: none;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-sm);
}

.od-note.show {
  display: flex;
}

.od-note .ico {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------- Items list ---------- */
.od-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
}

.od-item:first-child {
  padding-top: 0;
}

.od-item-qty {
  flex-shrink: 0;
  min-width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: var(--radius-sm);
}

.od-item-main {
  flex: 1;
  min-width: 0;
}

.od-item-name {
  font-size: 0.86rem;
  font-weight: 500;
  color: #fff;
  line-height: 1.45;
}

.od-item-spec {
  display: inline-block;
  margin: 5px 6px 0 0;
  padding: 2px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.28);
  border-radius: var(--radius-full);
}

.od-item-spec-label {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 5px;
}

.od-item-price {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.od-item-unit {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  text-align: right;
  margin-top: 2px;
}

.od-items-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.od-items-total strong {
  font-size: 1.05rem;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Payment breakdown ---------- */
.od-pay-method {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.od-pay-method--transfer {
  color: var(--color-primary);
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.od-pay-method--cod {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.od-pay-hero-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.od-pay-hero-value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.od-pay-rows {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.od-pay-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.od-pay-row strong {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Slip ---------- */
/* การ์ดสลิปยืดเต็มความสูงคอลัมน์ กรอบรูปกินพื้นที่ว่างที่เหลือจนถึงด้านล่าง */
.od-card--slip {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.od-card--slip #od-slip-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* flex-basis: 0 = ไม่เอาความสูงจริงของรูปมาดันการ์ด แค่กินพื้นที่ว่างที่เหลือ
   ความสูงแถวจึงถูกกำหนดโดยคอลัมน์ซ้าย ทำให้ขอบล่างเสมอกันพอดี */
.od-card--slip .od-slip-frame {
  flex: 1 1 0;
  height: auto;
}

.od-card--slip .od-slip-frame img {
  position: absolute;
  inset: 0;
}

.od-card--slip .od-slip-empty {
  flex: 1 1 auto;
  align-content: center;
}

.od-slip-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 190px;
  min-height: 190px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #000;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.18s var(--ease);
}

.od-slip-frame:hover {
  border-color: var(--border-glow);
}

.od-slip-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.od-slip-zoom {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  font-size: 0.75rem;
  color: #fff;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}

.od-slip-frame:hover .od-slip-zoom {
  opacity: 1;
}

.od-slip-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 26px 12px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
}

.od-slip-empty .ico {
  color: var(--text-dim);
}

/* ---------- Sticky action footer ---------- */
.od-footer {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-glow);
  background: linear-gradient(0deg, rgba(0, 255, 136, 0.07), transparent);
}

.od-footer .form-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.od-footer .form-select,
.od-footer .form-input {
  margin: 0;
  padding: 9px 12px;
  font-size: 0.85rem;
}

.od-footer-actions {
  display: flex;
  gap: 8px;
}

.od-footer-actions .btn {
  margin: 0;
  padding: 10px 18px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.od-footer-actions .btn-secondary {
  padding: 10px 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .admin-order-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .od-box {
    width: 96vw;
    max-height: 94vh;
  }

  .od-header,
  .od-body,
  .od-footer {
    padding-left: 15px;
    padding-right: 15px;
  }

  .od-title {
    font-size: 1.25rem;
  }

  .od-pay-hero-value {
    font-size: 1.6rem;
  }

  .od-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .od-footer-actions .btn-primary {
    flex: 1;
  }
}

/* ==========================================================================
   ADMIN RESPONSIVE — มือถือ & แท็บเล็ต
   จอคอม (กว้างกว่า 1024px) ยังเป็นตารางแบบเดิมทุกอย่าง ไม่มีอะไรเปลี่ยน
   ========================================================================== */

/* ---------- แถบบนสุด: ปุ่มออกจากระบบ / กลับหน้าร้านค้า ---------- */
.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-user-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ตัวการที่ทำให้ปุ่มแตกเป็นสามบรรทัดบนมือถือคือข้อความตัดคำ */
.admin-topbar-btn {
  font-size: 0.82rem;
  padding: 6px 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ปุ่ม "กลับหน้าร้านค้า" โชว์เฉพาะจอใหญ่ — บนมือถือกดที่โลโก้แทนได้อยู่แล้ว */
.admin-back-btn {
  display: inline-flex;
}

/* ---------- ดรอปดาวน์กรองสถานะ (โผล่เฉพาะจอเล็ก) ---------- */
.admin-filter-select-wrap {
  display: none;
  margin-bottom: 16px;
}

.admin-filter-select-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.admin-filter-select {
  width: 100%;
}

@media (max-width: 1024px) {
  /* ---------- สลับปุ่มกรองเป็นดรอปดาวน์ ---------- */
  .admin-tabs {
    display: none;
  }

  .admin-filter-select-wrap {
    display: block;
  }

  /* ---------- ตาราง -> การ์ด ----------
     ตารางหลังบ้านมี 8 คอลัมน์ อ่านบนจอมือถือ/ไอแพดไม่ไหว
     จึงแปลงแต่ละแถวเป็นการ์ด แล้วดึงชื่อคอลัมน์จาก data-label มาโชว์หน้าค่า */
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table {
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    overflow: hidden;
  }

  .data-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 14px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding-top: 2px;
  }

  /* ช่องที่ไม่ต้องมีป้ายกำกับ (รูปสินค้า / ปุ่มจัดการ) */
  .data-table td[data-label=""]::before {
    display: none;
  }

  /* แถว "ไม่มีข้อมูล" ให้เต็มความกว้างและอยู่กลาง */
  .data-table td[colspan] {
    justify-content: center;
    text-align: center;
  }

  .data-table td[colspan]::before {
    display: none;
  }

  /* ลำดับที่ + รูปสินค้า จัดเป็นหัวการ์ด */
  .data-table td.cell-index {
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
    padding: 8px 14px;
  }

  .data-table td.cell-thumb {
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .data-table td.cell-thumb > div {
    width: 72px !important;
    height: 72px !important;
  }

  /* ปุ่มจัดการ ยืดเต็มความกว้างการ์ด กดง่ายด้วยนิ้ว */
  .data-table td.cell-actions {
    justify-content: stretch;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
  }

  .data-table td.cell-actions > div,
  .data-table td.cell-actions > button {
    width: 100%;
  }

  .data-table td.cell-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
  }

  /* กล่องที่เคยเลื่อนแนวนอนไม่ต้องเลื่อนแล้ว เพราะการ์ดกว้างพอดีจอ */
  .data-table-wrap {
    overflow-x: visible !important;
  }
}

@media (max-width: 900px) {
  /* ชื่อผู้ดูแลระบบยาวเกินไปบนจอแคบ ไปแสดงในหัวข้อแดชบอร์ดแทน */
  .admin-user-label {
    display: none;
  }

  .admin-back-btn {
    display: none;
  }

  /* บนมือถือมีปุ่มออกจากระบบอยู่ในหัวข้อแดชบอร์ดข้างล่างแล้ว ไม่ต้องซ้ำสองที่ */
  .admin-topbar-logout {
    display: none;
  }

  .admin-topbar-actions {
    gap: 6px;
  }

  .admin-topbar-btn {
    font-size: 0.76rem;
    padding: 6px 10px;
  }

  /* ป้าย ADMIN PHP ข้างโลโก้ก็ตัดคำเหมือนกัน */
  .logo-badge {
    font-size: 0.8rem;
    padding: 3px 7px;
    white-space: nowrap;
  }

  .logo-img {
    height: 32px;
  }

  /* หัวข้อแดชบอร์ด + ปุ่มออกจากระบบ ให้เรียงลงมาแทนที่จะเบียดกัน */
  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .admin-header-actions {
    align-self: flex-start;
  }

  .admin-header .btn {
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .logo-badge {
    font-size: 0.72rem;
  }

  .data-table td::before {
    flex-basis: 42%;
  }

  /* การ์ดสถิติ 4 ใบ เรียง 2 คอลัมน์บนมือถือ อ่านง่ายกว่าเรียงยาวลงมา */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-val {
    font-size: 1.4rem;
  }
}

/* ปุ่มเปลี่ยนรหัสผ่าน + ออกจากระบบ ในหัวข้อแดชบอร์ด */
.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.admin-header-actions .btn {
  white-space: nowrap;
}

@media (max-width: 560px) {
  /* จอแคบมาก ให้สองปุ่มแบ่งครึ่งความกว้างเท่า ๆ กัน กดง่ายด้วยนิ้ว */
  .admin-header-actions {
    width: 100%;
  }

  .admin-header-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 8px;
    font-size: 0.82rem;
  }
}

/* ---------- รูปสินค้าในตาราง: กดดูขนาดเต็มได้ ---------- */
.admin-thumb-btn {
  cursor: zoom-in;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.admin-thumb-btn:hover {
  border-color: var(--color-primary) !important;
  transform: scale(1.05);
}

/* แถบรูปย่อยใต้ภาพใหญ่ในป๊อปอัพดูรูปสินค้า */
.admin-pim-thumbs {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  max-width: min(92vw, 620px);
  overflow-x: auto;
  background: rgba(13, 19, 24, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: default;
}

.admin-pim-thumbs:empty {
  display: none;
}

.admin-pim-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.18s var(--ease), border-color 0.18s var(--ease);
}

.admin-pim-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-pim-thumb:hover {
  opacity: 0.85;
}

.admin-pim-thumb.active {
  opacity: 1;
  border-color: var(--color-primary);
}

/* ---------- ป้ายส่วนลดข้างชื่อสินค้า ---------- */
.admin-badge-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 255, 136, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(0, 255, 136, 0.3);
  margin-left: 6px;
}

@media (max-width: 1024px) {
  /* ชื่อสินค้ายาว ถ้าบีบอยู่ในคอลัมน์แคบชิดขวาจะอ่านยากมาก
     จึงให้ช่องนี้กินเต็มความกว้างการ์ด ป้ายกำกับอยู่บรรทัดบน เนื้อหาชิดซ้าย */
  .data-table td.cell-title {
    display: block;
    text-align: left;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .data-table td.cell-title::before {
    display: block;
    margin-bottom: 6px;
  }

  .data-table td.cell-title strong {
    display: block;
    line-height: 1.5;
  }

  /* ป้ายส่วนลดขึ้นบรรทัดใหม่ ไม่ไปแทรกกลางชื่อที่ตัดบรรทัด */
  .admin-badge-chip {
    margin-left: 0;
    margin-top: 8px;
  }

  /* รูปสินค้าในการ์ด ทำให้ใหญ่ขึ้นและบอกให้รู้ว่ากดได้ */
  .data-table td.cell-thumb .admin-thumb-btn {
    position: relative;
  }

  .data-table td.cell-thumb .admin-thumb-btn::after {
    content: 'แตะเพื่อดูรูป';
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);
    color: #fff;
    font-size: 0.6rem;
    text-align: center;
    padding: 8px 2px 3px;
  }
}

@media (max-width: 1024px) {
  /* ชื่อหมวดหมู่ยาว ๆ ถูกบีบให้ตัดสองบรรทัดในป้ายทรงแคปซูล ดูบิดเบี้ยว
     จึงลดความมนของขอบ เพิ่มระยะห่างบรรทัด และแบ่งพื้นที่ให้ค่ามากขึ้น */
  .data-table td[data-label="หมวดหมู่"]::before {
    flex-basis: 30%;
  }

  .data-table td[data-label="หมวดหมู่"] .status-pill {
    white-space: normal;
    text-align: center;
    line-height: 1.5;
    padding: 6px 12px;
    border-radius: 12px;
    max-width: 100%;
  }
}

/* จอคอมเท่านั้น (ไม่แตะจอมือถือ/แท็บเล็ต ซึ่งใช้กฎ max-width: 1024px ด้านบน)
   ป้ายหมวดหมู่ในตารางสินค้า: ชื่อหมวดสั้น-ยาวไม่เท่ากัน ป้ายเลยมีทั้งทรงแคปซูล
   บรรทัดเดียวและกล่องสองบรรทัด สูงไม่เท่ากันจนคอลัมน์ดูไม่เป็นระเบียบ
   จึงบังคับให้ทุกป้ายเป็นกล่องขนาดเดียวกันหมด (กว้างเต็มคอลัมน์ สูงเท่ากับสองบรรทัด)
   แล้วจัดข้อความไว้กึ่งกลางทั้งแนวตั้งและแนวนอน ป้ายสั้นหรือยาวจึงหน้าตาเหมือนกัน */
@media (min-width: 1025px) {
  .data-table td[data-label="หมวดหมู่"] {
    min-width: 180px;
  }

  .data-table td[data-label="หมวดหมู่"] .status-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    white-space: normal;
    text-wrap: balance;
    text-align: center;
    line-height: 1.45;
    padding: 6px 12px;
    border-radius: 10px;
  }
}

@media (max-width: 600px) {
  /* แถบชื่อสินค้าบนป๊อปอัพดูรูป: จอแคบทำให้ชื่อกับตัวนับถูกบีบเป็นสองคอลัมน์ผอม ๆ
     เปลี่ยนเป็นเรียงลงมาแทน และเว้นที่ให้ปุ่มปิดมุมขวาบนไม่ทับกัน */
  .admin-slip-lb-header {
    flex-direction: column;
    gap: 3px;
    text-align: center;
    max-width: calc(100vw - 140px);
    padding: 8px 16px;
    border-radius: 14px;
    font-size: 0.8rem;
    line-height: 1.45;
  }

  /* กันรูปไปชนแถบชื่อด้านบนและแถบรูปย่อยด้านล่าง */
  .admin-slip-lb-img {
    max-height: 62vh;
  }

  .admin-pim-thumb {
    width: 46px;
    height: 46px;
  }
}

/* ==========================================================================
   ฟอร์มเพิ่ม/แก้ไขสินค้า — จัดระเบียบใหม่ให้ใช้บนมือถือได้จริง
   ========================================================================== */

.pm-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.pm-head h3 {
  color: #fff;
  font-size: 1.3rem;
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.pm-grid {
  display: grid;
  gap: 16px;
}

.pm-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.pm-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.pm-media-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pm-upload-btn {
  font-size: 0.78rem;
  padding: 6px 12px;
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.pm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.pm-actions .btn {
  white-space: nowrap;
}

@media (max-width: 700px) {
  /* ช่องกรอกที่เคยเรียง 2-3 คอลัมน์ ถูกบีบจนป้ายกำกับตัดคำและช่องแคบเกินกรอกไม่ไหว
     บนมือถือให้เรียงลงมาทีละช่อง เต็มความกว้าง */
  .pm-grid-2,
  .pm-grid-3 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pm-head h3 {
    font-size: 1.08rem;
  }

  /* หัวข้อ "รูปภาพสินค้า" กับปุ่มอัปโหลดเบียดกัน ให้ปุ่มลงมาอยู่บรรทัดล่างเต็มความกว้าง */
  .pm-media-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pm-upload-btn {
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  /* ปุ่มยกเลิก/บันทึก แบ่งครึ่งเท่ากัน กดด้วยนิ้วง่าย */
  .pm-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 12px 10px !important;
  }
}

@media (max-width: 700px) {
  /* ป๊อปอัพเต็มจอมากขึ้น ลด padding ที่กินพื้นที่กรอกข้อมูลบนมือถือ */
  .modal-box {
    width: 94%;
    padding: 20px 16px;
    max-height: 92vh;
  }
}

/* ---------- ตัวอย่างวิดีโอในฟอร์มสินค้า ---------- */
.admin-video-preview:empty {
  display: none;
}

.admin-video-preview {
  margin-top: 12px;
}

.admin-video-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-video-label {
  font-size: 0.78rem;
  color: var(--color-primary);
  font-weight: 600;
}

.admin-video-clear {
  font-size: 0.75rem;
  padding: 4px 10px;
  margin: 0;
  flex-shrink: 0;
}

.admin-video-player {
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #000;
  display: block;
}

/* ==========================================================================
   ป๊อปอัพเพิ่ม/แก้ไขสินค้า — แยกหัวเรื่องกับเนื้อหาออกจากกันอย่างถาวร
   หัวเรื่องอยู่นิ่ง (ปุ่มปิดไม่หายตอนเลื่อน) ส่วนฟอร์มเลื่อนอยู่ข้างใน
   วิธีนี้ขอบมนของกล่องยังคมอยู่ ไม่มีเนื้อหาโผล่ลอดมุมเหมือนแบบ sticky
   ========================================================================== */
.pm-box {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.pm-box .pm-head {
  position: static;
  flex-shrink: 0;
  margin: 0;
  padding: 22px 26px 14px;
  background: var(--bg-card);
}

.pm-box > form {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 20px 26px 24px;
}

@media (max-width: 700px) {
  .pm-box .pm-head {
    padding: 16px 16px 12px;
  }

  .pm-box > form {
    padding: 16px 16px 20px;
  }
}

/* ---------- ปุ่มวิดีโอในแกลเลอรีสินค้า: โชว์ภาพตัวอย่างจากคลิปจริง ---------- */
.pdm-video-btn {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: #000;
  border-color: #00e5ff;
}

.pdm-video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.pdm-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.18s var(--ease);
}

.pdm-video-play svg {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.pdm-video-btn:hover .pdm-video-play {
  background: rgba(0, 0, 0, 0.15);
}

/* ---------- ปุ่มจัดการในแถวสินค้า (แก้ไข / ลบ) ---------- */
.product-row-actions {
  display: flex;
  align-items: stretch;   /* ปุ่มสองตัวสูงเท่ากันเสมอ ไม่เหลื่อมกัน */
  gap: 8px;
}

.product-edit-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.product-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  padding: 0;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.product-delete-btn:hover {
  background: #ef4444;
  color: #fff;
}

@media (max-width: 1024px) {
  /* ในโหมดการ์ด ปุ่มแก้ไขยืดเต็มที่เหลือ ปุ่มถังขยะกว้างคงที่ สูงเท่ากันพอดี */
  .data-table td.cell-actions .product-row-actions {
    width: 100%;
  }

  .product-edit-btn {
    flex: 1;
    justify-content: center;
  }

  .product-delete-btn {
    width: 48px;
  }
}


/* ==========================================================================
   CONTACT PAGE — หน้าติดต่อเรา
   วางเป็นการ์ดสองใบคู่กัน (เบอร์โทร / แชท & โซเชียล) แล้วปิดท้ายด้วยการ์ด
   ที่อยู่เต็มความกว้างที่มีกล่องลิงก์ Google Maps อยู่ทางขวา
   ========================================================================== */
.ct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.ct-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.ct-card-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(0, 255, 136, 0.12);
  color: var(--color-primary);
  margin-bottom: 20px;
}

/* การ์ดแชทใช้สีฟ้าไซแอนของธีม เพื่อให้แยกออกจากการ์ดเบอร์โทร */
.ct-card-icon--chat {
  background: rgba(0, 229, 255, 0.12);
  color: var(--color-accent);
}

.ct-card-icon--place {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  margin-bottom: 0;
  flex-shrink: 0;
}

.ct-card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 10px;
}

.ct-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* ---- เบอร์โทร ---- */
.ct-phone {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  transition: text-shadow 0.2s var(--ease);
}

.ct-phone:hover {
  text-shadow: 0 0 18px var(--color-primary-glow);
}

/* ---- ปุ่มโซเชียล ---- */
.ct-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ลิงก์ชื่อเพจ ใช้แทนปุ่มไอคอน เพิ่มช่องทางอื่นได้โดยวาง <a> เพิ่มในกล่องเดียวกัน */
.ct-social-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  background: rgba(0, 255, 136, 0.07);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.ct-social-link:hover {
  background: rgba(0, 255, 136, 0.13);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* ---- การ์ดที่อยู่ ---- */
.ct-place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 24px;
}

.ct-place-main {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
}

.ct-place-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 8px;
}

.ct-place-address {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 8px;
}

.ct-place-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.ct-place-meta strong {
  color: var(--text-main);
  font-weight: 600;
}

/* ---- กล่องลิงก์ Google Maps ---- */
.ct-gmaps {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  max-width: 340px;
  padding: 16px 20px;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  background: rgba(0, 255, 136, 0.07);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.ct-gmaps:hover {
  background: rgba(0, 255, 136, 0.12);
  box-shadow: var(--shadow-glow);
}

.ct-gmaps-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
}

.ct-gmaps-title {
  display: block;
  font-weight: 700;
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.4;
}

.ct-gmaps-link {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

@media (max-width: 900px) {
  .ct-grid {
    grid-template-columns: 1fr;
  }

  .ct-place {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .ct-gmaps {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .ct-card {
    padding: 22px 18px;
  }

  .ct-phone {
    font-size: 1.6rem;
  }

  .ct-place-main {
    gap: 14px;
  }
}

/* ============================================================
   ที่อยู่จัดส่งแบบแยกช่อง + รายการแนะนำ (หน้า checkout)
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  line-height: 1.5;
}

.addr-field {
  position: relative;
}

.addr-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(400px, 86vw);
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.addr-suggest-item {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.addr-suggest-item:hover,
.addr-suggest-item.is-active {
  background: rgba(0, 255, 136, 0.12);
}

.addr-suggest-main {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
}

.addr-suggest-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ==========================================================================
   โค้ดส่วนลด — ช่องกรอกโค้ดหน้า checkout + ตารางโค้ดในหลังบ้าน
   ========================================================================== */

/* .summary-row ตั้ง display:flex ไว้ ซึ่งทับแอตทริบิวต์ hidden ของเบราว์เซอร์ */
.summary-row[hidden],
.coupon-message[hidden] {
  display: none;
}

.coupon-box {
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-dark);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.coupon-box .form-label {
  margin-bottom: 8px;
}

.coupon-input-row {
  display: flex;
  gap: 8px;
}

.coupon-input-row .form-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.coupon-input-row .form-input:disabled {
  color: var(--color-primary);
  border-color: var(--border-glow);
}

.coupon-input-row .btn {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.coupon-message {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--color-primary);
}

.coupon-message.is-error {
  color: #fca5a5;
}

.coupon-discount-row,
.coupon-discount-row span:last-child {
  color: var(--color-primary);
  font-weight: 600;
}

.coupon-code-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px dashed rgba(0, 255, 136, 0.45);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.coupon-code-chip--sm {
  padding: 1px 6px;
  font-size: 0.7rem;
}

/* ช่อง "โค้ดส่วนลด" ในตารางออเดอร์: ชื่อโค้ด + ยอดที่ลด */
.order-coupon-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* จอคอม: ตารางออเดอร์มี 9 คอลัมน์ ข้อความเลยถูกบีบจนตัดเป็นสองบรรทัด
   (เลขออเดอร์ ป้ายสถานะ ปุ่มดูสลิป) จึงห้ามตัดบรรทัดและลดระยะขอบในช่องลง
   ถ้าจอแคบจริง ๆ กล่องตารางจะเลื่อนแนวนอนได้แทน */
@media (min-width: 1025px) {
  .orders-table th,
  .orders-table td {
    padding: 14px 8px;
    white-space: nowrap;
  }

  .orders-table th:first-child,
  .orders-table td:first-child {
    padding-left: 16px;
  }

  .orders-table th:last-child,
  .orders-table td:last-child {
    padding-right: 16px;
  }
}

.order-coupon-amount {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.coupon-form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.coupon-form-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}
