/* ==============================================
   PRODUCTS.CSS — Product List, Detail, Cart
   Yến Sào Yến Duyên
   ============================================== */

/* ==============================================
   1. FEATURED PRODUCTS SECTION
   ============================================== */

.featured-products {
  position: relative;
}

.featured-products .section-header {
  margin-bottom: var(--space-64);
}


/* ==============================================
   2. PRODUCT GRID (overrides base.css defaults
      with page-specific refinements)
   ============================================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-24);
}

/* 3-col variant used on san-pham.html */
/* san-pham.html — lưới KHỚP MẪU: cột co giãn theo bề rộng, mỗi thẻ luôn ≥240px
   (auto-fill giảm số cột thay vì bóp hẹp thẻ khi khu chính hẹp do có sidebar).
   Gap 22px như bản mẫu đã duyệt. */
.products-grid--3col {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

/* 2-col variant for related products */
.products-grid--2col {
  grid-template-columns: repeat(2, 1fr);
}


/* ==============================================
   3. PRODUCT CARD
   ============================================== */

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0; /* ngăn card tràn trong grid/flex container */
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

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

.product-card:focus-within {
  box-shadow: var(--shadow-md);
}


/* --- Image area --- */

.product-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--color-cream);
  flex-shrink: 0;
}

.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
  display: block;
}

.product-card:hover .product-card-img img {
  transform: scale(1.05);
}

/* Image placeholder when no image */
.product-card-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gold-pale);
  color: var(--color-brand-light);
}

.product-card-img--placeholder svg {
  width: 56px;
  height: 56px;
  opacity: 0.4;
}

/* Quick-view overlay on hover */
.product-card-img::after {
  content: 'Xem nhanh';
  position: absolute;
  inset: 0;
  background: rgba(43, 36, 32, 0.55);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  cursor: pointer;
}

.product-card:hover .product-card-img::after {
  opacity: 1;
}


/* --- Badges --- */

.product-badge {
  position: absolute;
  top: var(--space-12);
  left: var(--space-12);
  padding: 4px 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  z-index: 1;
  line-height: 1.4;
  pointer-events: none;
}

.product-badge--hot   { background: var(--color-primary);  color: var(--color-white); }
.product-badge--gift  { background: var(--color-gold);     color: var(--color-brand); }
.product-badge--new   { background: var(--color-success);  color: var(--color-white); }
.product-badge--sale  { background: var(--color-sale);     color: var(--color-white); }

/* Sale % badge — top right */
.product-badge--percent {
  left: auto;
  right: var(--space-12);
  background: var(--color-sale);
  color: var(--color-white);
}

/* Sold-out overlay */
.product-card--soldout .product-card-img::before,
.product-card--soldout .product-card__img-wrap::before {
  content: 'Hết hàng';
  position: absolute;
  inset: 0;
  background: rgba(44, 24, 16, 0.65);
  color: rgba(250, 246, 241, 0.9);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.product-card--soldout .btn-add-cart {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}


/* --- Card body --- */

.product-card-body {
  padding: var(--space-20);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-12);
}

.product-name {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Link wrapping product name */
.product-name a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product-name a:hover {
  color: var(--color-selected);
}


/* --- Rating --- */

.product-rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.product-rating svg {
  flex-shrink: 0;
}

.product-rating-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--space-4);
}


/* --- Price --- */

.product-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-8);
  flex-wrap: wrap;
  margin-top: auto;
}

.price-current {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.price-old {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
  line-height: 1;
}

.price-sale-percent {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-sale);
  background: rgba(198, 40, 40, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}


/* --- Add to cart button --- */

.btn-add-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  width: 100%;
  padding: 11px var(--space-16);
  background: var(--color-brand);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 2px solid var(--color-brand);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-top: auto;
}

.btn-add-cart:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand);
}

.btn-add-cart:active {
  transform: scale(0.97);
}

.btn-add-cart:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

/* Added state */
.btn-add-cart.added {
  background: var(--color-success);
  border-color: var(--color-success);
  pointer-events: none;
}

