/* ============================================================
   RACEPARTS.PL — SHOP / ARCHIVE PAGE
   Matches design/view-shop.html (Etap 3)
   ============================================================ */

/* ── Hide Storefront's duplicate sorting bar ──────────────── */
.storefront-sorting { display: none !important; }

/* ── Force full-width (override Storefront right-sidebar) ─── */
.woocommerce-shop #secondary,
.tax-product_cat #secondary,
.post-type-archive-product #secondary { display: none !important; }

.woocommerce-shop #primary,
.tax-product_cat #primary,
.post-type-archive-product #primary { width: 100% !important; float: none !important; }

/* ── Page wrapper ─────────────────────────────────────────── */
.rp-shop-page { display: flex; flex-direction: column; }

/* ── Breadcrumb bar ───────────────────────────────────────── */
.crumbs-bar {
  padding-block: var(--rp-space-3);
  border-bottom: 1px solid var(--rp-border);
}
.crumbs-bar .woocommerce-breadcrumb {
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-xs);
  color: var(--rp-text-muted);
  letter-spacing: var(--rp-track-wide);
}
.crumbs-bar .woocommerce-breadcrumb a { color: var(--rp-text-secondary); }
.crumbs-bar .woocommerce-breadcrumb a:hover { color: var(--rp-red); }

/* ── Shop header ──────────────────────────────────────────── */
.shop-head {
  padding-block: var(--rp-space-5) var(--rp-space-4);
}
.shop-head .eyebrow {
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-xs);
  letter-spacing: var(--rp-track-wider);
  text-transform: uppercase;
  color: var(--rp-text-muted);
}
.rp-shop-title {
  font-weight: var(--rp-w-black);
  font-style: italic;
  font-size: clamp(var(--rp-text-3xl), 5vw, var(--rp-text-4xl));
  text-transform: uppercase;
  letter-spacing: var(--rp-track-tight);
  margin-top: var(--rp-space-2);
  line-height: var(--rp-leading-tight);
}
.rp-shop-desc {
  margin-top: var(--rp-space-3);
  max-width: 62ch;
  color: var(--rp-text-secondary);
}

/* ── 2-col layout: sidebar + main ────────────────────────── */
.shop {
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: var(--rp-space-10);
  padding-bottom: var(--rp-space-16);
  align-items: start;
}
@media (max-width: 920px) {
  .shop { grid-template-columns: 1fr; }
  .shop__filters { order: 2; position: static; }
}

/* ── Filters sidebar ──────────────────────────────────────── */
.shop__filters {
  align-self: start;
  position: sticky;
  top: var(--rp-space-8);
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
}

.fgroup {
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  background: var(--rp-bg-surface);
  overflow: hidden;
}
.fgroup__head {
  padding: var(--rp-space-3) var(--rp-space-4);
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-xs);
  letter-spacing: var(--rp-track-wide);
  text-transform: uppercase;
  color: var(--rp-text-muted);
  border-bottom: 1px solid var(--rp-border);
  background: var(--rp-bg-inset, var(--rp-bg));
}
.fgroup__body {
  padding: var(--rp-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
}

/* Category + availability links */
.rp-flink {
  display: flex;
  align-items: center;
  font-size: var(--rp-text-sm);
  color: var(--rp-text-secondary);
  text-decoration: none;
  transition: color var(--rp-transition);
  gap: var(--rp-space-2);
}
.rp-flink:hover { color: var(--rp-text-primary); }
.rp-flink.is-active { color: var(--rp-red); font-weight: 600; }

.fcount {
  margin-left: auto;
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-xs);
  color: var(--rp-text-muted);
}

/* Price range inputs */
.price-range {
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
}
.price-range input { width: 100%; }
.price-range span { color: var(--rp-text-muted); flex-shrink: 0; }

/* Availability checkbox link */
.rp-check.rp-flink {
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
  cursor: pointer;
}
.rp-check__box {
  width: 16px;
  height: 16px;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-sm);
  background: var(--rp-bg);
  flex-shrink: 0;
  position: relative;
  transition: border-color var(--rp-transition), background var(--rp-transition);
}
.rp-check__box.is-checked {
  background: var(--rp-red);
  border-color: var(--rp-red);
}
.rp-check__box.is-checked::after {
  content: '';
  position: absolute;
  inset: 3px 2px 2px 3px;
  border: 2px solid #fff;
  border-top: none;
  border-right: none;
  transform: rotate(-45deg);
}

/* ── Main content area ────────────────────────────────────── */
.shop__main {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-5);
  min-width: 0;
}

