/* Our Products — premium marketplace product cards */
.products-section {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) clamp(16px, 3vw, 24px);
  box-sizing: border-box;
}

.products-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.products-section-title h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #fff;
}

.products-section-sub {
  margin: 0;
  font-size: 0.9rem;
  color: #94a3b8;
  font-weight: 600;
}

.products-price-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Grid — equal rows, consistent gaps */
#products #productsGrid.products-grid {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  grid-template-columns: repeat(3, minmax(240px, 1fr)) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

#products .product-card-grid-item {
  height: 100%;
}

/* Card shell */
#products .product-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 460px !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
}

#products .product-card .listing-policy-box,
#products .product-card .listing-policy-title,
#products .product-card .listing-policy-text,
#products .product-card .listing-policy-disclaimer,
#products .product-card .listing-policy-clamp,
#products .product-card .product-desc-block,
#products .product-card .product-desc-clamp,
#products .product-card .product-policy-compact,
#products .product-card .product-info > .desc,
#products .product-card .product-info > p.desc,
#products .product-card .desc-toggle-btn {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#products .product-card:hover {
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(233, 69, 96, 0.1) !important;
  z-index: 2;
}

/* Media block — image, thumbs, title */
#products .product-card-media {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: visible;
}

#products .product-image-container {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: 220px !important;
  aspect-ratio: 5 / 4 !important;
  background: #0f172a !important;
  overflow: hidden !important;
  border-radius: 0 !important;
  flex-shrink: 0 !important;
}

#products .product-image-container img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

#products .product-card:hover .product-image-container img {
  transform: none !important;
}

#products .product-image-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 12;
  pointer-events: none;
}

#products .product-image-overlay .product-badge {
  pointer-events: auto;
}

#products .product-card-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.2;
}

#products .product-thumbnails {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 8px 10px;
  margin: 0 !important;
  min-height: 52px;
  max-height: 52px;
  flex: 0 0 52px;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  position: relative;
  z-index: 2;
}

/* Title — directly under image / thumbnails, always visible */
#products .product-card-title-block {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 10px 12px 10px;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 24, 0.55);
  overflow: visible;
  position: relative;
  z-index: 3;
}

#products .product-thumb {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px;
  flex: 0 0 36px;
  object-fit: cover !important;
  border-radius: 6px !important;
  border: 2px solid transparent !important;
  cursor: pointer;
}

#products .product-thumb.active {
  border-color: #e94560 !important;
}

#products .product-thumb.more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
}

/* Body — price / meta / links */
#products .product-card-body {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow: visible !important;
  padding: 12px 14px 10px !important;
  gap: 10px;
}

#products .product-card-body.product-info {
  padding: 12px 14px 10px !important;
}

/* Product name — max 2 lines, reserved height 42–48px */
#products .product-card-title-block .product-card-title,
#products .product-card-title {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 42px !important;
  max-height: none !important;
  overflow: visible !important;
  font-size: 15px !important;
  line-height: 1.35 !important;
  font-weight: 800 !important;
}

#products .product-card-title-link {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 42px !important;
  max-height: 48px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.02em;
  color: #f8fafc !important;
  text-decoration: none !important;
  word-break: break-word;
  overflow-wrap: break-word;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

#products .product-card-title-link:hover {
  color: #ff8fa8 !important;
}

/* Legacy class from older renders */
#products .product-title,
#products .product-card-body h3.product-title {
  margin: 0 !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  color: #f8fafc !important;
  min-height: 42px !important;
}

/* Short subtitle only — no full policy/description in grid DOM */
#products .product-card-subtitle {
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  color: #94a3b8 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 1 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  min-height: 1.35em !important;
  max-height: 1.35em !important;
}

#products .product-card-detail-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0;
  padding-top: 2px;
}

#products .product-card-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: none;
  color: #ff6b8a;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}

#products .product-card-link-btn:hover {
  color: #fff;
  text-decoration: underline;
}

#products .product-card-link-btn--quiet {
  color: #7f8aa3;
}

#products .product-card-link-btn--quiet:hover {
  color: #e8eef8;
}

/* Lazy-loaded policy modal (not in card grid) */
.product-card-modal-content {
  max-width: 520px !important;
  max-height: min(88vh, 720px);
  overflow-y: auto;
}

.product-card-modal-label {
  margin: 16px 0 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7f8aa3;
}

.product-card-modal-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: #cbd5e1;
}

