/* =====================================================================
   tutokupisz.pl — Product Grids (modules/product-grids/grids.css)
   Profil: ELEGANT-FIXED v3.4 — Fix gray dot conflict
   ===================================================================== */

/* --------------------------- Tokeny bazowe --------------------------- */
:root {
  --accent: #2f6df6;
  --ink: #0f172a;
  --ink-muted: #5b6b85;
  --surface: #fff;
  --surface-2: #f6f7f9;
  --muted: #94a3b8;

  --tone-promo: 320 85% 62%;
  --tone-sale: 24 92% 58%;
  --tone-new: 150 68% 46%;

  --radius: 14px;
  --radius-img: 12px;
  --radius-pill: 999px;

  --gap-xxs: 10px;
  --gap-xs: 12px;
  --gap-sm: 14px;
  --gap-md: 18px;
  --gap-lg: 20px;

  --shadow-quiet: 0 1px 2px rgba(2, 6, 23, .03), 0 2px 8px rgba(2, 6, 23, .04);
  --shadow-quiet-hover: 0 2px 10px rgba(2, 6, 23, .05), 0 10px 24px rgba(2, 6, 23, .06);

  --img-ratio: 4/5;
  --t-fast: .16s;
  --t-mid: .24s;

  --container: min(1240px, 92vw);
  --card-w: 260px;

  --sale-red: #dc2626;
  --sale-red-dark: #b91c1c;

  --iconbtn-h: 40px;
  --iconbtn-r: 10px;
  --icon-size: 20px;

  --ring-a: .55;

  /* === Toast design tokens & presets === */
  --toast-pos-x: end;
  --toast-maxw: 520px;
  --toast-gap: 14px;
  --toast-pad: 12px 14px;
  --toast-radius: 14px;
  --toast-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  --toast-text: #0f172a;
  --toast-bg: rgba(255, 255, 255, .95);
  --toast-blur: 10px;
  --toast-border: 1px solid rgba(15, 23, 42, .08);
  
  /* KOLORY - ZIELONY */
  --toast-dot-ok: #16a34a;   
  --toast-dot-info: #2563eb;
  --toast-dot-warn: #d97706;
  --toast-dot-err: #dc2626;
  --toast-duration: 2600ms;
}

/* ---------------------------- Motywy sekcji -------------------------- */
.tuto-pgrids {
  --brand: var(--accent);
  --brand-ring: color-mix(in oklab, var(--brand) 36%, transparent);
  --badge-tint: 225 90% 56%;
  --card-border: rgba(2, 6, 23, .08);
  --card-border-hover: rgba(2, 6, 23, .14);
  --title-accent: var(--ink);
  --ring-grad: conic-gradient(from 0deg,
      color-mix(in oklab, var(--brand) 20%, #fff) 0 25%,
      rgba(255, 255, 255, .5),
      color-mix(in oklab, var(--brand) 18%, #fff) 75%,
      rgba(255, 255, 255, .7));
}

.tuto-pgrids.is-sale {
  --brand: hsl(var(--tone-sale));
  --badge-tint: var(--tone-sale);
  --title-accent: color-mix(in oklab, hsl(var(--tone-sale)) 14%, var(--ink));
}

.tuto-pgrids.is-bestseller {
  --brand: hsl(var(--tone-promo));
  --badge-tint: var(--tone-promo);
  --title-accent: color-mix(in oklab, hsl(var(--tone-promo)) 12%, var(--ink));
}

.tuto-pgrids.is-new {
  --brand: hsl(var(--tone-new));
  --badge-tint: var(--tone-new);
  --title-accent: color-mix(in oklab, hsl(var(--tone-new)) 12%, var(--ink));
}

/* -------------------- Reset i wrapper sekcji ------------------------ */
.tuto-pgrids,
.tuto-pgrids *,
.tuto-pgrids *::before,
.tuto-pgrids *::after {
  box-sizing: border-box;
}

.tuto-pgrids {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tuto-pgrids a {
  -webkit-tap-highlight-color: transparent;
}

.tuto-pgrids {
  position: relative;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 16px;
  color: var(--ink);
}

.tuto-pgrids__title {
  margin: 0 0 10px;
  text-align: center;
  font: 800 18px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
}

/* --------------------------- Siatka listingu ------------------------ */
.tuto-pgrids ul.products {
  display: grid;
  gap: var(--gap-sm);
  margin: 0;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(auto-fit, var(--card-w));
  justify-content: center;
}

@media (max-width:479.98px) {
  .tuto-pgrids {
    padding-inline: 8px;
  }

  .tuto-pgrids ul.products {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }

  .tuto-pgrids ul.products li.product {
    width: auto;
  }
}

@media (min-width:480px) {
  .tuto-pgrids ul.products li.product {
    width: var(--card-w);
  }
}

/* ----------------------------- Karta -------------------------------- */
.tuto-pgrids ul.products li.product {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-quiet);
  transition: transform var(--t-mid) ease, box-shadow var(--t-mid) ease, border-color var(--t-fast) ease, background-color var(--t-fast) ease, filter var(--t-fast) ease;
  contain: content;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--ink);
  background-image:
    radial-gradient(rgba(0, 0, 0, .012) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 249, 252, .85));
  background-size: 6px 6px, auto;
}

