/* Safer layout for Enfold/WooCommerce single product pages */
.single-product div.product {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-start;
}

.single-product div.product div.images,
.single-product .oai-airbnb-gallery-block {
  width: 100% !important;
  float: none !important;
  margin: 0 0 14px !important;
}

.single-product div.product div.summary,
.single-product div.product .summary.entry-summary {
  width: 100% !important;
  max-width: 940px !important;
  margin: 0 auto !important;
  float: none !important;
  clear: both !important;
}

/* Keep product content margins intact */
.single-product .container,
.single-product .template-shop {
  max-width: 1100px;
}

/* Avoid huge gap under header without forcing a giant top offset */
.single-product #main,
.single-product .main_color.container_wrap_first {
  padding-top: 18px !important;
  margin-top: 0 !important;
}

/* Custom gallery */
.oai-airbnb-gallery-block {
  width: min(1240px, calc(100vw - 40px)) !important;
  max-width: 1240px !important;
  margin: 8px auto 14px !important;
  position: relative;
}

.oai-airbnb-gallery {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr);
  gap: 10px;
}

.oai-gallery-main,
.oai-thumb,
.oai-view-all,
.oai-lightbox-close,
.oai-lightbox-nav,
.oai-lightbox-thumb {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.oai-gallery-main {
  display: block;
  height: 340px;
  overflow: hidden;
  border-radius: 16px;
}

.oai-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.oai-gallery-thumbs-desktop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 165px;
  gap: 10px;
}

.oai-gallery-thumbs-mobile {
  display: none;
}

.oai-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  display: block;
}

.oai-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.oai-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.35);
}

.oai-view-all {
  margin-top: 12px;
  padding: 14px 20px;
  min-height: 52px;
  border: 1px solid #222;
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

/* Remove any zoom/lens leftovers from WC/Enfold */
.single-product .woocommerce-product-gallery__trigger,
.single-product .zoomImg,
.single-product .image-overlay,
.single-product .avia-image-container .image-overlay,
.single-product a.woocommerce-product-gallery__trigger,
.single-product .oai-airbnb-gallery-block a::before,
.single-product .oai-airbnb-gallery-block a::after,
.single-product .oai-airbnb-gallery-block button::before,
.single-product .oai-airbnb-gallery-block button::after {
  display: none !important;
  content: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Lightbox */
.oai-lightbox[hidden] {
  display: none !important;
}

.oai-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 16px;
}

.oai-lightbox-close {
  grid-column: 3;
  justify-self: end;
  align-self: start;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 28px;
}

.oai-lightbox-stage {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.oai-lightbox-stage img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

.oai-lightbox-nav {
  align-self: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 34px;
}

.oai-lightbox-prev { grid-column: 1; grid-row: 2; }
.oai-lightbox-next { grid-column: 3; grid-row: 2; }

.oai-lightbox-strip {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  justify-content: center;
  padding-bottom: 4px;
}

.oai-lightbox-thumb {
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid transparent;
  flex: 0 0 auto;
}

.oai-lightbox-thumb.is-active {
  border-color: #fff;
}

.oai-lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 768px) {
  .single-product #main,
  .single-product .main_color.container_wrap_first {
    padding-top: 10px !important;
  }

  .oai-airbnb-gallery-block {
    width: calc(100vw - 28px) !important;
    margin: 8px auto 14px !important;
  }

  .oai-airbnb-gallery {
    display: block;
  }

  .oai-gallery-main {
    height: auto;
    aspect-ratio: 4 / 3;
    margin-bottom: 12px;
  }

  .oai-gallery-thumbs-desktop {
    display: none;
  }

  .oai-gallery-thumbs-mobile {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }

  .oai-gallery-thumbs-mobile .oai-thumb {
    aspect-ratio: 1 / 1;
    min-height: 0;
  }

  .oai-thumb-overlay {
    font-size: 18px;
  }

  .oai-view-all {
    width: 100%;
  }

  .oai-lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto auto;
    padding: 12px;
  }

  .oai-lightbox-close {
    grid-column: 1;
    justify-self: end;
  }

  .oai-lightbox-stage {
    grid-column: 1;
    grid-row: 2;
  }

  .oai-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }

  .oai-lightbox-prev { left: 10px; }
  .oai-lightbox-next { right: 10px; }

  .oai-lightbox-strip {
    grid-column: 1;
    grid-row: 4;
    justify-content: flex-start;
  }
}



/* Stronger cleanup for any zoom/search overlays injected by Enfold or other scripts */
.oai-airbnb-gallery-block .oai-gallery-main,
.oai-airbnb-gallery-block .oai-gallery-main *,
.oai-airbnb-gallery-block .oai-thumb,
.oai-airbnb-gallery-block .oai-thumb * {
  background-image: none !important;
}

.oai-airbnb-gallery-block .oai-gallery-main::before,
.oai-airbnb-gallery-block .oai-gallery-main::after,
.oai-airbnb-gallery-block .oai-thumb::before,
.oai-airbnb-gallery-block .oai-thumb::after,
.oai-airbnb-gallery-block .oai-gallery-main a::before,
.oai-airbnb-gallery-block .oai-gallery-main a::after,
.oai-airbnb-gallery-block .oai-thumb a::before,
.oai-airbnb-gallery-block .oai-thumb a::after,
.oai-airbnb-gallery-block .avia-image-container::before,
.oai-airbnb-gallery-block .avia-image-container::after,
.oai-airbnb-gallery-block .avia-image-container a::before,
.oai-airbnb-gallery-block .avia-image-container a::after,
.oai-airbnb-gallery-block .image-overlay,
.oai-airbnb-gallery-block .image-overlay-inside,
.oai-airbnb-gallery-block .av-magnify,
.oai-airbnb-gallery-block .av-magictouch,
.oai-airbnb-gallery-block .zoom,
.oai-airbnb-gallery-block .zoomicon,
.oai-airbnb-gallery-block .zoom-icon,
.oai-airbnb-gallery-block .magnify,
.oai-airbnb-gallery-block .iconfont,
.oai-airbnb-gallery-block [class*="zoom"],
.oai-airbnb-gallery-block [class*="magnif"],
.oai-airbnb-gallery-block [class*="overlay"],
.oai-airbnb-gallery-block [aria-label*="Zoom" i],
.oai-airbnb-gallery-block [aria-label*="Search" i] {
  display: none !important;
  content: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 767px) {
  .oai-airbnb-gallery-block .oai-gallery-main {
    position: relative;
  }

  /* keep only the image inside the main tile on mobile */
  .oai-airbnb-gallery-block .oai-gallery-main > :not(img) {
    display: none !important;
  }

  .oai-airbnb-gallery-block .oai-thumb > :not(img):not(.oai-thumb-overlay) {
    display: none !important;
  }

  .oai-view-all {
    border-color: #d9d9d9 !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.04) !important;
  }
}
