/* ELLIE PRODUCT MOBILE STABLE RESET + GALLERY FIX V77
   Autor: Modyfikator stworzony przez gumis */

/* Globalna naprawa widoczności galerii — działa na wszystkich rozm. ekranu (iPad fix) */
body#product .elementor-invisible,
body.page-product .elementor-invisible {
  visibility: visible !important;
  opacity: 1 !important;
}

body#product .product-cover img:not(.zoomImg),
body#product .js-qv-product-cover,
body.page-product .product-cover img:not(.zoomImg),
body.page-product .js-qv-product-cover {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* GALLERY CONTAINER FIX:
   CSS opacity na rodzicu ZAWSZE propaguje do dzieci — fix na obrazku nic nie da,
   jeśli rodzic (Elementor section) dostaje opacity:0 z animacji wejściowej
   (animated + animation-fill-mode:both). Fixujemy kontenery bezpośrednio. */
body#product .images-container,
body.page-product .images-container,
body#product #product-images-cont,
body.page-product #product-images-cont,
body#product .main-image-container,
body.page-product .main-image-container,
body#product .product-cover,
body.page-product .product-cover,
body#product .thumb-carousel,
body.page-product .thumb-carousel,
body#product .elementor-slick-slider,
body.page-product .elementor-slick-slider {
  opacity: 1 !important;
  visibility: visible !important;
}

@media (max-width: 1024px) {
  body#product,
  body.page-product {
    padding-bottom: 78px !important;
  }

  body#product .zoomImg,
  body.page-product .zoomImg,
  body#product .ellie-v71-lightbox,
  body.page-product .ellie-v71-lightbox,
  body#product .ellie-v72-lightbox,
  body.page-product .ellie-v72-lightbox,
  body#product .ellie-v73-main-new-badge,
  body.page-product .ellie-v73-main-new-badge,
  body#product .ellie-v74-main-new-badge,
  body.page-product .ellie-v74-main-new-badge,
  body#product .ellie-v76-main-new-badge,
  body.page-product .ellie-v76-main-new-badge,
  body#product .ellie-v71-gallery-arrow,
  body.page-product .ellie-v71-gallery-arrow,
  body#product .ellie-v72-main-arrow,
  body.page-product .ellie-v72-main-arrow {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ELEMENTOR ANIMATION FIX:
     Gdy Elementor odpala animację wejściową (usuwa elementor-invisible, dodaje animated + fadeIn),
     animation-fill-mode:both ustawia opacity:0 PRZED startem animacji. Na iOS Safari
     animacja może się nie dokończyć → element zostaje przy opacity:0.
     Fix: wyłączamy animacje Elementora na tablet/mobile na stronie produktu. */
  body#product .elementor-element.animated,
  body.page-product .elementor-element.animated {
    animation: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* iOS sticky hover fix — product.css chowa picture na :hover, co się przykleja po dotyku */
  body#product .prod-image-zoom:hover picture,
  body.page-product .prod-image-zoom:hover picture {
    visibility: visible !important;
  }

  /* pointer-events:none na .prod-image-zoom — jQuery Zoom nie dostaje eventów dotykowych,
     więc nie odpala preventDefault() i iOS sticky hover nie aktywuje się.
     Eventy przechodzą do rodzica .product-cover, gdzie obsługuje je nasz swipe handler. */
  body#product .prod-image-zoom,
  body.page-product .prod-image-zoom {
    pointer-events: none !important;
  }

  body#product .product-cover,
  body.page-product .product-cover,
  body#product .product-cover picture,
  body.page-product .product-cover picture,
  body#product .product-cover img.js-qv-product-cover,
  body.page-product .product-cover img.js-qv-product-cover {
    touch-action: pan-y !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }

  body#product .product-cover,
  body.page-product .product-cover,
  body#product #product-images-cont,
  body.page-product #product-images-cont,
  body#product .main-image-container,
  body.page-product .main-image-container {
    overflow: visible !important;
  }

  /* Jedyny widoczny komplet strzałek: natywny/V56, bez duplikatów V71-V76 */
  body#product .product-cover .ellie-v56-gallery-arrow,
  body.page-product .product-cover .ellie-v56-gallery-arrow,
  body#product .product-cover .ellie-gallery-arrow:not(.ellie-v77-hidden-arrow),
  body.page-product .product-cover .ellie-gallery-arrow:not(.ellie-v77-hidden-arrow) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 95 !important;
  }

  body#product .product-cover .ellie-v77-hidden-arrow,
  body.page-product .product-cover .ellie-v77-hidden-arrow,
  body#product .product-cover .ellie-v74-hidden-duplicate-arrow,
  body.page-product .product-cover .ellie-v74-hidden-duplicate-arrow {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Główna flaga nad zdjęciem, w obrysie kolumny, nie poza górą. */
  body#product .main-image-container > .product-flags,
  body.page-product .main-image-container > .product-flags,
  body#product #product-images-cont > .product-flags,
  body.page-product #product-images-cont > .product-flags,
  body#product .ellie-v77-main-flags,
  body.page-product .ellie-v77-main-flags {
    position: static !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    justify-content: flex-start !important;
    align-items: center !important;
    pointer-events: none !important;
    z-index: 10 !important;
    overflow: visible !important;
  }

  body#product .main-image-container > .product-flags .product-flag,
  body.page-product .main-image-container > .product-flags .product-flag,
  body#product #product-images-cont > .product-flags .product-flag,
  body.page-product #product-images-cont > .product-flags .product-flag,
  body#product .ellie-v77-main-flags .product-flag,
  body.page-product .ellie-v77-main-flags .product-flag {
    position: static !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 4px 11px !important;
    border-radius: 3px !important;
    background: #ffffff !important;
    border: 1px solid #d8d8d8 !important;
    color: #3f6fb5 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-transform: uppercase !important;
    box-shadow: none !important;
  }

  /* Na karcie produktu chowamy NOWY tylko na miniaturach/kaflach produktów, nie na głównym zdjęciu. */
  body#product article.product-miniature .product-flags,
  body.page-product article.product-miniature .product-flags,
  body#product article.product-miniature .product-flag.new,
  body.page-product article.product-miniature .product-flag.new,
  body#product article.product-miniature .ellie-hard-badge-box,
  body.page-product article.product-miniature .ellie-hard-badge-box,
  body#product article.product-miniature .ellie-v72-badge-holder,
  body.page-product article.product-miniature .ellie-v72-badge-holder,
  body#product article.product-miniature .ellie-v72-new-badge-under-thumb,
  body.page-product article.product-miniature .ellie-v72-new-badge-under-thumb {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  body#product .ellie-v77-bottom-menu-lock,
  body.page-product .ellie-v77-bottom-menu-lock {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99998 !important;
    background: #fff !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}