.tuto-pgrids ul.products li.product::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  opacity: .0;
  background: var(--ring-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: opacity var(--t-mid) ease;
}

.tuto-pgrids ul.products li.product:hover::before,
.tuto-pgrids ul.products li.product:focus-within::before {
  opacity: var(--ring-a);
}

.tuto-pgrids ul.products li.product:hover,
.tuto-pgrids ul.products li.product:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-quiet-hover);
  border-color: var(--card-border-hover);
  filter: saturate(1.02);
}

/* ------------------------ Media (ratio) ----------------------------- */
.tuto-card__media {
  position: relative;
  aspect-ratio: var(--img-ratio);
  overflow: hidden;
  border-radius: var(--radius-img);
  background: var(--surface-2);
  inline-size: 100%;
}

.tuto-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--t-mid) ease, filter var(--t-mid) ease;
}

.tuto-pgrids ul.products li.product:hover .tuto-card__media img {
  transform: scale(1.012);
  filter: saturate(1.03);
}

.tuto-card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 18%;
  background: linear-gradient(to top, rgba(2, 6, 23, .10), rgba(2, 6, 23, 0));
  pointer-events: none;
}

@media (max-width:480px) {
  .tuto-card__media {
    aspect-ratio: 1 / 1;
  }
}

/* ----------------------------- Badge -------------------------------- */
.tuto-pgrids ul.products li.product .onsale {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font: 800 11.5px/1.05 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: .28px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
  background: linear-gradient(135deg, var(--sale-red), color-mix(in oklab, var(--sale-red) 82%, #fff));
  border: 1px solid color-mix(in oklab, var(--sale-red-dark) 88%, #fff 12%);
  box-shadow: 0 6px 18px rgba(220, 38, 38, .22);
}

/* ------------------------------ Tytuł -------------------------------- */
.tuto-pgrids ul.products li.product .woocommerce-loop-product__title {
  margin: 8px 0 0;
  font: 700 13.6px/1.32 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--title-accent);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1em * 1.32 * 2);
}

/* ------------------------------ Ocena -------------------------------- */
.tuto-pgrids .star-rating {
  --s: 12.5px;
  font-size: var(--s);
  height: var(--s);
  line-height: var(--s);
  color: #f59e0b;
  letter-spacing: .2px;
  margin: 4px auto 0;
}

/* ------------------------------- Cena -------------------------------- */
.tuto-pgrids ul.products li.product .price {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin: 6px auto 0;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: clamp(13.5px, 3.1vw, 15px);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
  background:
    radial-gradient(40% 120% at 50% 180%, rgba(255, 255, 255, .9), transparent 70%),
    linear-gradient(180deg, rgba(15, 23, 42, .035), rgba(15, 23, 42, .02));
  border: 1px solid rgba(15, 23, 42, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.tuto-pgrids ul.products li.product .price del,
.tuto-pgrids ul.products li.product .price ins {
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
}

.tuto-pgrids ul.products li.product .price del {
  color: var(--muted);
  font-weight: 600;
  opacity: .98;
  text-decoration-thickness: .06em;
  text-decoration-color: rgba(15, 23, 42, .35);
  font-size: .9em;
}

.tuto-pgrids ul.products li.product .price ins {
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .01em;
  font-size: 1em;
}

.tuto-pgrids ul.products li.product .price:has(del) {
  background:
    radial-gradient(40% 120% at 50% 180%, rgba(255, 255, 255, .92), transparent 70%),
    linear-gradient(180deg, color-mix(in oklab, var(--sale-red) 10%, #fff) 0%, color-mix(in oklab, var(--sale-red) 4%, #fff) 100%);
  border-color: color-mix(in oklab, var(--sale-red) 46%, #fff 54%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.tuto-pgrids ul.products li.product .price:has(del) ins {
  color: var(--sale-red-dark);
}

.tuto-pgrids ul.products li.product .price:has(del) del {
  color: color-mix(in oklab, var(--sale-red-dark) 35%, var(--muted));
  text-decoration-color: color-mix(in oklab, var(--sale-red-dark) 55%, transparent);
}

/* ----------------------- Równe wysokości ---------------------------- */
.tuto-pgrids ul.products {
  align-items: stretch;
}

.tuto-pgrids ul.products li.product {
  min-height: 100%;
}

.tuto-pgrids ul.products li.product .woocommerce-loop-product__title,
.tuto-pgrids ul.products li.product .star-rating,
.tuto-pgrids ul.products li.product .price {
  width: 100%;
}

/* ======================= Actions (IKONY ONLY) ======================== */
.tuto-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--iconbtn-h);
  gap: 8px;
  width: auto;
  margin: 10px auto 0;
  justify-content: center;
  overflow: visible;
}

.tuto-iconbtn {
  all: initial;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--iconbtn-h);
  width: var(--iconbtn-h);
  border-radius: var(--iconbtn-r);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  color: color-mix(in oklab, var(--brand) 92%, #000);
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--brand) 38%, #dfe6f3 62%);
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease, border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
  isolation: isolate;
  box-shadow: 0 1px 2px rgba(2, 6, 23, .02);
}

.tuto-iconbtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(2, 6, 23, .06);
}

.tuto-iconbtn:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(2, 6, 23, .06);
}

.tuto-iconbtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Ikona jako maska na ::before — bez dzieci w HTML */
.tuto-iconbtn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: var(--icon-size);
  height: var(--icon-size);
  background: currentColor;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
  transform: translateZ(0);
}

