/**
 * Product Images Modal Gallery Styles
 * Full-screen modal with image slider and thumbnails
 */

/* Modal container - tablet and desktop */
@media (min-width: 576px) {
  .frn-product-slides {
    padding-top: 0;
    top: 8px; right: 8px; bottom: 8px; left: 8px;
    overflow: hidden auto;
  }
}

@media (min-width: 960px) {
  .frn-product-slides {
    padding-top: 0;
    top: 70px; right: 70px; bottom: 70px; left: 70px;
    overflow: hidden auto;
  }
}

/* Flex layout only when modal is active */
@media (min-width: 576px) {
  .frn-product-slides.frn-modal__content--active {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    overflow-y: hidden;
  }
}

/* Main slider container */
.frn-product-slides__slider {
  z-index: var(--zLevel1);
  position: relative;
  flex-shrink: 0;
}

/* Slider height - flexible so it shrinks to keep the heading and thumbnail
   strip visible on short/low-resolution viewports instead of overflowing the
   modal (which has overflow-y: hidden and would clip the thumbnails). */
@media (min-width: 576px) {
  .frn-product-slides__slider {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  .frn-product-slides--single-image .frn-product-slides__slider {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  /* Keep heading and thumbnails at their natural size; only the slider flexes */
  .frn-product-slides__heading,
  .frn-product-slides__thumbs-wrapper {
    flex-shrink: 0;
  }
}

/* Slider item (image container) */
.frn-product-slides__slider-item {
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  display: flex;
}

/* Fill the slide box and letterbox the image so it is never cropped and so it
   scales up/down with the available slider height (e.g. when thumbnails are
   toggled). The <picture> wrapper must also fill the box, otherwise the image
   keeps its intrinsic height and overflows/clips the slide. */
.frn-product-slides__slider-item picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.frn-product-slides__slider-item img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

/* Slide wrapper for swiper */
.frn-product-slides__slider-item-slide {
  height: 550px;
}

@media (min-width: 576px) {
  .frn-product-slides__slider-item-slide {
    height: 100%;
  }
}

@media (min-width: 768px) {
  .frn-product-slides__slider-item-slide {
    height: 100%;
  }
}

@media (min-width: 960px) {
  .frn-product-slides__slider-item-slide {
    height: 100%;
  }
}

/* GPU acceleration for smooth slide transitions */
.frn-product-slides .swiper-wrapper {
  will-change: transform;
}

.frn-product-slides .swiper-slide {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Swiper zoom container */
.swiper-zoom-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.swiper-zoom-container > * {
  width: 100%;
  height: 100%;
}

/* Cursor styles for zoom */
.swiper-zoom-container img {
  cursor: zoom-in;
}

.swiper-slide-zoomed .swiper-zoom-container img {
  cursor: grab;
}

.swiper-slide-zoomed .swiper-zoom-container img:active {
  cursor: grabbing;
}

/* Zoom icon in modal */
.frn-product-slides__slider-image-zoom {
  z-index: var(--zLevel1);
  background-color: var(--cWhite);
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  display: flex;
  position: absolute;
  bottom: 24px;
  right: 16px;
  transform: translateY(6px);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: none;
  padding: 0;
}

.frn-product-slides__slider-image-zoom:hover {
  transform: translateY(6px) scale(1.1);
  opacity: 1;
}

.frn-product-slides__slider-image-zoom img {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Navigation buttons */
.frn-product-slides .swiper-button-next {
  background-color: var(--cWhite);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(6px);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

@media (min-width: 576px) {
  .frn-product-slides .swiper-button-next {
    margin-top: -32px;
    right: 8px;
  }
}

@media (min-width: 960px) {
  .frn-product-slides .swiper-button-next {
    margin-top: -16px;
    right: 16px;
  }
}

.frn-product-slides .swiper-button-next:after {
  color: var(--cText);
  margin-left: 2px;
  font-size: var(--fz-16);
}

.frn-product-slides .swiper-button-prev {
  background-color: var(--cWhite);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(6px);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

@media (min-width: 576px) {
  .frn-product-slides .swiper-button-prev {
    margin-top: -32px;
    left: 8px;
  }
}

@media (min-width: 960px) {
  .frn-product-slides .swiper-button-prev {
    margin-top: -16px;
    left: 16px;
  }
}

.frn-product-slides .swiper-button-prev:after {
  color: var(--cText);
  margin-left: -4px;
  font-size: var(--fz-16);
}

/* Modal header */
.frn-product-slides__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0px;
  background-color: var(--cWhite);
  border-bottom: 1px solid var(--borderColor, #e0e0e0);
}

.frn-product-slides__heading-title {
  padding-top: 0;
  font-size: var(--fz-16);
  line-height: 24px;
  font-weight: 500;
  color: var(--cText);
}

.frn-product-slides__heading .frn-modal__heading-action {
  top: 0;
}

/* Under slider section (toggle button) */
.frn-product-slides__under-slider {
  z-index: var(--zLevel1);
  height: 8px;
  position: relative;
  margin-top: 16px;
  margin-bottom: 16px;
}

.swiper-button-next.swiper-button-disabled, .swiper-button-prev.swiper-button-disabled {
    pointer-events: auto;
}

.frn-product-slides__under-slider-action {
  z-index: var(--zLevel1);
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translate(-50%);
  box-shadow: 0 4px 24px 0 rgba(26, 27, 26, 0.16);
  border-radius: 24px;
}

.frn-product-slides__under-slider-action .frn-button {
  width: auto;
}

.frn-product-slides__under-slider-action .frn-button__icon--right {
  display: flex;
  align-items: center;
  margin-left: 8px !important;
  margin-bottom: 3px !important;
}

.frn-product-slides__under-slider-action .frn-button__icon-image {
  display: block;
}

/* Thumbnails wrapper container */
.frn-product-slides__thumbs-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .frn-product-slides__thumbs-wrapper {
    padding: 0 16px;
  }
}

/* Flex row of thumbnails with native scrolling */
.frn-product-slides__thumbs-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar in Firefox */
  -webkit-overflow-scrolling: touch; /* Smooth inertia scrolling in iOS Safari */
  padding: 8px 0;
  width: 100%;
}

/* Hide scrollbars for Chrome/Safari/Edge */
.frn-product-slides__thumbs-container::-webkit-scrollbar {
  display: none;
}

/* Individual thumbnail */
.frn-product-slides__thumbs-item {
  box-sizing: border-box;
  background-color: var(--bgcLight);
  width: 144px;
  height: 112px;
  z-index: var(--zLevel1);
  cursor: pointer;
  justify-content: center;
  align-items: center;
  display: flex;
  position: relative;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.frn-product-slides__thumbs-item:hover {
  border-color: var(--cDanger, #d32f2f);
  opacity: 0.9;
}

.frn-product-slides__thumbs-item picture {
  width: 100%;
  height: 100%;
  display: block;
}

.frn-product-slides__thumbs-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Active thumbnail indicator */
.frn-product-slides__thumbs-item--active:before {
  content: "";
  background-color: var(--cDanger);
  height: 3px;
  z-index: var(--zLevel1);
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
}

.frn-product-slides__thumbs-item--active {
  border-color: var(--cDanger, #d32f2f);
}


#productSlides .frn-product-slides__slider {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
#productSlides .frn-product-slides__slider .swiper.swiper-initialized {
  max-width: 1200px;
  width: 100%;
  height: 100%;
}

/* Zoom button on product page */
.frn-product-big__image-zoom {
  cursor: pointer;
  /* Optimize touch interaction on mobile devices */
  touch-action: manipulation;
  /* Add subtle tap highlight on mobile */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Prevent image inside zoom button from intercepting clicks */
.frn-product-big__image-zoom img {
  pointer-events: none;
}

@media (max-width: 996px) {
  #productSlides,
  #productSlides .frn-product-slides__slider-item {
    background-color: var(--cWhite);
  }
  #productSlides .frn-product-slides__slider-image-zoom,
  #productSlides .frn-product-slides__under-slider-action {
    display: none;
  }
  #productSlides .frn-product-slides__slider .swiper.swiper-initialized {
    width: 100%;
  }
}

/* Mobile Gallery Adjustments */
.frn-product-slides__counter-mobile {
  display: none;
}

@media (max-width: 768px) {
  #productSlides.frn-modal__content--active {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    height: 100dvh !important;
    overflow-y: hidden !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .frn-product-slides__heading {
    order: 1;
    flex: 0 0 auto;
    padding-left: 16px !important;
    padding-right: 16px !important;
    justify-content: flex-end !important;
  }

  #productSlidesCounter {
    display: none !important;
  }

  .frn-product-slides__counter-mobile {
    order: 3;
    flex: 0 0 auto;
    display: block;
    text-align: center;
    font-size: var(--fz-14);
    font-weight: 500;
    color: var(--cText);
    margin-top: 4px;
    margin-bottom: 4px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .frn-product-slides__thumbs-wrapper {
    order: 4;
    flex: 0 0 auto;
    padding-left: 16px !important;
    padding-right: 16px !important;
    margin-bottom: 16px !important;
  }

  /* Half-size thumbnails (twice smaller) */
  .frn-product-slides__thumbs-item {
    width: 72px;
    height: 56px;
  }

  .frn-product-slides__thumbs-container {
    justify-content: flex-start; /* Scroll naturally from left to right */
    gap: 8px;
    padding: 4px 0;
  }

  /* Main big slider - takes up remaining vertical space */
  .frn-product-slides__slider {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    height: 0 !important;
    width: 100% !important;
    margin-bottom: 8px !important;
  }

  #productSlidesSwiper {
    height: 100% !important;
  }

  .frn-product-slides__slider-item-slide {
    height: 100% !important;
  }

  /* Hide main slider arrows on mobile */
  .swiper-button-prevproductslide,
  .swiper-button-nextproductslide {
    display: none !important;
  }

  /* Hide under-slider block (toggle thumbs button) on mobile */
  .frn-product-slides__under-slider {
    display: none !important;
  }
}

/* Dynamic visibility when single image is active */
.frn-product-slides--single-image .frn-product-slides__thumbs-wrapper,
.frn-product-slides--single-image .frn-product-slides__counter-mobile,
.frn-product-slides--single-image .frn-product-slides__under-slider {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   Short / low-resolution desktop & laptop viewports.
   On screens with limited vertical space the default 70px modal inset wastes
   ~140px and the large heading + 112px thumbnails leave the main image too
   small (or clip the thumbnails). Reclaim that space progressively as the
   viewport gets shorter. Scoped to min-width: 769px so the dedicated mobile
   layout (max-width: 768px) is untouched.
--------------------------------------------------------------------------- */
@media (min-width: 769px) and (max-height: 800px) {
  .frn-product-slides {
    top: 24px; right: 24px; bottom: 24px; left: 24px;
  }

  .frn-product-slides__heading {
    padding: 10px 0;
  }

  .frn-product-slides__thumbs-item {
    width: 104px;
    height: 80px;
  }
}

@media (min-width: 769px) and (max-height: 640px) {
  .frn-product-slides {
    top: 12px; right: 12px; bottom: 12px; left: 12px;
  }

  .frn-product-slides__heading {
    padding: 6px 0;
  }

  .frn-product-slides__thumbs-item {
    width: 84px;
    height: 64px;
  }

  .frn-product-slides__thumbs-container {
    padding: 4px 0;
  }
}


