/**
 * Shop Categories Grid - Nowoczesny widok kafelkowy
 * TYLKO dla strony głównej sklepu /sklep (body.post-type-archive-product)
 * Nie wpływa na widok produktów w kategoriach
 * Version: 2.0
 */

/* =====================================================
   FIX: Usunięcie "ducha" - pseudo-elementów clearfix
   Dotyczy TYLKO strony głównej sklepu
   ===================================================== */

body.post-type-archive-product .woocommerce ul.products::before,
body.post-type-archive-product .woocommerce ul.products::after,
body.post-type-archive-product ul.products::before,
body.post-type-archive-product ul.products::after {
  content: none !important;
  display: none !important;
}

/* =====================================================
   KONTENER GRID - Tylko strona główna sklepu
   ===================================================== */

body.post-type-archive-product .woocommerce ul.products,
body.post-type-archive-product ul.products {
  /* Wyłącz stare layouty */
  float: none !important;
  display: grid !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 20px !important;
  
  /* Desktop: 4 kolumny */
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 25px !important;
  
  /* Wyrównanie */
  width: 100% !important;
  max-width: 1400px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Reset dla elementów li - tylko na głównej stronie sklepu */
body.post-type-archive-product .woocommerce ul.products li.product,
body.post-type-archive-product .woocommerce ul.products li.product-category,
body.post-type-archive-product ul.products li.product,
body.post-type-archive-product ul.products li.product-category {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  clear: none !important;
}

/* =====================================================
   KAFELEK KATEGORII - Wygląd
   Tylko strona główna sklepu
   ===================================================== */

body.post-type-archive-product .woocommerce ul.products li.product-category,
body.post-type-archive-product ul.products li.product-category {
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 35, 71, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
  position: relative;
}

/* Hover - uniesienie kafelka */
body.post-type-archive-product .woocommerce ul.products li.product-category:hover,
body.post-type-archive-product ul.products li.product-category:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 35, 71, 0.15);
}

/* Link wewnątrz kafelka - cały obszar klikalny */
body.post-type-archive-product .woocommerce ul.products li.product-category a,
body.post-type-archive-product ul.products li.product-category a {
  display: block;
  text-decoration: none !important;
  color: inherit;
  overflow: hidden;
}

/* =====================================================
   ZDJĘCIE KATEGORII - Tylko strona główna sklepu
   ===================================================== */

body.post-type-archive-product .woocommerce ul.products li.product-category a img,
body.post-type-archive-product .woocommerce ul.products li.product-category img,
body.post-type-archive-product ul.products li.product-category a img,
body.post-type-archive-product ul.products li.product-category img {
  width: 100% !important;
  height: 200px !important;
  object-fit: contain !important;
  object-position: center center;
  margin: 0 !important;
  padding: 15px !important;
  display: block !important;
  border-radius: 0 !important;
  transition: transform 0.4s ease;
  background-color: #ffffff;
  box-sizing: border-box !important;
}

/* Hover na zdjęciu - delikatne powiększenie */
body.post-type-archive-product .woocommerce ul.products li.product-category:hover img,
body.post-type-archive-product ul.products li.product-category:hover img {
  transform: scale(1.05);
}

/* =====================================================
   TYTUŁ KATEGORII - Tylko strona główna sklepu
   ===================================================== */

body.post-type-archive-product .woocommerce ul.products li.product-category h2,
body.post-type-archive-product .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title,
body.post-type-archive-product .woocommerce ul.products li.product-category .woocommerce-loop-category__title,
body.post-type-archive-product ul.products li.product-category h2,
body.post-type-archive-product ul.products li.product-category .woocommerce-loop-category__title {
  padding: 16px 12px !important;
  margin: 0 !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  color: #002347 !important;
  background-color: #ffffff;
  line-height: 1.3 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  border-top: 1px solid #f0f0f0;
}

/* Ukrycie licznika produktów (backup CSS jeśli PHP nie zadziała) */
body.post-type-archive-product .woocommerce ul.products li.product-category h2 .count,
body.post-type-archive-product .woocommerce ul.products li.product-category .woocommerce-loop-category__title .count,
body.post-type-archive-product .woocommerce ul.products li.product-category mark.count,
body.post-type-archive-product ul.products li.product-category h2 .count,
body.post-type-archive-product ul.products li.product-category mark.count {
  display: none !important;
}

/* =====================================================
   RESPONSYWNOŚĆ - TABLET (3 kolumny)
   Tylko strona główna sklepu
   ===================================================== */