.tuto-iconbtn--cart::before {
  mask-image: url('../../assets/icons/cart.svg');
  -webkit-mask-image: url('../../assets/icons/cart.svg');
}

.tuto-iconbtn--heart::before {
  mask-image: url('../../assets/icons/heart.svg');
  -webkit-mask-image: url('../../assets/icons/heart.svg');
}

/* Schowaj ew. tekst wstrzyknięty do ikon */
.tuto-iconbtn {
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px !important;
  white-space: nowrap !important;
}

.tuto-iconbtn>* {
  display: none !important;
}

/* ===== Serce: stały kolor (ink), bez zmiany po kliknięciu ============= */
.tuto-pgrids .tuto-iconbtn--heart {
  color: var(--ink, #0f172a) !important;
}

.tuto-pgrids .tuto-iconbtn--heart:is(.is-active, [aria-pressed="true"], :hover, :focus, :active) {
  color: var(--ink, #0f172a) !important;
}

/* Ikona jest maską – domykamy tło na currentColor, by nikt nie „przemalował” */
.tuto-pgrids .tuto-iconbtn--heart::before {
  background: currentColor !important;
}

/* Zachowaj subtelne „pulse”, ale bez zmiany barwy */
@keyframes tuto-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.tuto-pgrids .tuto-iconbtn--heart.is-active::before {
  animation: tuto-pulse .28s ease;
}

/* Schowaj cudze Woo-przyciski (gdyby się gdzieś pojawiły) */
.tuto-pgrids ul.products li.product a.add_to_cart_button:not(.tuto-iconbtn),
.tuto-pgrids ul.products li.product a.ajax_add_to_cart:not(.tuto-iconbtn),
.tuto-pgrids ul.products li.product .button:not(.tuto-iconbtn) {
  display: none !important;
}

/* ================== Twarde OFF: dymki + brzydki link ================= */
.tuto-tip { display: none !important; }
.tuto-pgrids .tuto-actions .tuto-iconbtn::after { content: none !important; }
.tuto-pgrids .products a.added_to_cart,
.tuto-pgrids .products a.added_to_cart.wc-forward { display: none !important; }

/* Wtyczki wishlist – chowamy feedbacki-teksty przy ikonach */
.tuto-pgrids .yith-wcwl-add-button .feedback,
.tuto-pgrids .yith-wcwl-wishlistaddedbrowse,
.tuto-pgrids .yith-wcwl-wishlistexistsbrowse {
  display: none !important;
}

/* -------------------- Preferencje ograniczeń ruchu ------------------ */
@media (prefers-reduced-motion:reduce) {
  .tuto-pgrids * {
    transition: none !important;
    animation: none !important;
  }
  .tuto-pgrids ul.products li.product:hover::before {
    opacity: .0 !important;
  }
}

/* ========================= TOAST (UI feedback) ====================== */
#tuto-toast-root {
  position: fixed;
  inset: auto 0 max(16px, env(safe-area-inset-bottom)) 0;
  display: grid;
  justify-items: var(--toast-pos-x);
  pointer-events: none;
  z-index: 9999;
  padding-inline: 16px;
}

@media (max-width: 640px) {
  #tuto-toast-root {
    justify-items: center;
  }
}

