/* ==============================================================================
 * BENTO HOME STYLES - ZŁOTY STANDARD
 * ==============================================================================
 * Plik: bento-home.css
 * Opis: Style specyficzne dla strony głównej (Bento Grid, Slider, Banery).
 * SPIS TREŚCI:
 * 1. BENTO GRID HOMEPAGE - DARK TECH THEME
 * ============================================================================== */

/*    16. BENTO GRID HOMEPAGE - DARK TECH THEME */
/* ============================================================ */

.btx-category-stacks {
  display: flex;
  flex-direction: column;
  gap: var(--btx-gap-md); /* Ujednolicony odstęp z kafelkami polecanych i kontaktem */
  margin-bottom: 64px;
  min-width: 0; /* Blokada przed flexbox blowout z góry */
  max-width: 100%;
}

.btx-category-card {
  display: flex;
  align-items: stretch;
  border-radius: var(--btx-radius-2xl) !important;
  position: relative;
  z-index: 1;
}

/* Klon cieniujący pod spodem (sugestia użytkownika) */
.btx-category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  box-shadow: var(--btx-shadow-md) !important; /* Użycie wariantu MD dla skompensowania dużej masy ciemnego kafelka */
  z-index: -1;
  pointer-events: none;
}

/* Kolory, Patterny i Szum (Grain) Wariantu 4 */
.btx-category-card {
  --btx-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* Usługi - Zgaszony Niebieski Morski (Zwiększone nasycenie) */
.bg-cat-uslugi {
  background-color: #388594;
  background-image: 
    var(--btx-noise),
    linear-gradient(rgba(255, 255, 255, 0.12) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1.5px, transparent 1.5px);
  background-size: 150px 150px, 20px 20px, 20px 20px;
}

/* Produkty - Zgaszony czerwony (Zwiększone nasycenie, Malina) */
.bg-cat-produkty {
  background-color: #C05C5C;
  background-image: 
    var(--btx-noise),
    radial-gradient(rgba(255, 255, 255, 0.15) 1.5px, transparent 1.5px);
  background-size: 150px 150px, 24px 24px;
  background-position: 0 0, 0 0;
}

/* Grawerowanie - Zgaszony fiolet (Zwiększone nasycenie, Wrzos) */
.bg-cat-grawer {
  background-color: #805AA8;
  background-image: 
    var(--btx-noise),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.12) 0,
      rgba(255, 255, 255, 0.12) 1.5px,
      transparent 1.5px,
      transparent 16px
    );
  background-size: 150px 150px, auto;
}

/* Biuro i Szkoła - Zgaszony pomarańcz (Zwiększone nasycenie, Karmel) */
.bg-cat-biuro {
  background-color: #C48D41;
  background-image: 
    var(--btx-noise),
    linear-gradient(rgba(255, 255, 255, 0.12) 1.5px, transparent 1.5px);
  background-size: 150px 150px, 100% 24px;
}

.btx-category-header {
  flex: 0 0 180px;
  display: flex;
  align-items: center;
  padding: 24px;
  color: #ffffff !important;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent; /* Zdejmuje szary flash przy kliknięciu na telefonie */
}

.btx-category-header:hover,
.btx-category-header:active,
.btx-category-header:focus {
  color: #ffffff !important; /* Blokuje wyciek niebieskiego koloru z defaultowych linków Presty */
}