@media screen and (max-width: 1024px) {
  body.post-type-archive-product .woocommerce ul.products,
  body.post-type-archive-product ul.products {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    padding: 15px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category a img,
  body.post-type-archive-product .woocommerce ul.products li.product-category img,
  body.post-type-archive-product ul.products li.product-category img {
    height: 170px !important;
    padding: 12px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category h2,
  body.post-type-archive-product .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title,
  body.post-type-archive-product ul.products li.product-category h2 {
    font-size: 0.95rem !important;
    padding: 14px 10px !important;
  }
}

/* =====================================================
   RESPONSYWNOŚĆ - MOBILE (2 kolumny) - KLUCZOWE!
   Tylko strona główna sklepu
   ===================================================== */

@media screen and (max-width: 768px) {
  body.post-type-archive-product .woocommerce ul.products,
  body.post-type-archive-product ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 12px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category,
  body.post-type-archive-product ul.products li.product-category {
    border-radius: 12px;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category a img,
  body.post-type-archive-product .woocommerce ul.products li.product-category img,
  body.post-type-archive-product ul.products li.product-category img {
    height: 130px !important;
    padding: 10px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category h2,
  body.post-type-archive-product .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title,
  body.post-type-archive-product ul.products li.product-category h2 {
    font-size: 0.85rem !important;
    padding: 10px 8px !important;
    line-height: 1.25 !important;
  }
  
  /* Mniejszy efekt hover na mobile */
  body.post-type-archive-product .woocommerce ul.products li.product-category:hover,
  body.post-type-archive-product ul.products li.product-category:hover {
    transform: translateY(-4px);
  }
}

/* =====================================================
   RESPONSYWNOŚĆ - MAŁY MOBILE (nadal 2 kolumny)
   Tylko strona główna sklepu
   ===================================================== */

@media screen and (max-width: 480px) {
  body.post-type-archive-product .woocommerce ul.products,
  body.post-type-archive-product ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category a img,
  body.post-type-archive-product .woocommerce ul.products li.product-category img,
  body.post-type-archive-product ul.products li.product-category img {
    height: 110px !important;
    padding: 8px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category h2,
  body.post-type-archive-product .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title,
  body.post-type-archive-product ul.products li.product-category h2 {
    font-size: 0.8rem !important;
    padding: 8px 6px !important;
  }
  
  body.post-type-archive-product .woocommerce ul.products li.product-category,
  body.post-type-archive-product ul.products li.product-category {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 35, 71, 0.06);
  }
}

/* =====================================================
   NAGŁÓWEK STRONY "SKLEP" - Tylko główna strona
   ===================================================== */

body.post-type-archive-product .page-title,
body.post-type-archive-product .woocommerce-products-header__title.page-title {
  text-align: center !important;
  font-size: 2.2rem !important;
  font-weight: 700 !important;
  color: #002347 !important;
  margin-bottom: 30px !important;
  padding-top: 20px !important;
}

@media screen and (max-width: 768px) {
  body.post-type-archive-product .page-title,
  body.post-type-archive-product .woocommerce-products-header__title.page-title {
    font-size: 1.6rem !important;
    margin-bottom: 15px !important;
  }
}

/* =====================================================
   UKRYCIE ELEMENTÓW DOMYŚLNYCH WOOCOMMERCE
   Tylko strona główna sklepu
   ===================================================== */

/* Ukryj sortowanie i licznik wyników na stronie głównej sklepu */
body.post-type-archive-product .woocommerce-result-count,
body.post-type-archive-product .woocommerce-ordering {
  /* display: none !important; */
  /* Odkomentuj jeśli chcesz ukryć */
}

/* =====================================================
   BREADCRUMBS - Ulepszenie (globalnie dla WooCommerce)
   ===================================================== */

.woocommerce .woocommerce-breadcrumb {
  padding: 15px 20px !important;
  margin-bottom: 0 !important;
  font-size: 0.9rem !important;
  color: #666 !important;
}

.woocommerce .woocommerce-breadcrumb a {
  color: #002347 !important;
  text-decoration: none !important;
}

.woocommerce .woocommerce-breadcrumb a:hover {
  text-decoration: underline !important;
}

/* =====================================================
   ANIMACJA WEJŚCIA KAFELKÓW - Tylko strona główna sklepu
   ===================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.post-type-archive-product .woocommerce ul.products li.product-category,
body.post-type-archive-product ul.products li.product-category {
  animation: fadeInUp 0.5s ease forwards;
}

/* Opóźnienia dla kolejnych kafelków */
body.post-type-archive-product ul.products li.product-category:nth-child(1) { animation-delay: 0.05s; }
body.post-type-archive-product ul.products li.product-category:nth-child(2) { animation-delay: 0.1s; }
body.post-type-archive-product ul.products li.product-category:nth-child(3) { animation-delay: 0.15s; }
body.post-type-archive-product ul.products li.product-category:nth-child(4) { animation-delay: 0.2s; }
body.post-type-archive-product ul.products li.product-category:nth-child(5) { animation-delay: 0.25s; }
body.post-type-archive-product ul.products li.product-category:nth-child(6) { animation-delay: 0.3s; }
body.post-type-archive-product ul.products li.product-category:nth-child(7) { animation-delay: 0.35s; }
body.post-type-archive-product ul.products li.product-category:nth-child(8) { animation-delay: 0.4s; }
body.post-type-archive-product ul.products li.product-category:nth-child(9) { animation-delay: 0.45s; }
body.post-type-archive-product ul.products li.product-category:nth-child(10) { animation-delay: 0.5s; }
body.post-type-archive-product ul.products li.product-category:nth-child(11) { animation-delay: 0.55s; }
body.post-type-archive-product ul.products li.product-category:nth-child(12) { animation-delay: 0.6s; }

/* Zmniejsz preferencje ruchu dla użytkowników wrażliwych */
@media (prefers-reduced-motion: reduce) {
  body.post-type-archive-product .woocommerce ul.products li.product-category,
  body.post-type-archive-product ul.products li.product-category {
    animation: none;
  }
}
