/* =====================================
   Elementor Product Gallery Slider (EPG)
   Ulta-Inspired Clean Look
===================================== */

/* ---------- Wrapper ---------- */
.thumbnail_slider {
  max-width: 100%;
  margin: 30px auto;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  contain: layout style;
}

/* ---------- Primary Slider (Desktop) ---------- */
.epg-primary-splide {
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 500px;
}

.epg-primary-splide .splide__track {
  width: 100%;
}

.epg-primary-splide .splide__slide {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 450px;
  background: #f5f5f5;
  padding: 40px;
  margin: 0;
  width: 100%;
}

.epg-primary-splide img.epg-main-image {
  object-fit: contain;
  max-width: 100%;
  max-height: 450px;
  display: block;
  margin: auto;
  background: #f5f5f5;
}

/* Hide arrows and pagination in main slider on desktop */
.epg-primary-splide .splide__arrows {
  display: none !important;
}

.epg-primary-splide .splide__pagination {
  display: none !important;
}

/* ---------- Thumbnail Slider (Desktop | Fixed Width + Ulta Style) ---------- */
.epg-thumb-splide {
  margin-top: 15px;
  position: relative;
  max-width: 100%; /* matches primary image width */
  margin-left: auto;
  margin-right: auto;
  overflow: hidden; /* prevents thumbnails from overflowing */
  padding: 0 60px; /* space for arrows */
  box-sizing: border-box;
  height: 120px; /* Fixed height to match main gallery proportions */
}

.epg-thumb-splide .splide__track {
  overflow: hidden; /* ensure it doesn't stretch out */
}

.epg-thumb-splide .splide__list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.epg-thumb-splide .splide__slide {
  border: 0.5px solid #e5e5e5;
  cursor: pointer;
  height: 100px;
  width: 100px;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
  border-radius: 0;
  transition: border-color 0.2s ease;
  padding: 5px;
  margin: 0 5px;
}

.epg-thumb-splide .splide__slide:hover {
  border-color: #ccc;
}

.epg-thumb-splide .splide__slide img.epg-thumbnail-image {
  max-height: 90px;
  max-width: 90px;
  object-fit: contain;
}

/* Active thumbnail - subtle black border */
.epg-thumb-splide .splide__slide.is-active {
  border: 0.5px solid #000;
  padding: 4px;
}

/* ---------- Ulta-Style Arrows ---------- */
.epg-thumb-splide .splide__arrows {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 3;
}

.epg-thumb-splide .splide__arrow {
  background: #fff;
  border: 0.5px solid #dcdcdc;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: all 0.25s ease;
  opacity: 1;
  visibility: visible;
}

.epg-thumb-splide .splide__arrow:hover {
  background: #fafafa;
  border-color: #aaa;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transform: scale(1.05);
}

.epg-thumb-splide .splide__arrow svg {
  fill: #000;
  width: 16px;
  height: 16px;
  stroke: #000;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.epg-thumb-splide .splide__arrow--prev {
  left: 10px;
}

.epg-thumb-splide .splide__arrow--next {
  right: 10px;
}

.epg-thumb-splide .splide__arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- Mobile Dots Container - Separate Section ---------- */
.epg-mobile-dots-container {
  display: none; /* Hidden by default, shown on mobile */
  position: relative;
  width: 100%;
  padding: 15px 0;
  background: transparent;
  z-index: 5;
}

.epg-dots-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 0 15px;
  box-sizing: border-box;
}

.epg-custom-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid #000;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  padding: 0;
  margin: 0;
  display: inline-block;
  flex-shrink: 0;
  opacity: 1;
}

.epg-custom-dot:hover {
  background: #666;
  border-color: #666;
  transform: scale(1.1);
}

.epg-custom-dot.active {
  background: #000;
  border-color: #000;
  transform: scale(1.2);
}