.btn-add-cart.added::before {
  content: '✓ ';
}


/* ==============================================
   4. PRODUCT LIST PAGE (san-pham.html)
   ============================================== */

.products-page {
  padding-top: var(--space-64);
  padding-bottom: var(--space-96);
}

.products-page-header {
  margin-bottom: var(--space-48);
}

.products-page-title {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  color: var(--color-text);
  margin-bottom: var(--space-8);
}

.products-page-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}


/* --- Toolbar: filter + sort + search --- */

.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-20) var(--space-24);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-40);
  flex-wrap: wrap;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
  flex: 1;
}

.filter-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-medium);
  white-space: nowrap;
}

.filter-btn {
  padding: 6px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-medium);
  background: var(--color-cream);
  border: var(--border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--color-selected);
  color: var(--color-selected);
}

.filter-btn.active {
  background: var(--gradient-button);
  color: var(--color-white);
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.toolbar-sort {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-shrink: 0;
}

.sort-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sort-select {
  padding: 7px 12px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-cream);
  border: var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238D6E63' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.2);
}

/* Search bar within products page */
.products-search {
  position: relative;
  max-width: 320px;
  flex-shrink: 0;
}

.products-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  font-size: var(--text-sm);
  background: var(--color-cream);
  border: var(--border-light);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  color: var(--color-text);
}

.products-search input::placeholder {
  color: var(--color-text-muted);
}

.products-search input:focus {
  outline: none;
  border-color: var(--color-gold);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.15);
}

.products-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}


/* ==============================================
   5. PRODUCT DETAIL PAGE
   ============================================== */

.product-detail {
  padding-top: var(--space-64);
  padding-bottom: var(--space-96);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-40);
  flex-wrap: wrap;
}

.breadcrumb-item {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.breadcrumb-item a {
  color: var(--color-text-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--color-selected);
}

.breadcrumb-sep {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.breadcrumb-item--active {
  color: var(--color-text);
  font-weight: 500;
}


/* Detail layout */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-80);
  align-items: start;
}


/* --- Gallery --- */

.product-gallery {
  position: sticky;
  top: calc(var(--header-height) + var(--space-32));
}

.gallery-main {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-cream);
  margin-bottom: var(--space-16);
  cursor: zoom-in;
  border: var(--border-subtle);
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-main:hover img {
  transform: scale(1.04);
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
}

.gallery-thumb {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
  background: var(--color-cream);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition-fast);
}

.gallery-thumb:hover img {
  opacity: 0.85;
}

.gallery-thumb.active {
  border-color: var(--color-gold);
}

.gallery-thumb:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}


/* --- Product info --- */

.product-info {}

.product-info-category {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-brand-light);
  margin-bottom: var(--space-12);
}

.product-info-title {
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  font-weight: 700;
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin-bottom: var(--space-16);
}

.product-info-rating {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-24);
}

.product-info-rating .stars {
  display: flex;
  gap: 2px;
}

.rating-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.product-info-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-12);
  margin-bottom: var(--space-32);
  padding-bottom: var(--space-32);
  border-bottom: var(--border-light);
}

.product-info-price .price-current {
  font-size: var(--text-4xl);
}

.product-info-price .price-old {
  font-size: var(--text-lg);
}

/* Short description */
.product-info-desc {
  font-size: var(--text-base);
  color: var(--color-text-medium);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-32);
}

/* Quantity selector */
.product-qty-row {
  display: flex;
  align-items: center;
  gap: var(--space-24);
  margin-bottom: var(--space-24);
}

.qty-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-medium);
  white-space: nowrap;
}

.qty-selector {
  display: flex;
  align-items: center;
  border: var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cream);
  border: none;
  font-size: var(--text-lg);
  font-weight: 300;
  color: var(--color-text-medium);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
}

.qty-btn:hover {
  background: var(--color-gold-pale);
  color: var(--color-selected);
}

.qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-input {
  width: 56px;
  height: 44px;
  border: none;
  border-left: var(--border-light);
  border-right: var(--border-light);
  text-align: center;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input:focus {
  outline: none;
}

/* CTA buttons row */
.product-cta-row {
  display: flex;
  gap: var(--space-12);
  margin-bottom: var(--space-32);
  flex-wrap: wrap;
}

.product-cta-row .btn-add-cart {
  flex: 1;
  min-width: 160px;
  padding: 15px 24px;
  font-size: var(--text-base);
}

.btn-buy-now {
  flex: 1;
  min-width: 160px;
  padding: 15px 24px;
  background: var(--gradient-button);
  color: var(--color-white);
  font-size: var(--text-base);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: all var(--transition-base);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
}

.btn-buy-now:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 92, 78, 0.35);
  filter: brightness(1.08);
}

/* Zalo / Phone CTA */
.product-contact-row {
  display: flex;
  gap: var(--space-12);
  margin-bottom: var(--space-32);
  flex-wrap: wrap;
}

.btn-zalo {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  background: #0068ff;
  color: var(--color-white);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  text-decoration: none;
  transition: all var(--transition-base);
}

.btn-zalo:hover {
  background: #0055cc;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 104, 255, 0.3);
}

.btn-phone {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  background: var(--color-success);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  text-decoration: none;
  transition: all var(--transition-base);
}

.btn-phone:hover {
  background: #1b5e20;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(46, 125, 50, 0.3);
}

/* Guarantees strip */
.product-guarantees {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12);
  padding: var(--space-20);
  background: var(--color-cream);
  border-radius: var(--radius-md);
  border: var(--border-light);
  margin-bottom: var(--space-24);
}

.guarantee-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-8);
}

.guarantee-item svg {
  color: var(--color-gold);
}

.guarantee-item span {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-medium);
  line-height: 1.4;
}


/* --- Product tabs (description / ingredients / reviews) --- */

.product-tabs {
  margin-top: var(--space-80);
  border-top: var(--border-light);
  padding-top: var(--space-64);
}

.product-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-gold-pale);
  margin-bottom: var(--space-48);
  overflow-x: auto;
  scrollbar-width: none;
}

.product-tab-nav::-webkit-scrollbar {
  display: none;
}

.product-tab-btn {
  padding: var(--space-16) var(--space-32);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.product-tab-btn:hover {
  color: var(--color-text-medium);
}

.product-tab-btn.active,
.product-tab-btn[aria-selected="true"] {
  color: var(--color-selected);
  border-bottom-color: var(--color-selected);
}

.product-tab-btn:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: -2px;
}

.product-tab-panel {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.product-tab-panel[hidden] {
  display: none;
}

.product-tab-content {
  font-size: var(--text-base);
  color: var(--color-text-medium);
  line-height: var(--leading-relaxed);
  max-width: 760px;
}

.product-tab-content h4 {
  font-size: var(--text-xl);
  color: var(--color-text);
  margin: var(--space-32) 0 var(--space-16);
}

.product-tab-content h4:first-child {
  margin-top: 0;
}

.product-tab-content ul,
.product-tab-content ol {
  padding-left: var(--space-24);
  margin-bottom: var(--space-20);
}

.product-tab-content li {
  margin-bottom: var(--space-8);
}


/* --- Reviews --- */

.reviews-summary {
  display: flex;
  align-items: center;
  gap: var(--space-40);
  padding: var(--space-32);
  background: var(--color-cream);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-40);
  border: var(--border-light);
}

.reviews-score {
  text-align: center;
  flex-shrink: 0;
}

.reviews-score-number {
  font-family: var(--font-heading);
  font-size: 64px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  display: block;
}

.reviews-score-stars {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin: var(--space-8) 0 var(--space-4);
}

.reviews-score-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reviews-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.review-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.review-bar-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 40px;
}

.review-bar-track {
  flex: 1;
  height: 8px;
  background: var(--color-gold-pale);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.review-bar-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: var(--radius-full);
  transition: width 0.6s ease-out;
}

.review-bar-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-width: 24px;
  text-align: right;
}

/* Individual review item */
.review-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
}

.review-item {
  padding-bottom: var(--space-32);
  border-bottom: var(--border-light);
}

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

