/*
 * WG Roztocze — finalny kontrakt wspólnych komponentów.
 * Ten plik jest ładowany jako ostatni i zastępuje rozproszone poprawki legacy.
 */

/* Nagłówki sekcji na stronie głównej: tytuł po lewej, akcja po prawej. */
html body#index .wg-home .pxb-section--category_tiles .pxb-section__head,
html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto !important;
  column-gap: 24px !important;
  row-gap: 12px !important;
  align-items: end !important;
  text-align: left !important;
}

/* Produkt mobilny: wspólny kontekstowy header i funkcjonalny dock zakupu. */
@media (max-width: 575px) {
  html body#product #header > .wg-header,
  html body#product #header > .wg-nav {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
  }
  html body#product .wg-topbar,
  html body#product .wg-topbar__inner { height: 29px !important; min-height: 29px !important; }
  html body#product .wg-topbar__inner {
    display: flex !important;
    padding: 0 16px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  html body#product .wg-topbar__left {
    display: block !important;
    overflow: hidden !important;
    font-size: 11px !important;
    line-height: 29px !important;
    white-space: nowrap !important;
  }
  html body#product .wg-topbar__left > :not(:first-child),
  html body#product .wg-topbar__right { display: none !important; }
  html body#product .wg-category-contextbar {
    display: grid !important;
    width: 100% !important;
    height: 64px !important;
    padding: 0 16px !important;
    grid-template-columns: 40px minmax(0, 1fr) 40px !important;
    align-items: center !important;
    border-bottom: 1px solid #DCE5F2 !important;
    background: #fff !important;
    color: #13213D !important;
  }
  html body#product .wg-category-contextbar__back,
  html body#product .wg-category-contextbar__cart {
    position: relative !important;
    display: grid !important;
    width: 40px !important;
    height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    color: #13213D !important;
    text-decoration: none !important;
  }
  html body#product .wg-category-contextbar__back { justify-self: start !important; }
  html body#product .wg-category-contextbar__cart { justify-self: end !important; }
  html body#product .wg-category-contextbar__back .material-icons,
  html body#product .wg-category-contextbar__cart .material-icons { font-size: 21px !important; }
  html body#product .wg-category-contextbar__cart span {
    position: absolute !important;
    top: 4px !important;
    right: 0 !important;
    display: grid !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    place-items: center !important;
    border-radius: 8px !important;
    background: #2A6BD1 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
  }
  html body#product .wg-sticky-atc {
    position: fixed !important;
    z-index: 10040 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: grid !important;
    width: 100% !important;
    height: 81px !important;
    padding: 12px 16px 16px !important;
    grid-template-columns: 116px minmax(0, 1fr) !important;
    gap: 10px !important;
    border-top: 1px solid #DCE5F2 !important;
    background: #fff !important;
    box-shadow: 0 -8px 24px rgba(19, 33, 61, .10) !important;
    transform: translateY(110%) !important;
    transition: transform .18s ease !important;
  }
  html body#product .wg-sticky-atc.is-visible { transform: translateY(0) !important; }
  html body#product .wg-sticky-atc__qty {
    display: grid !important;
    height: 52px !important;
    grid-template-columns: 38px 40px 38px !important;
    align-items: center !important;
    overflow: hidden !important;
    border: 1px solid #DCE5F2 !important;
    border-radius: 10px !important;
    background: #fff !important;
  }
  html body#product .wg-sticky-atc__qty button,
  html body#product .wg-sticky-atc__qty strong {
    display: grid !important;
    height: 50px !important;
    margin: 0 !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    background: transparent !important;
    color: #13213D !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }
  html body#product .wg-sticky-atc__btn {
    display: flex !important;
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: #2A6BD1 !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-transform: none !important;
  }
  html body#product .wg-sticky-atc__btn .material-icons { font-size: 20px !important; }
  html body#product .wg-sticky-atc__btn strong { font: inherit !important; }
}

html body#index .wg-home .pxb-section--category_tiles .pxb-section__eyebrow,
html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__eyebrow {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
}

html body#index .wg-home .pxb-section--category_tiles .pxb-section__title,
html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__title {
  grid-column: 1 !important;
  grid-row: 2 !important;
  min-width: 0 !important;
}