.tuto-toast {
  pointer-events: auto;
  max-width: min(92vw, var(--toast-maxw));
  width: max-content;
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  column-gap: var(--toast-gap);
  padding: var(--toast-pad);
  border-radius: var(--toast-radius);
  color: var(--toast-text);
  background: var(--toast-bg);
  box-shadow: var(--toast-shadow);
  border: var(--toast-border);
  -webkit-backdrop-filter: blur(var(--toast-blur));
  backdrop-filter: blur(var(--toast-blur));
  transform: translateY(10px);
  opacity: 0;
  animation: tuto-toast-in .22s ease-out forwards;
  position: relative;
  overflow: hidden;
}

/* === FIX KONFLIKTU Z MINICART.CSS (SZARA KROPKA) === */
/* Wyłączamy szarą kropkę z minicarta, jeśli się tu wkrada */
.tuto-toast[data-variant]::before {
    display: none !important;
    content: none !important;
}

/* Wymuszamy ZIELONĄ kropkę w naszym spanie */
.tuto-toast[data-variant="ok"] .tuto-toast__dot {
  background-color: #16a34a !important; /* Force Green */
  background: #16a34a !important;
}
/* =================================================== */

.tuto-toast[data-variant="info"] .tuto-toast__dot { background: var(--toast-dot-info); }
.tuto-toast[data-variant="warn"] .tuto-toast__dot { background: var(--toast-dot-warn); }
.tuto-toast[data-variant="err"] .tuto-toast__dot { background: var(--toast-dot-err); }

/* Progres życia toasta */
.tuto-toast::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: currentColor;
  opacity: .18;
  transform-origin: left center;
  animation: tuto-toast-progress var(--toast-duration) linear forwards;
}

@keyframes tuto-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.tuto-toast__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: block; /* Upewniamy się, że to block */
}

.tuto-toast__msg {
  font: 700 14px/1.25 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: .2px;
}

.tuto-toast__sub {
  font: 500 13px/1.25 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  opacity: .9;
}

.tuto-toast__close {
  margin-left: 6px;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;
}

.tuto-toast__close:hover {
  background: rgba(15, 23, 42, .06);
}

.tuto-toast__close:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

@keyframes tuto-toast-in {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes tuto-toast-out {
  to { transform: translateY(10px); opacity: 0; }
}

/* Odstęp między wieloma toastami */
#tuto-toast-root .tuto-toast+.tuto-toast {
  margin-top: 10px;
}

@media (prefers-reduced-motion:reduce) {
  .tuto-toast,
  .tuto-toast::after {
    animation: none !important;
  }
}

/* Ukrywa TYLKO serce w dolnym pasku (to obok koszyka) */
.tuto-actions .tuto-iconbtn--heart {
    display: none !important;
}