.product-card-modal-policy-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.product-card-modal-disclaimer {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  line-height: 1.45;
  color: #64748b;
}

.product-card-modal-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#products .product-card-pricing {
  margin-top: 4px;
  padding-top: 6px;
}

#products .product-prices {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 0 0 4px !important;
  min-height: 1.35rem;
}

#products .price-main,
#products .price-sale {
  font-size: 1.05rem !important;
  font-weight: 900 !important;
  color: #fff !important;
  letter-spacing: -0.02em;
}

#products .price-secondary {
  font-size: 0.7rem !important;
  color: #94a3b8 !important;
  font-weight: 700 !important;
}

#products .price-original {
  font-size: 0.8rem !important;
  color: #64748b !important;
  text-decoration: line-through !important;
}

#products .price-badge-discount {
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  color: #fb923c !important;
  padding: 2px 6px !important;
  border-radius: 999px !important;
  background: rgba(251, 146, 60, 0.12) !important;
  border: 1px solid rgba(251, 146, 60, 0.3) !important;
}

#products .product-stock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 1.25rem;
}

#products .stock-info {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #cbd5e1 !important;
  margin: 0 !important;
}

#products .product-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 !important;
}

#products .product-chip {
  font-size: 10px !important;
  padding: 3px 7px !important;
}

#products .product-sku-admin {
  font-size: 10px;
  color: #64748b;
  margin: 0;
}

/* Footer — CTA pinned bottom */
#products .product-card-footer {
  flex: 0 0 auto;
  margin-top: auto !important;
  padding: 12px 14px 14px !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#products .product-card-actions,
#products .product-card-footer .action-buttons {
  margin: 0 !important;
  padding: 0 !important;
}

#products .product-card-footer .btn-action {
  width: 100% !important;
  min-height: 42px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

#products .product-card-footer .out-of-stock {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

#products .product-notify-compact {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.35;
}

#products .product-card-footer .notify-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#products .product-card-footer .notify-btn {
  flex: 1;
  min-width: 0;
  font-size: 10px !important;
  padding: 6px 8px !important;
}

#products .product-card-admin {
  display: flex;
  gap: 6px;
  padding-top: 4px;
}

#products .product-card-footer .product-card-admin {
  padding: 0;
  margin-top: 4px;
}

#products .product-card-admin button {
  flex: 1;
  padding: 6px;
  font-size: 10px;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#products .product-coming-soon-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  text-align: center;
  padding: 12px;
  font-size: 14px;
  z-index: 11;
}

#products .product-coming-soon-overlay span {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  opacity: 0.9;
}

#products .product-image-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: auto;
}

/* Catalog toolbar */
#products .catalog-toolbar {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(18, 27, 48, 0.92), rgba(11, 17, 32, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

#products .catalog-toolbar-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

#products .catalog-search,
#products .catalog-select {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

#products .catalog-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
}

#products .catalog-pagination {
  margin-top: 24px;
  padding-top: 8px;
}

/* Wide desktop — 4 columns max (wider cards, readable titles) */
@media (min-width: 1400px) {
  #products #productsGrid.products-grid {
    grid-template-columns: repeat(4, minmax(260px, 1fr)) !important;
    gap: 20px !important;
  }
}

@media (min-width: 1100px) and (max-width: 1399px) {
  #products #productsGrid.products-grid {
    grid-template-columns: repeat(3, minmax(240px, 1fr)) !important;
  }
}

/* Tablet 2 columns */
@media (max-width: 1024px) {
  #products #productsGrid.products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
}

@media (max-width: 900px) {
  #products .catalog-toolbar-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile 2 then 1 */
@media (max-width: 640px) {
  #products #productsGrid.products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #products .product-card-body {
    padding: 10px 10px 6px !important;
  }

  #products .product-card-footer {
    padding: 8px 10px 12px !important;
  }

  #products .product-card-title-link {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }
}

@media (max-width: 400px) {
  #products #productsGrid.products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #products .product-card,
  #products .product-image-container img {
    transition: none !important;
  }
  #products .product-card:hover {
    transform: none !important;
  }
  #products .product-card:hover .product-image-container img {
    transform: none !important;
  }
}

@media (max-width: 768px) {
  #products .product-card-subtitle {
    min-height: 2.6em !important;
    max-height: 2.6em !important;
    font-size: 11px !important;
  }

  #products .product-card-detail-links {
    gap: 8px 10px;
  }
}