.review-header {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  margin-bottom: var(--space-12);
}

.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-gold-pale);
  flex-shrink: 0;
  border: 2px solid var(--color-gold-pale);
}

.review-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-meta {
  flex: 1;
}

.review-name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-text);
  display: block;
}

.review-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.review-stars {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-8);
}

.review-text {
  font-size: var(--text-sm);
  color: var(--color-text-medium);
  line-height: var(--leading-relaxed);
}

.review-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-success);
  font-weight: 500;
  margin-top: var(--space-8);
}


/* ==============================================
   6. CART PAGE (gio-hang.html)
   ============================================== */

.cart-page {
  padding-top: var(--space-64);
  padding-bottom: var(--space-96);
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-48);
  align-items: start;
}

/* Cart items table */
.cart-table {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cart-table-header {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 40px;
  gap: var(--space-16);
  padding: var(--space-16) var(--space-24);
  background: var(--color-cream);
  border-bottom: var(--border-light);
}

.cart-table-header span {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cart-item {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 40px;
  gap: var(--space-16);
  padding: var(--space-20) var(--space-24);
  align-items: center;
  border-bottom: var(--border-light);
  transition: background var(--transition-fast);
}

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

.cart-item:hover {
  background: var(--color-cream);
}

.cart-item-product {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

.cart-item-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-cream);
  border: var(--border-light);
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-price,
.cart-item-subtotal {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.cart-item-subtotal {
  color: var(--color-primary);
}

.cart-item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.cart-item-remove:hover {
  background: rgba(198, 40, 40, 0.1);
  color: var(--color-sale);
}

/* Empty cart state */
.cart-empty {
  text-align: center;
  padding: var(--space-96) var(--space-32);
}

.cart-empty svg {
  color: var(--color-brand-light);
  margin: 0 auto var(--space-24);
  opacity: 0.4;
}

.cart-empty h3 {
  font-size: var(--text-2xl);
  color: var(--color-text);
  margin-bottom: var(--space-12);
}

.cart-empty p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-32);
}

/* Cart summary sidebar */
.cart-summary {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  box-shadow: var(--shadow-sm);
  padding: var(--space-32);
  position: sticky;
  top: calc(var(--header-height) + var(--space-32));
}

.cart-summary-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-24);
  padding-bottom: var(--space-16);
  border-bottom: var(--border-light);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-12) 0;
  font-size: var(--text-sm);
  color: var(--color-text-medium);
  border-bottom: var(--border-light);
}

.cart-summary-row:last-of-type {
  border-bottom: none;
}

.cart-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-20) 0 var(--space-24);
  border-top: 2px solid var(--color-gold-pale);
  margin-top: var(--space-8);
}

.cart-summary-total .label {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.cart-summary-total .value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
}

/* Voucher input */
.voucher-row {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-24);
}

.voucher-row input {
  flex: 1;
  padding: 10px 14px;
  font-size: var(--text-sm);
  border: var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-cream);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.voucher-row input:focus {
  outline: none;
  border-color: var(--color-gold);
  background: var(--color-surface);
}

.voucher-row button {
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-brand-medium);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.voucher-row button:hover {
  background: var(--color-brand);
}

.voucher-success {
  font-size: var(--text-sm);
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-16);
}

.voucher-error {
  font-size: var(--text-sm);
  color: var(--color-sale);
  margin-bottom: var(--space-16);
}


/* ==============================================
   7. RESPONSIVE — Products Page
   ============================================== */

@media (max-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1023px) {
  .products-grid,
  .products-grid--3col {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: var(--space-48);
  }

  .product-gallery {
    position: static;
    max-width: 560px;
    margin: 0 auto;
  }

  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }

  .products-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .products-search {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 767px) {
  .products-grid,
  .products-grid--3col,
  .products-grid--2col {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-16);
  }

  .product-card-body {
    padding: var(--space-16);
    gap: var(--space-8);
  }

  .product-name {
    font-size: var(--text-base);
  }

  .price-current {
    font-size: var(--text-md);
  }

  .cart-table-header {
    display: none;
  }

  .cart-item {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-12);
  }

  .cart-item-product {
    grid-column: 1 / -1;
  }

  .product-cta-row {
    flex-direction: column;
  }

  .product-contact-row {
    flex-direction: column;
  }

  .product-guarantees {
    grid-template-columns: 1fr;
  }

  .reviews-summary {
    flex-direction: column;
    gap: var(--space-24);
    align-items: flex-start;
  }

  .product-tab-btn {
    padding: var(--space-12) var(--space-20);
  }
}

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

