﻿/* Products Page Styles */
:root {
  --bg: #ffffff;
  --black: #111111;
  --gold: #d4af37;
  --gold-soft: #f6e6b0;
  --text: #222222;
  --radius-xl: 26px;
  --shadow-soft: 0 18px 40px rgba(0,0,0,0.08);
  --transition: 0.3s ease;
  --page-bg: #f5f7fb;
  --surface-card: rgba(16, 22, 35, 0.04);
  --border: rgba(14, 19, 33, 0.08);
  --text-muted: rgba(29, 36, 52, 0.66);
  --text-soft: rgba(29, 36, 52, 0.48);
  --charcoal: #0f1320;
  --shadow-subtle: 0 8px 14px rgba(15, 19, 32, 0.08);
  --shadow-light: 0 16px 24px rgba(15, 19, 32, 0.12);
  --gold-strong: #b8903a;
}

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

*,
*::before,
*::after {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
body * {
  font-family: "Kanit", "Kanit", system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 300;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

.container {
  width: min(1200px, 100% - 40px);
  margin: 0 auto;
}

/* Products Page */
.products-page {
  padding: 40px 0 60px;
  min-height: 60vh;
}

.products-collection {
  width: 100%;
}

.collection-head {
  text-align: center;
  margin-bottom: 40px;
}

.collection-eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 8px;
}

.collection-head h2 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  color: var(--black);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Category Filter Navigation */
.category-filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 40px;
  padding: 0 20px;
}

.category-filter-btn {
  padding: 10px 20px;
  border: 1px solid rgba(15, 19, 32, 0.15);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 400;
  font-family: "Kanit", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.category-filter-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
}

.category-filter-btn.active {
  background: linear-gradient(120deg, rgba(214, 183, 111, 0.92), rgba(190, 139, 44, 0.95));
  border-color: rgba(212, 175, 55, 0.6);
  color: #1b1207;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.category-filter-btn.active:hover {
  background: linear-gradient(120deg, rgba(214, 183, 111, 0.98), rgba(190, 139, 44, 0.98));
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3);
}

.category-filter-btn span {
  display: inline-block;
}

@media (max-width: 880px) {
  .category-filter-nav {
    gap: 8px;
    padding: 0 10px;
  }

  .category-filter-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

@media (max-width: 540px) {
  .category-filter-nav {
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-filter-nav::-webkit-scrollbar {
    display: none;
  }

  .category-filter-btn {
    padding: 7px 14px;
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(20px, 4vw, 32px);
  width: 1300px;
  max-width: 100%;
  margin: 0 auto;
  justify-content: center;
}

/* Product Card */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 301px;
  height: 510px;
  margin: 0 auto;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.75));
  border: 1px solid rgba(15, 19, 32, 0.06);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

/* ซ่อน badge ทั้งหมด */
.product-card .badge,
.product-card [data-badge],
.product-card [data-badge-label],
.product-card [data-status-pill] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.product-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-light);
}

/* Product Image */
.product-img {
  position: relative;
  padding-top: 80%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: clamp(26px, 5vw, 32px);
  margin: 18px 18px 0;
  background-color: rgba(15, 19, 32, 0.05);
  overflow: hidden;
  min-height: 200px;
  /* Skeleton loading state */
  background-image: linear-gradient(90deg, 
    rgba(15, 19, 32, 0.05) 0%, 
    rgba(15, 19, 32, 0.08) 50%, 
    rgba(15, 19, 32, 0.05) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* เมื่อโหลดรูปภาพสำเร็จแล้ว */
.product-img.lazy-loaded {
  animation: none;
  background-size: cover;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.product-img[data-empty="true"] {
  background-color: rgba(15, 19, 32, 0.05);
  background-image: none;
}

.product-img[data-empty="true"]::after {
  content: 'ไม่มีรูปภาพ';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-soft);
  font-size: 12px;
}

/* Product Body */
.product-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px 26px;
  min-height: 220px;
}

.product-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--charcoal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.product-price {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(211, 178, 100, 0.12);
  border: 1px solid rgba(211, 178, 100, 0.42);
  color: #8a6b23;
  font-size: 1.08rem;
  font-weight: 500;
  width: fit-content;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.product-category {
  font-size: 0.94rem;
  color: var(--text-soft);
}

.product-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: rgba(15, 19, 32, 0.06);
  color: var(--charcoal);
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease, color 200ms ease;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.btn-mini.primary {
  background: linear-gradient(120deg, rgba(214, 183, 111, 0.92), rgba(190, 139, 44, 0.95));
  color: #1b1207;
  box-shadow: 0 14px 18px rgba(214, 183, 111, 0.26);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-mini.outline {
  border: 1px solid rgba(15, 19, 32, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.btn-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(14, 19, 33, 0.12);
}

.btn-mini.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
  font-size: 1.1rem;
}

/* Skeleton Loading */
.product-card.skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

.product-card.skeleton .product-img {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.skeleton .line {
  height: 16px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton .line-1 {
  width: 80%;
}

.skeleton .line-2 {
  width: 60%;
}

.skeleton .line-3 {
  width: 40%;
}

.skeleton-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.skeleton .pill {
  flex: 1;
  height: 40px;
  background: #e0e0e0;
  border-radius: 16px;
}

/* Responsive */
@media (max-width: 880px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .product-card {
    width: 100%;
    max-width: 301px;
    height: auto;
    min-height: 510px;
  }

  .product-actions {
    gap: 8px;
  }

  .btn-mini {
    padding: 9px 10px;
    font-size: 0.8rem;
  }

  .product-body {
    padding: 18px 20px 20px;
    gap: 12px;
  }

  .product-name {
    font-size: 1rem;
  }

  .product-price {
    font-size: 0.95rem;
    padding: 12px 14px;
  }

  .product-actions {
    gap: 10px;
  }

  .btn-mini {
    padding: 10px 16px;
    font-size: 0.88rem;
  }
}

@media (max-width: 540px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .products-page {
    padding: 20px 0 40px;
  }

  .collection-head {
    margin-bottom: 30px;
  }
}


