/* ============================================
   IIS Product Gallery Widget Styles
   ============================================ */

/* Base Container */
.elementor-widget-iis_product_gallery .iis-product-gallery {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Active Image Container */
.elementor-widget-iis_product_gallery .iis-product-gallery__active-image-container {
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
  background-color: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* 1:1 aspect ratio for mobile */
  overflow: hidden;
  cursor: zoom-in;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper.is-zooming img {
  transform: scale(2);
  cursor: zoom-out;
}

/* YouTube Video in Active Container */
.elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Loading State */
.elementor-widget-iis_product_gallery .iis-product-gallery__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 1rem;
}

/* Fullscreen Button */
.elementor-widget-iis_product_gallery .iis-product-gallery__fullscreen-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.elementor-widget-iis_product_gallery .iis-product-gallery__fullscreen-btn:hover {
  background-color: #fff;
  transform: scale(1.05);
}

.elementor-widget-iis_product_gallery .iis-product-gallery__fullscreen-btn svg {
  color: #333;
}

/* Thumbnails Container */
.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  flex: 1;
  padding: 0.25rem 0;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails::-webkit-scrollbar {
  height: 6px;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  background-color: #f5f5f5;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail:hover {
  border-color: #999;
  transform: scale(1.05);
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail.is-active {
  border-color: #333;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video Thumbnail Overlay */
.elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail--video::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 16px solid rgba(255, 255, 255, 0.9);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  pointer-events: none;
}

/* Navigation Buttons */
.elementor-widget-iis_product_gallery .iis-product-gallery__nav-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.elementor-widget-iis_product_gallery .iis-product-gallery__nav-btn:hover:not(:disabled) {
  background-color: #fff;
  transform: scale(1.1);
}

.elementor-widget-iis_product_gallery .iis-product-gallery__nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.elementor-widget-iis_product_gallery .iis-product-gallery__nav-btn svg {
  color: #333;
}

/* Modal */
.iis-product-gallery__modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  overflow: auto;
}

.iis-product-gallery__modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.iis-product-gallery__modal-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  padding: 2rem;
}

.iis-product-gallery__modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.iis-product-gallery__modal-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.iis-product-gallery__modal-close svg {
  color: #fff;
}

.iis-product-gallery__modal-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iis-product-gallery__modal-image-wrapper img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.iis-product-gallery__modal-image-wrapper iframe {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: 8px;
}

/* Error State */
.elementor-widget-iis_product_gallery .iis-product-gallery__error {
  padding: 2rem;
  text-align: center;
  color: #d32f2f;
  background-color: #ffebee;
  border-radius: 8px;
}

/* ============================================
   Tablet Styles (768px+)
   ============================================ */
@media (min-width: 768px) {
  .elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper {
    padding-bottom: 75%; /* 4:3 aspect ratio for tablet */
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail {
    width: 100px;
    height: 100px;
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails {
    gap: 0.75rem;
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__fullscreen-btn {
    width: 48px;
    height: 48px;
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__nav-btn {
    width: 40px;
    height: 40px;
  }

  .iis-product-gallery__modal-image-wrapper iframe {
    height: 70vh;
  }
}

/* ============================================
   Desktop Styles (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .elementor-widget-iis_product_gallery .iis-product-gallery {
    max-width: 800px;
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__active-image-wrapper {
    padding-bottom: 66.67%; /* 3:2 aspect ratio for desktop */
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__thumbnail {
    width: 120px;
    height: 120px;
  }

  .elementor-widget-iis_product_gallery .iis-product-gallery__thumbnails {
    gap: 1rem;
  }

  .iis-product-gallery__modal-image-wrapper iframe {
    height: 75vh;
  }
}
