/**
 * Products: archive & category pages + shared cards (single page: single-product.css)
 *
 * @package BaitAlKaram
 */

/* ---------- Page frame ---------- */
.products-page,
.product-single {
  padding: clamp(28px, 4vw, 56px) 0 clamp(24px, 4vw, 48px);
  flex: 1;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-light);
  margin-bottom: 22px;
}
.breadcrumb a { color: var(--ink-light); transition: color 0.25s ease; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb span { opacity: 0.45; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }

.products-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.products-heading .eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.products-heading h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 700;
  line-height: 1.15;
}
.products-heading h1 .count {
  display: inline-block;
  margin-inline-start: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-light);
  vertical-align: middle;
}
.products-intro {
  max-width: 420px;
  margin: 0;
  color: var(--ink-light);
  font-size: 14px;
  line-height: 1.9;
}

/* ---------- Filter bar ---------- */
.product-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 clamp(28px, 3.5vw, 44px);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.product-filters a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.28s ease;
}
.product-filters a span {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  background: var(--mist);
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.product-filters a:hover {
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-1px);
}
.product-filters a.is-active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.product-filters a.is-active span {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ---------- Groups ---------- */
.products-group { margin-bottom: clamp(40px, 5vw, 64px); }
.products-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-inline-start: 14px;
  border-inline-start: 3px solid var(--red);
}
.products-group-heading h2 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
}
.products-subhead {
  margin: 8px 0 18px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
}

.products-group-heading h2 span {
  display: inline-block;
  margin-inline-start: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  background: rgba(186, 32, 41, 0.08);
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: middle;
}

/* ---------- Grid & cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  color: var(--ink);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(186, 32, 41, 0.35);
  box-shadow: 0 16px 34px rgba(30, 30, 30, 0.08);
}

.product-card-image {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}
.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.55s ease;
}
.product-card:hover .product-card-image img { transform: scale(1.05); }

.product-card-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, var(--mist) 0 12px, #fafafa 12px 24px);
}

.product-card-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
}

.product-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 18px;
  flex: 1;
}
.product-card-brand {
  display: inline-flex;
  align-items: center;
}
.product-card-brand .fresh-logo {
  display: block;
  height: 20px;
  width: auto;
  border-radius: 4px;
}
.product-card-cat {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
}
.product-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  min-height: 2.9em;
}
.product-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.product-sku {
  font-size: 12px;
  color: var(--ink-light);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.3px;
}
.product-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-light);
  background: var(--mist);
  padding: 3px 9px;
  border-radius: 999px;
}
.product-card-price {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.product-card-price del { color: var(--ink-light); font-weight: 400; font-size: 13px; margin-inline-end: 6px; }
.product-card-price ins { text-decoration: none; }

.product-card-price--ask { font-size: 13px; font-weight: 600; color: var(--ink-light); }
.product-card-title { color: inherit; }
.product-card-title:hover { color: var(--red); }

.product-card-footer {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.product-card-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
}
.product-card-action .jelly-arrow { width: 16px; height: 11px; }
.product-card:hover .product-card-action .jelly-arrow { transform: translateX(-4px); }

/* AJAX add-to-cart button on cards */
.product-card-cart {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  transition: background 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}
.product-card-cart svg { width: 17px; height: 17px; }
.product-card-cart:hover { background: var(--red); transform: translateY(-1px); }
.product-card-cart.loading { opacity: 0.6; pointer-events: none; }
.product-card-cart.added { background: #1fa855; }
.product-card-cart.added span { display: none; }
.product-card-cart.added::after { content: "✓ في السلة"; }
.product-card-footer .added_to_cart { display: none; }

.products-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--ink-light);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .products-heading { flex-direction: column; align-items: flex-start; }
}
.product-card-badge--oos { background: var(--err-ink); }
.pdp-oos {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  color: var(--err-ink);
  font-weight: 600;
}
.navigation.pagination { margin: 32px 0 8px; }
.navigation.pagination .nav-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.navigation.pagination a, .navigation.pagination span {
  display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600;
}
.navigation.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pdp-thumb:focus-visible, .product-card-cart:focus-visible, .search-chip:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}

@media (max-width: 700px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-card-body { padding: 12px 12px 14px; }
  .product-card-title { font-size: 13.5px; }
  .products-group-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
}