.btx-category-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.btx-category-items {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 16px 16px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.btx-category-items::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.btx-category-tile {
  flex: 1 0 90px; /* Na desktopie wracamy do płynnego wypełniania rzędu do prawej */
  height: 90px;
  background: rgba(255, 255, 255, 0.12); /* Bardziej przezroczyste szkło */
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.2); /* Jasny szklany border - będzie od razu świetnie widoczny na ciemnym tle */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: var(--btx-radius-lg, 16px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8px;
  gap: 6px;
  color: #ffffff !important; /* Zabezpieczenie koloru */
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent; /* Zdejmuje szary flash przy kliknięciu na telefonie */
  user-select: none; /* Zapobiega zaznaczaniu tekstu przy przewijaniu */
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Żelazne wymuszenie białego tekstu, żeby po dotknięciu (focus/active) nie wracał stary niebieski link Presty */
.btx-category-tile:hover,
.btx-category-tile:focus,
.btx-category-tile:active {
  color: #ffffff !important;
}

/* Efekt najechania myszką (wyłącznie na urządzeniach, które mają kursory) */
@media (hover: hover) {
  .btx-category-tile:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
  }
}

/* Fizyczny feedback dotknięcia / kliknięcia (działa wyśmienicie na ekranach dotykowych) */
.btx-category-tile:active {
  background: rgba(255, 255, 255, 0.3); /* Szkło staje się lekko bielsze przy wduszeniu */
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Cień maleje dając wrażenie wklęśnięcia */
  transform: scale(0.96); /* Efekt wciśnięcia guzika */
  transition: transform 0.1s ease, background 0.1s ease; /* Ultra-szybka reakcja na palec! */
}

.btx-category-tile img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: none;
}