html body#index .wg-home .pxb-section--category_tiles .pxb-section__cta,
html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__cta {
  grid-column: 2 !important;
  grid-row: 2 !important;
  margin: 0 0 2px auto !important;
  white-space: nowrap !important;
}

@media (max-width: 767px) {
  html body#index .wg-home .pxb-section--category_tiles .pxb-section__head,
  html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__head {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html body#index .wg-home .pxb-section--category_tiles .pxb-section__cta,
  html body#index .wg-home .pxb-section--story:has(.pxb-calendar__tabs) .pxb-section__cta {
    grid-column: 1 !important;
    grid-row: 3 !important;
    margin-left: 0 !important;
  }
}

/*
 * Listing kategorii. Projekt używa jednego płótna #FFFFFF pod sidebar,
 * filtry, siatkę, paginację i opis SEO. Białe pozostają wyłącznie karty.
 */
html body#category #wrapper > .container,
html body#category #wrapper > .container > .row,
html body#category #left-column,
html body#category #content-wrapper,
html body#category #content-wrapper > #main,
html body#category #products,
html body#category #js-product-list,
html body#category #js-product-list-bottom,
html body#category #js-product-list-footer {
  background: #FFFFFF !important;
}

html body#category #wrapper {
  background: #FFFFFF !important;
}

/* Quick view jest akcją kontekstową: niewidoczny w spoczynku, dostępny
 * po hoverze oraz z klawiatury na każdej globalnej karcie katalogowej. */
@media (min-width: 992px) {
  html body:is(#category, #search, #prices-drop, #new-products, #best-sales, #manufacturer, #supplier)
  #products:not(.wg-view-list) .product-miniature .thumbnail-top {
    position: relative !important;
  }

  html body:is(#category, #search, #prices-drop, #new-products, #best-sales, #manufacturer, #supplier)
  #products:not(.wg-view-list) .product-miniature .thumbnail-top .highlighted-informations {
    position: absolute !important;
    z-index: 4 !important;
    right: 12px !important;
    bottom: 12px !important;
    left: 12px !important;
    display: block !important;
    width: auto !important;
    height: 42px !important;
    padding: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(6px) !important;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease !important;
  }

  html body:is(#category, #search, #prices-drop, #new-products, #best-sales, #manufacturer, #supplier)
  #products:not(.wg-view-list) .product-miniature:hover .highlighted-informations,
  html body:is(#category, #search, #prices-drop, #new-products, #best-sales, #manufacturer, #supplier)
  #products:not(.wg-view-list) .product-miniature:focus-within .highlighted-informations {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  html body:is(#category, #search, #prices-drop, #new-products, #best-sales, #manufacturer, #supplier)
  #products:not(.wg-view-list) .product-miniature .highlighted-informations .quick-view {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: 100% !important;
    height: 42px !important;
    margin: 0 !important;
    border: 1px solid #D6E4F7 !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,.96) !important;
    color: #1D52A8 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: 0 8px 20px rgba(14,42,90,.12) !important;
  }
}

html body .quickview.modal .add-to-cart {
  text-transform: none !important;
}

html body .quickview.modal .add-to-cart .wg-atc-price {
  display: none !important;
}

/* Płótno karty produktu jest wspólne dla produktu zwykłego, zestawu i OOS. */
html body#product #wrapper,
html body#product #wrapper > .container,
html body#product #wrapper > .container > .row,
html body#product #content-wrapper,
html body#product #content-wrapper > #main {
  background-color: #FFFFFF !important;
}

/* Wzorce zestawu i produktu niedostępnego kończą się na rekomendacjach. */
html body#product.product-id-35 #wg-reviews,
html body#product.product-id-36 #wg-reviews {
  display: none !important;
}

/* Mobilna kategoria ma własny, zwarty nagłówek kontekstowy z projektu. */
.wg-category-contextbar {
  display: none;
}

