/* Kafelek produktu — wspólny dla strony głównej, kategorii i wyszukiwania. */

.xs-grid {
  display: grid;
  gap: 12px;
}

.xs-grid--home {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.xs-tile {
  background: var(--xs-surface);
  border: 1px solid var(--xs-line);
  border-radius: 20px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xs-tile__image {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--xs-surface);
}

.xs-tile__image img {
  position: absolute;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.xs-badges {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.xs-badge {
  padding: 4px 8px;
  border-radius: var(--xs-radius);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.xs-badge--promo {
  background: var(--xs-promo);
}

.xs-badge--last {
  background: var(--xs-dark);
}

.xs-badge--preorder {
  background: #2f6fd0;
}

/* Kwota obniżki (od najniższej ceny z 30 dni) — obok „Promocja”, odróżniona białym tłem. */
.xs-badge--off {
  padding: 3px 7px;
  border: 1px solid var(--xs-promo);
  background: var(--xs-surface);
  color: var(--xs-promo);
}

.xs-tile__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}

.xs-tile__brand {
  font-size: 11px;
  font-weight: 600;
  color: var(--xs-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.xs-tile__name {
  min-height: 53px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
}

.xs-tile__lowest {
  font-size: 11px;
  line-height: 1.3;
  color: var(--xs-muted);
}

.xs-tile__lowest-price {
  white-space: nowrap;
}

.xs-tile__lowest .woocommerce-Price-amount {
  font-weight: 400;
}

.xs-tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 4px;
}

.xs-tile__price {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Produkt bez ceny (jeszcze nie w sprzedaży). */
.xs-tile__price--none {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--xs-muted);
}

.xs-tile__cart {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--xs-radius);
  background: var(--xs-brand);
  color: var(--xs-text);
}

.xs-tile__cart:hover {
  color: var(--xs-text);
  filter: brightness(1.05);
}

.xs-tile__cart.loading {
  opacity: 0.5;
}

/* WooCommerce dokleja link „Zobacz koszyk” po dodaniu — koszyk w nagłówku odświeża się sam.
   Selektor mocniejszy niż „.woocommerce a.added_to_cart” z arkusza WooCommerce. */
.xs-tile a.added_to_cart.wc-forward {
  display: none;
}

@media (max-width: 1200px) {
  .xs-grid--home {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .xs-grid--home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .xs-tile {
    border-radius: 16px;
    gap: 6px;
  }

  .xs-tile__name {
    min-height: 49px;
    font-size: 12px;
  }

  .xs-tile__price {
    font-size: 15px;
  }

  .xs-tile__cart {
    width: 40px;
    height: 40px;
  }
}

/* Sekcja z kafelkami: nagłówek i link „więcej” (strona główna, „Może Cię zainteresuje”). */
.xs-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.xs-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.xs-section__more {
  font-size: 15px;
  font-weight: 600;
}