.btx-category-tile span {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

/* Wrapper ułatwiający pozycjonowanie na siatce (już bez overflow, by nie ucinał cieni) */
.btx-category-scroll-wrapper {
  width: 100%;
  max-width: 100%; 
  min-width: 0; 
}

/* Responsywność dla ekranów mobilnych */
@media (max-width: 768px) {
  /* KLASYCZNY UKŁAD (Mobile) - Statyczna Karta, Scrollujący Nagłówek i Kwadratowe Kafelki */
  .btx-category-scroll-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    overflow: visible;
  }
  
  .btx-category-scroll-wrapper::before,
  .btx-category-scroll-wrapper::after {
    display: none;
  }

  .btx-category-card {
    display: flex !important;
    flex-direction: row; 
    align-items: stretch;
    width: auto;
    margin: 0 16px !important;
    overflow-x: auto; /* SCROLL CAŁEJ ZAWARTOŚCI KARTY */
    overflow-y: hidden; /* WYŁĄCZENIE SCROLLA PIONOWEGO */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .btx-category-card::-webkit-scrollbar {
    display: none;
  }
  
  .btx-category-header {
    flex: 0 0 110px; /* Zwężone, by dosunąć kafelki i wymusić ucięcie na krawędzi ekranu jako scroll-cue */
    padding: 16px 8px 16px 16px; /* Zmniejszony prawy odstęp, by zbliżyć wizualnie tekst do kafelków */
    flex-shrink: 0; /* Nie pozwalamy mu się kurczyć w przewijanym oknie */
  }
  
  .btx-category-items {
    width: max-content;
    flex: 0 0 auto;
    padding: 16px 0; /* Góra dół. Z prawej strony używamy pancernego popychacza Safari */
    display: flex;
    gap: 12px;
    overflow: visible; /* Scroll zdjęty z items, przeniesiony na kartę */
  }
  
  /* Zabezpieczenie prawego marginesu w Safari dla scrollujących się elementów flex */
  .btx-category-items::after {
    content: '';
    flex: 0 0 16px;
  }

  .btx-category-tile {
    flex: 0 0 100px; /* Kwadraty 100x100 */
    height: 100px;
  }
}

/* ============================================================ */

/* ============================================================
   17. POLECANE PRODUKTY (FEATURED PRODUCTS)
   ============================================================ */

.btx-featured-products {
  margin: 64px auto 32px auto; /* Zmniejszony dolny margines (rekompensata za padding-bottom) */
  width: 100%;
  max-width: 100%; /* Ujednolicenie z bannerami powyrzej (brak sztywnego limitu 1320px) */
  padding: 16px 16px 32px 16px !important; /* Przywrócono marginesy boczne, aby nie wchodziło na krawędzie ekranu mobile */
  overflow: visible !important;
}

.btx-products-grid {
  display: grid !important;
  gap: 12px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  margin: 0 !important; /* Neutralizuje negative margins z class="row" */
  padding: 0 !important;
}

@media (min-width: 480px) {
  .btx-products-grid {
    gap: var(--btx-gap-md) !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Wymuszamy, by dzieci grid'a ignorowały klasyczne klasy col-xs-12 PrestaShopa */
.btx-products-grid > div,
.btx-products-grid > .product {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important; /* Dodatkowe wymuszenie kurczenia się! */
  margin: 0 !important;
  height: 100% !important; /* ROZWIĄZANIE PROBLEMU "POPRZESUWANE" - rozciąga kontener do pełnej wysokości grida */
}

@media (min-width: 768px) {
  .btx-products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 992px) {
  .btx-products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1200px) {
  .btx-products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Wymuszenie stylów dla kart produktów na stronie głównej */
body#index .btx-product-card,
body#product .btx-accessories-section .btx-product-card {
  background: var(--btx-bg-tile) !important;
  border-radius: var(--btx-radius-2xl) !important;
  border: var(--btx-border-width) solid var(--btx-border-color) !important;
  box-shadow: var(--btx-shadow-tile) !important; /* UNIFIKACJA CIENI ZGODNIE Z POLECENIEM */
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
  position: relative !important;
  transition: transform var(--btx-transition-md), box-shadow var(--btx-transition-md) !important;
}

@media (hover: hover) {
  body#index .btx-product-card:hover,
  body#product .btx-accessories-section .btx-product-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--btx-shadow-tile-hover) !important;
  }
  
  body#index .btx-product-card:hover .btx-card-action-btn,
  body#product .btx-accessories-section .btx-product-card:hover .btx-card-action-btn {
    background: var(--btx-color-primary) !important;
    color: #ffffff !important;
    transform: scale(1.08) !important;
  }
}

/* ============================================================
   KARTY PRODUKTÓW NA STRONIE GŁÓWNEJ (BENTO STYLE)
   Zabijamy domyślne style PrestaShop i wymuszamy czysty układ
   ============================================================ */

body#index .btx-thumbnail-wrapper,
body#product .btx-accessories-section .btx-thumbnail-wrapper {
  background: transparent !important;
  margin: 0 !important;
  border-radius: var(--btx-radius-2xl) var(--btx-radius-2xl) 0 0 !important;
  border: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  aspect-ratio: 1 / 1 !important;
  display: block !important;
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

body#index .btx-thumbnail-wrapper .thumbnail,
body#product .btx-accessories-section .btx-thumbnail-wrapper .thumbnail {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  padding: 24px !important; /* Padding wewnętrzny zamiast odsuwania absolutnego, dzięki temu cały obszar zdjęcia jest klikalnym linkiem */
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
}

body#index .btx-thumbnail-wrapper img,
body#product .btx-accessories-section .btx-thumbnail-wrapper img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  margin: auto !important;
}

body#index .btx-product-description,
body#product .btx-accessories-section .btx-product-description {
  padding: 20px 24px 24px 24px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  flex-grow: 1 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  gap: 12px !important;
}

body#index .product-title,
body#product .btx-accessories-section .product-title {
  margin: 0 !important;
  width: 100% !important;
  text-align: left !important;
  order: 1 !important;
}

body#index .product-title a,
body#product .btx-accessories-section .product-title a {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--btx-text-primary) !important;
  text-decoration: none !important;
  text-align: left !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.4 !important;
}

/* Sekcja Ceny */
body#index .product-price-and-shipping,
body#product .btx-accessories-section .product-price-and-shipping {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: auto !important; /* Trzyma cenę zawsze na samym dole kafelka */
  padding: 12px 0 0 0 !important; /* WIĘKSZY MARGINES nad ceną */
  border: none !important;
  background: transparent !important;
  order: 3 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body#index .btx-price-group,