/* ==============================================
   BEM ALIASES (product-card__* → product-card-*)
   ============================================== */

.product-card__img-wrap  { position: relative; aspect-ratio: 1/1; overflow: hidden; background: var(--color-cream); flex-shrink: 0; display: block; }
.product-card__img       { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); display: block; }
.product-card:hover .product-card__img { transform: scale(1.05); }
.product-card__img-wrap::after {
  content: 'Xem nhanh';
  position: absolute; inset: 0;
  background: rgba(43,36,32,0.55);
  color: var(--color-white);
  font-size: var(--text-sm); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition-base);
}
.product-card:hover .product-card__img-wrap::after { opacity: 1; }

/* Hết hàng đã chiếm chỗ rồi — không hiện chữ "Xem nhanh" đè lên khi hover nữa */
.product-card--soldout:hover .product-card-img::after,
.product-card--soldout:hover .product-card__img-wrap::after {
  opacity: 0;
}

.product-card__body      { padding: var(--space-20); display: flex; flex-direction: column; flex: 1; gap: var(--space-10); cursor: pointer; }
.product-card__name      { font-family: var(--font-heading); font-size: var(--text-md); font-weight: 600; line-height: var(--leading-snug); color: var(--color-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card__name a    { color: inherit; text-decoration: none; }
.product-card__name a:hover { color: var(--color-selected); }
.product-card__subtitle  { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: -4px; }
.product-card__rating    { display: flex; align-items: center; gap: 2px; color: var(--color-gold); }
.product-card__review-count { font-size: var(--text-xs); color: var(--color-text-muted); margin-left: 4px; }
.product-card__price     { display: flex; align-items: baseline; gap: var(--space-8); flex-wrap: wrap; }

/* Blog card BEM */
.blog-card__img-wrap     { display: block; aspect-ratio: 16/10; overflow: hidden; position: relative; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.blog-card__img          { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.blog-card:hover .blog-card__img { transform: scale(1.04); }
.blog-card__category     { position: absolute; top: var(--space-12); left: var(--space-12); background: var(--color-gold); color: var(--color-brand); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--radius-full); }
.blog-card__body         { padding: var(--space-24); display: flex; flex-direction: column; gap: var(--space-10); flex: 1; }
.blog-card__meta         { display: flex; align-items: center; gap: var(--space-6); font-size: var(--text-xs); color: var(--color-text-muted); }
.blog-card__title        { font-family: var(--font-heading); font-size: var(--text-md); font-weight: 600; line-height: var(--leading-snug); color: var(--color-brand); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card__title a      { color: inherit; text-decoration: none; }
.blog-card__title a:hover{ color: var(--color-selected); }
.blog-card__excerpt      { font-size: var(--text-sm); color: var(--color-text-medium); line-height: var(--leading-relaxed); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card__read-more    { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--color-selected); margin-top: auto; text-decoration: none; }
.blog-card__read-more:hover { gap: 10px; }

/* Product card overlay (quick view trigger on san-pham.html) */
.product-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(43,36,32,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.product-card:hover .product-card__overlay { opacity: 1; pointer-events: auto; }
.product-card__qv-label {
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* List view mode */
.products-grid--list {
  grid-template-columns: 1fr !important;
}
.products-grid--list .product-card {
  flex-direction: row;
}
.products-grid--list .product-card__img-wrap {
  width: 200px;
  flex-shrink: 0;
  aspect-ratio: auto;
  height: 200px;
}
.products-grid--list .product-card__body {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-16);
}
.products-grid--list .product-card__name { flex: 1 1 100%; }
.products-grid--list .product-card__price { margin-right: auto; }
.products-grid--list .btn-add-cart { align-self: flex-end; }
@media (max-width: 600px) {
  .products-grid--list .product-card { flex-direction: column; }
  .products-grid--list .product-card__img-wrap { width: 100%; height: auto; aspect-ratio: 4/3; }
}


/* ==============================================
   THẺ SẢN PHẨM — THIẾT KẾ MỚI (chốt 27/08/2026)
   Port từ bản mẫu đã duyệt (mau-the-san-pham/xem-truoc.html).
   Đặt CUỐI FILE để override các rule .product-card* phía trên — gom
   1 chỗ cho dễ soát/hoàn tác. Áp dụng MỌI trang dùng .product-card.
   Giữ nguyên: quick-view "Xem nhanh" (::after), overlay hết hàng,
   trạng thái nút .added, chế độ list-view.
   ============================================== */

/* Khung thẻ: nền trắng, viền vàng nhạt, bo tròn rõ, nhấc cao hơn khi hover */
.product-card {
  background: var(--color-white);
  border: 1px solid rgba(201, 162, 75, 0.22);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(201, 162, 75, 0.5);
}
.product-card:hover .product-card__img { transform: scale(1.06); }

/* Badge: bỏ in hoa, gọn hơn, có bóng nhẹ (giữ nguyên màu theo loại) */
.product-badge {
  padding: 4px 10px;
  text-transform: none;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Thân thẻ — phân cấp có chủ đích, khoảng cách nhịp nhàng */
.product-card__body { padding: 16px 16px 18px; gap: 9px; }
.product-card__name {
  font-size: 1.06rem;
  line-height: 1.35;
  min-height: 2.7em; /* giữ 2 dòng đều nhau giữa các thẻ */
}
.product-card__name a:hover { color: var(--color-primary); }
.product-card__subtitle {
  font-size: 0.82rem;
  margin-top: -3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;   /* mô tả dài chỉ 1 dòng, không vỡ thẻ */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hàng social proof: sao đánh giá · đã bán (tự ẩn khi builder không sinh ra) */
.product-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--color-text-muted);
  min-height: 1.1em;
}
.product-card__rating { gap: 3px; color: var(--color-gold); }
.product-card__rating svg { width: 13px; height: 13px; }
.product-card__review-count {
  margin-left: 0;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.product-card__sold { position: relative; font-variant-numeric: tabular-nums; }
/* Chấm ngăn cách chỉ hiện khi "đã bán" đứng sau phần đánh giá */
.product-card__meta > .product-card__sold:not(:first-child) { padding-left: 9px; }
.product-card__meta > .product-card__sold:not(:first-child)::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--color-text-muted);
}

/* Khối giá — neo đáy; font CHỮ SỐ đổi sang Montserrat + căn đều hàng cho sắc */
.product-card__price { margin-top: auto; padding-top: 2px; }
.price-current {
  font-family: var(--font-body);
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.price-old {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: line-through;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Nút thêm giỏ — full width, gradient nâu-cam (khớp mẫu chính xác) */
.btn-add-cart {
  margin-top: 12px;
  padding: 11px 14px;
  color: var(--color-white);
  background: var(--gradient-button);
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  letter-spacing: 0;
}
.btn-add-cart:hover {
  background: var(--gradient-button);
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: none;
}

/* Hết hàng — khớp mẫu:
   - ảnh xám nhẹ + overlay chữ "Hết hàng" (chữ thường, không in hoa)
   - nút XÁM ĐẶC (không phải đỏ mờ hồng) */
.product-card--soldout .product-card__img { filter: grayscale(0.35); }
.product-card--soldout .product-card__img-wrap::before {
  background: rgba(43, 36, 32, 0.5);
  color: var(--color-white);
  text-transform: none;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.product-card--soldout .btn-add-cart {
  background: #d8d2c8;
  color: #8a8378;
  opacity: 1;
  filter: none;
  cursor: not-allowed;
}