@media (max-width: 575px) {
  html body#category #header > .wg-header,
  html body#category #header > .wg-nav {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
  }

  html body#category .wg-topbar,
  html body#category .wg-topbar__inner {
    height: 29px !important;
    min-height: 29px !important;
  }

  html body#category .wg-topbar__inner {
    display: flex !important;
    padding: 0 16px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  html body#category .wg-topbar__left {
    display: block !important;
    overflow: hidden !important;
    font-size: 11px !important;
    line-height: 29px !important;
    white-space: nowrap !important;
  }

  html body#category .wg-topbar__left > :not(:first-child),
  html body#category .wg-topbar__right {
    display: none !important;
  }

  html body#category .wg-category-contextbar {
    display: grid !important;
    width: 100% !important;
    height: 64px !important;
    padding: 0 16px !important;
    grid-template-columns: 40px minmax(0, 1fr) 40px !important;
    align-items: center !important;
    border-bottom: 1px solid #DCE5F2 !important;
    background: #fff !important;
    color: #13213D !important;
  }

  html body#category .wg-category-contextbar__back,
  html body#category .wg-category-contextbar__cart {
    position: relative !important;
    display: grid !important;
    width: 40px !important;
    height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    color: #13213D !important;
    text-decoration: none !important;
  }

  html body#category .wg-category-contextbar__back {
    justify-self: start !important;
  }

  html body#category .wg-category-contextbar__cart {
    justify-self: end !important;
  }

  html body#category .wg-category-contextbar__back .material-icons,
  html body#category .wg-category-contextbar__cart .material-icons {
    font-size: 21px !important;
  }

  html body#category .wg-category-contextbar__title {
    overflow: hidden !important;
    font-size: 16px !important;
    line-height: 20px !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body#category .wg-category-contextbar__cart span {
    position: absolute !important;
    top: 4px !important;
    right: 0 !important;
    display: grid !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    place-items: center !important;
    border-radius: 8px !important;
    background: #2A6BD1 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  /* Na mobile płótno listingu jest białe; nie dziedziczy desktopowego panelu. */
  html body#category,
  html body#category #wrapper,
  html body#category #wrapper > .container,
  html body#category #wrapper > .container > .row,
  html body#category #left-column,
  html body#category #content-wrapper,
  html body#category #content-wrapper > #main,
  html body#category #products,
  html body#category #js-product-list,
  html body#category #js-product-list-bottom,
  html body#category #js-product-list-footer {
    background: #fff !important;
  }

  html body#category .wg-mobile-category-tools {
    padding: 14px 16px 0 !important;
    background: #fff !important;
  }

  html body#category .wg-mobile-category-toolbar {
    margin-top: 12px !important;
  }

  html body#category #js-product-list {
    margin-top: 12px !important;
    padding: 0 16px !important;
  }

  html body#category #js-product-list .products,
  html body#category #js-product-list .products.wg-products-grid {
    gap: 10px !important;
    background: #fff !important;
  }

  html body#category nav.pagination {
    display: none !important;
  }

  html body#category .wg-mobile-show-more {
    display: flex !important;
    width: calc(100% - 32px) !important;
    height: 49px !important;
    margin: 12px 16px 0 !important;
    padding: 0 16px !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #DCE5F2 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #111827 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  html body#category.wg-mobile-products-expanded .wg-mobile-show-more,
  html body#category .wg-mobile-show-more[hidden] {
    display: none !important;
  }

  /* Drawer filtrów: tylko fasety, bez desktopowego drzewa kategorii. */
  html body#category.wg-filters-open {
    overflow: hidden !important;
  }

  html body#category.wg-filters-open .wg-filters-overlay {
    position: fixed !important;
    z-index: 2080 !important;
    inset: 0 !important;
    display: block !important;
    background: rgba(14, 42, 90, .48) !important;
  }

  html body#category.wg-filters-open main #wrapper #left-column {
    position: fixed !important;
    z-index: 2100 !important;
    inset: 60px 0 0 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: 390px !important;
    height: calc(100dvh - 60px) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  html body#category.wg-filters-open #left-column > :not(#search_filters_wrapper),
  html body#category.wg-filters-open #left-column > .wg-filters-close,
  html body#category.wg-filters-open #left-column > .block-categories,
  html body#category.wg-filters-open #left-column > .wg-category-tree {
    display: none !important;
  }

  html body#category.wg-filters-open #search_filters_wrapper {
    position: relative !important;
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 0 86px !important;
    flex-direction: column !important;
    border: 0 !important;
    background: #fff !important;
  }

  html body#category.wg-filters-open .wg-native-filter-head {
    display: flex !important;
    width: 100% !important;
    height: 76px !important;
    min-height: 76px !important;
    padding: 0 20px !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid #DCE5F2 !important;
    background: #fff !important;
  }

  html body#category.wg-filters-open .wg-native-filter-head strong {
    color: #13213D !important;
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  html body#category.wg-filters-open .wg-native-filter-head button {
    display: grid !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: #F5F8FE !important;
    color: #13213D !important;
    font-size: 28px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
  }

  html body#category.wg-filters-open #search_filters {
    display: flex !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    background: #fff !important;
  }

  html body#category.wg-filters-open #search_filters > .wg-filters-head,
  html body#category.wg-filters-open #search_filters > .wg-filtruj-head {
    display: none !important;
  }

  html body#category.wg-filters-open #search_filters > .facet {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 17px 20px !important;
    border: 0 !important;
    border-bottom: 1px solid #DCE5F2 !important;
    background: #fff !important;
  }

  html body#category.wg-filters-open #search_filters > .facet[data-type='manufacturer'] { order: 1 !important; }
  html body#category.wg-filters-open #search_filters > .facet[data-type='attribute_group'] { order: 2 !important; }
  html body#category.wg-filters-open #search_filters > .facet[data-name='Zastosowanie'] { order: 3 !important; }
  html body#category.wg-filters-open #search_filters > .facet[data-type='price'] { order: 4 !important; }
  html body#category.wg-filters-open #search_filters > .facet[data-type='availability'] { order: 5 !important; }
  html body#category.wg-filters-open #search_filters > .facet[data-name='Forma'] { order: 6 !important; }

  html body#category.wg-filters-open #search_filters .facet .title.hidden-md-up {
    display: flex !important;
    min-height: 24px !important;
    margin: 0 0 10px !important;
    align-items: center !important;
  }

  html body#category.wg-filters-open #search_filters .facet .title .facet-title {
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 20px !important;
    text-transform: none !important;
  }

  html body#category.wg-filters-open #search_filters .facet .title .collapse-icons {
    display: none !important;
  }

  html body#category.wg-filters-open #search_filters .facet > ul.collapse {
    display: block !important;
    height: auto !important;
  }

  html body#category.wg-filters-open #search_filters .facet li {
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body#category.wg-filters-open #search_filters .facet-label {
    display: flex !important;
    min-height: 32px !important;
    margin: 0 !important;
    align-items: center !important;
    gap: 8px !important;
    color: #13213D !important;
    font-size: 14px !important;
    line-height: 20px !important;
  }

  html body#category.wg-filters-open #search_filters .facet-label a {
    display: flex !important;
    flex: 1 1 auto !important;
    justify-content: space-between !important;
    color: #13213D !important;
    text-decoration: none !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] > ul {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] li {
    width: auto !important;
    min-height: 36px !important;
    flex: 0 0 auto !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] .facet-label {
    min-height: 36px !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] .custom-checkbox,
  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] .custom-radio {
    display: none !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] .facet-label a {
    min-width: 62px !important;
    height: 36px !important;
    padding: 0 12px !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #DCE5F2 !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #13213D !important;
    font-weight: 600 !important;
  }

  html body#category.wg-filters-open #search_filters .facet[data-type='attribute_group'] .facet-label a .magnitude {
    display: none !important;
  }

  html body#category.wg-filters-open .wg-native-filter-footer {
    position: absolute !important;
    z-index: 3 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: grid !important;
    height: 86px !important;
    padding: 14px 20px 23px !important;
    grid-template-columns: 109px minmax(0, 1fr) !important;
    gap: 10px !important;
    border-top: 1px solid #DCE5F2 !important;
    background: #fff !important;
  }

  html body#category.wg-filters-open .wg-native-filter-footer button {
    height: 49px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    border: 1px solid #DCE5F2 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #1D52A8 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  html body#category.wg-filters-open .wg-native-filter-footer [data-wg-filter-apply] {
    border-color: #2A6BD1 !important;
    background: #2A6BD1 !important;
    color: #fff !important;
  }
}

/* Mobile topbar: jeden globalny układ, tekst wyśrodkowany w pionie na każdej stronie. */
@media (max-width: 575px) {
  html body .wg-topbar,
  html body .wg-topbar__inner { height: 29px !important; min-height: 29px !important; }
  html body .wg-topbar__inner {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
  }
  html body .wg-topbar__left {
    display: block !important;
    width: 100% !important;
    height: 16px !important;
    line-height: 16px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    text-align: center !important;
  }
  html body .wg-topbar__left::before { display: block !important; line-height: 16px !important; }
}