body#product .btx-accessories-section .btx-price-group {
  display: flex !important;
  flex-direction: row !important; /* Stara i nowa cena w jednym rzędzie */
  align-items: baseline !important; /* Wyrównanie do linii tekstu */
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
}

body#index .price,
body#product .btx-accessories-section .price {
  font-size: 18px !important;
  font-weight: 900 !important;
  color: var(--btx-text-primary) !important; /* Standardowo kolor tekstu */
  line-height: 1 !important;
  display: inline-block !important;
  visibility: visible !important;
}

/* Jeśli w grupie jest przekreślona stara cena, zrób nową na pomarańczowo (Wyprzedaż) */
body#index .btx-price-group:has(.regular-price) .price,
body#product .btx-accessories-section .btx-price-group:has(.regular-price) .price {
  color: var(--btx-color-warning, #f59e0b) !important;
}

body#index .regular-price,
body#product .btx-accessories-section .regular-price {
  font-size: 13px !important;
  color: var(--btx-text-tertiary) !important;
  text-decoration: line-through !important;
  font-weight: 500 !important;
  margin: 0 !important;
  display: inline-block !important;
}

body#index .btx-card-action-btn,
body#product .btx-accessories-section .btx-card-action-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  background: var(--btx-bg-input) !important;
  border-radius: 50% !important;
  color: var(--btx-text-secondary) !important;
  transition: all var(--btx-transition-fast) !important;
  position: relative !important;
  z-index: 2 !important;
  flex-shrink: 0 !important;
}

body#index .btx-price-group .invisible,
body#index .btx-price-group meta,
body#product .btx-accessories-section .btx-price-group .invisible,
body#product .btx-accessories-section .btx-price-group meta {
  display: none !important;
}

/* ============================================================
   RESPONSYWNOŚĆ KART PRODUKTÓW NA MOBILE
   ============================================================ */
@media (max-width: 768px) {
  /* Zmniejszenie obszaru i rozmiaru samego zdjęcia na Głównej */
  body#index .btx-thumbnail-wrapper,
  body#product .btx-accessories-section .btx-thumbnail-wrapper {
    aspect-ratio: 4 / 3 !important;
    min-height: auto !important;
  }

  body#index .btx-product-description,
  body#product .btx-accessories-section .btx-product-description {
    padding: 12px 16px 16px 16px !important;
    gap: 8px !important;
  }

  body#index .product-title a,
  body#product .btx-accessories-section .product-title a {
    font-size: 13px !important;
    line-height: 1.3 !important;
    -webkit-line-clamp: 2 !important;
  }

  body#index .product-price-and-shipping,
  body#product .btx-accessories-section .product-price-and-shipping {
    padding-top: 8px !important;
  }

  body#index .price {
    font-size: 15px !important;
  }

  body#index .regular-price {
    font-size: 11px !important;
  }
}

/* ---------------------------------------------------
   STYLANIE TREŚCI CMS (O NAS) NA STRONIE KONTAKTU
   Przekształca zwykłą listę <ul> z TinyMCE w Bento Grid
--------------------------------------------------- */
.btx-cms-content ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--btx-gap-md);
  padding: 0;
  margin: 0;
  list-style: none;
}

.btx-cms-content li {
  background: var(--btx-bg-tile);
  border: var(--btx-border-width) solid var(--btx-border-color);
  border-radius: var(--btx-radius-2xl);
  padding: 24px;
  box-shadow: var(--btx-shadow-tile);
  font-size: var(--btx-text-base);
  color: var(--btx-text-secondary);
  line-height: 1.6;
}

.btx-cms-content li strong {
  display: block;
  font-size: var(--btx-text-lg);
  color: var(--btx-text-primary);
  margin-bottom: 8px;
  font-weight: 800;
}

.btx-cms-content p {
  font-size: 16px;
  opacity: 0.9;
}

.btx-featured-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--btx-text-primary) !important;
}