/* ---------- Mobile Layout (Ulta Style) ---------- */
@media (max-width: 768px) {
  .thumbnail_slider {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    contain: layout style;
    z-index: 1;
  }
  
  /* Show mobile dots container on mobile */
  .epg-mobile-dots-container {
    display: block;
  }

  /* Primary slider - transparent background, slides have #f5f5f5 */
  .epg-primary-splide {
    background: transparent;
    border-radius: 0;
    padding: 0 0 30px 0; /* Extra bottom padding for dots */
    margin-bottom: 20px;
    min-height: auto;
    overflow: hidden;
    position: relative;
    contain: layout style;
    z-index: 1;
  }

  .epg-primary-splide .splide__track {
    overflow: hidden;
  }

  .epg-primary-splide .splide__list {
    overflow: hidden;
  }

  .epg-primary-splide .splide__slide {
    min-height: auto;
    height: auto;
    background: #f5f5f5;
    padding: 30px 20px;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .epg-primary-splide img.epg-main-image {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    border-radius: 0;
    background: #f5f5f5;
    padding: 20px;
    display: block;
    margin: 0 auto;
  }

  /* Mobile slider container for peek effect */
  .epg-primary-splide.mobile-peek {
    padding-right: 0;
    overflow: visible;
  }

  .epg-primary-splide.mobile-peek .splide__track {
    padding-right: 0;
    overflow: visible;
  }

  .epg-primary-splide.mobile-peek .splide__list {
    overflow: visible;
  }

  /* Mobile swipe indicators */
  .epg-primary-splide .splide__slide::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 30px;
    background: rgba(0,0,0,0.1);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .epg-primary-splide .splide__slide:not(:last-child)::after {
    opacity: 1;
  }

  /* Hide thumbnails on mobile */
  .epg-thumb-splide {
    display: none !important;
  }

  /* Hide built-in pagination completely */
  .epg-primary-splide .splide__pagination {
    display: none !important;
  }

  /* Ensure arrows stay hidden on mobile */
  .epg-primary-splide .splide__arrows {
    display: none !important;
  }

  /* Mobile swipe indicators */
  .epg-primary-splide .splide__slide::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 30px;
    background: rgba(0,0,0,0.1);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .epg-primary-splide .splide__slide:not(:last-child)::after {
    opacity: 1;
  }
}

/* ---------- Enhanced Mobile Styles ---------- */
@media (max-width: 480px) {
  .epg-primary-splide {
    padding: 25px 15px;
  }

  .epg-primary-splide .splide__slide {
    padding: 25px 15px;
    background: #f5f5f5;
    margin: 0;
    width: 100%;
  }

  .epg-primary-splide img.epg-main-image {
    max-height: 60vh;
    object-fit: contain;
    padding: 15px;
  }

  .epg-primary-splide .splide__pagination {
    bottom: 10px;
    gap: 8px;
  }

  .epg-primary-splide .splide__pagination__page {
    width: 7px;
    height: 7px;
  }
}

/* ---------- Mobile Touch Enhancements ---------- */
@media (max-width: 768px) {
  .epg-primary-splide {
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  .epg-primary-splide .splide__slide {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
  }

  /* Smooth transitions for mobile */
  .epg-primary-splide .splide__track {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* Hide all old mobile pagination */
  .epg-mobile-pagination {
    display: none !important;
  }
}

/* ---------- Enhanced Mobile Styles ---------- */
@media (max-width: 480px) {
  .epg-primary-splide {
    padding: 25px 15px;
  }

  .epg-primary-splide .splide__slide {
    padding: 25px 15px;
    background: #f5f5f5;
    margin: 0;
    width: 100%;
  }

  .epg-primary-splide img.epg-main-image {
    max-height: 60vh;
    object-fit: contain;
    padding: 15px;
  }

  .epg-dots-wrapper {
    gap: 6px;
  }

  .epg-custom-dot {
    width: 5px;
    height: 5px;
  }
}

/* ---------- Tablet Adjustments ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .epg-thumb-splide {
    height: 110px;
    padding: 0 50px;
  }

  .epg-thumb-splide .splide__slide {
    height: 90px;
    width: 90px;
    margin: 0 4px;
  }
  
  .epg-thumb-splide .splide__slide img.epg-thumbnail-image {
    max-height: 80px;
    max-width: 80px;
  }
}

/* ---------- Large Desktop Adjustments ---------- */
@media (min-width: 1200px) {
  .epg-thumb-splide {
    height: 130px;
    padding: 0 70px;
  }

  .epg-thumb-splide .splide__slide {
    height: 110px;
    width: 110px;
    margin: 0 6px;
  }
  
  .epg-thumb-splide .splide__slide img.epg-thumbnail-image {
    max-height: 100px;
    max-width: 100px;
  }
}

/* ---------- Text Rendering Fixes ---------- */
.thumbnail_slider {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.thumbnail_slider * {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}