/* ── Toolbar ──────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rp-space-4);
  flex-wrap: wrap;
  padding-bottom: var(--rp-space-4);
  border-bottom: 1px solid var(--rp-border);
}
.toolbar__count { display: contents; }
.woocommerce-result-count {
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-sm);
  color: var(--rp-text-secondary);
  margin: 0;
}
.toolbar__sort { display: flex; align-items: center; gap: var(--rp-space-3); }
.woocommerce-ordering { margin: 0; }
.woocommerce-ordering select {
  background: var(--rp-bg-surface) !important;
  border: 1px solid var(--rp-border) !important;
  color: var(--rp-text-secondary) !important;
  font-family: var(--rp-font-mono) !important;
  font-size: var(--rp-text-xs) !important;
  padding: 0.4em 0.8em !important;
  border-radius: var(--rp-radius) !important;
}

/* ── Product grid ─────────────────────────────────────────── */
/* Neutralise WooCommerce clearfix — ::before/::after become ghost grid items */
ul.products::before,
ul.products::after {
  content: none !important;
  display: none !important;
}

ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: var(--rp-space-5) !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
@media (max-width: 1100px) {
  ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 520px) {
  ul.products { grid-template-columns: 1fr !important; }
}

/* ── Product card (.rp-product) ───────────────────────────── */
li.rp-product {
  background: var(--rp-bg-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--rp-transition), transform var(--rp-transition), box-shadow var(--rp-transition);
}
li.rp-product:hover {
  border-color: var(--rp-red);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 1px var(--rp-red-500);
}

/* Media (image wrapper) — brak ciemnej ramki, cover wypełnia kwadrat */
.rp-product__media {
  display: block;
  position: relative;
  background: var(--rp-bg-surface);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  text-decoration: none;
}
.rp-product__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  padding: 0 !important;
  transition: transform var(--rp-transition-slow);
}
li.rp-product:hover .rp-product__media img { transform: scale(1.05); }

/* Placeholder */
.rp-product__ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rp-border);
}
.rp-product__ph svg { width: 48px; height: 48px; }

/* Badges overlay */
.rp-product__tags {
  position: absolute;
  top: var(--rp-space-3);
  left: var(--rp-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-1);
}

/* Body */
.rp-product__body {
  padding: var(--rp-space-3) var(--rp-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
  flex: 1;
}

/* SKU — ukryte na kartach sklepu (widoczne tylko na PDP) */
.rp-product__sku { display: none !important; }

/* Title — sentence case dla czytelności wielowyrazowych nazw (DfH typografia) */
.rp-product__title {
  font-family: var(--rp-font-sans);
  font-size: var(--rp-text-base);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rp-product__title a {
  color: var(--rp-text-primary);
  text-decoration: none;
}
.rp-product__title a:hover { color: var(--rp-red); }

/* Fit tags */
.rp-product__fit {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rp-space-1);
}

/* Footer: price + ATC — vertical stack for narrow cards */
.rp-product__foot {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
  padding: var(--rp-space-3) var(--rp-space-4) var(--rp-space-4);
  border-top: 1px solid var(--rp-border);
  margin-top: auto;
}

.rp-product__price {
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-2xl);
  font-weight: 700;
  color: var(--rp-text-primary);
  line-height: 1;
}
.rp-product__price .woocommerce-Price-amount { font: inherit; color: inherit; }
.rp-product__price del { color: var(--rp-text-muted); font-size: var(--rp-text-sm); margin-right: var(--rp-space-1); }

/* ATC button — full width */
li.rp-product .add_to_cart_button,
li.rp-product .button {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  font-size: var(--rp-text-sm) !important;
  padding: 0.6em 1em !important;
  white-space: nowrap;
}

/* ── Pagination ───────────────────────────────────────────── */
.woocommerce-pagination {
  margin-top: var(--rp-space-8);
  display: flex;
  justify-content: center;
}
.woocommerce-pagination ul {
  display: flex;
  gap: var(--rp-space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding-inline: var(--rp-space-3);
  background: var(--rp-bg-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  font-family: var(--rp-font-mono);
  font-size: var(--rp-text-sm);
  font-weight: 600;
  color: var(--rp-text-secondary);
  text-decoration: none;
  transition: border-color var(--rp-transition), color var(--rp-transition);
}
.woocommerce-pagination ul li a:hover { border-color: var(--rp-red); color: var(--rp-red); }
.woocommerce-pagination ul li span.current {
  background: var(--rp-red);
  border-color: var(--rp-red);
  color: #fff;
}
