/* Styles for the image gallery overlay */

/* Gallery Overlay */
.image-gallery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-gallery-overlay.active {
  opacity: 1;
}

/* Gallery Container */
.gallery-container {
  position: relative;
  width: 90%;
  height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Gallery Image Container and Image */
.gallery-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.gallery-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.gallery-image.transitioning {
  opacity: 0.5;
}

/* Navigation Buttons */
.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 1001;
}

.gallery-nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.gallery-prev-btn {
  left: 15px;
}

.gallery-next-btn {
  right: 15px;
}

/* Close Button */
.gallery-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 1001;
}

.gallery-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* Image Counter */
.gallery-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 14px;
}

/* Make the product image clickable with visual indicator */
.product-image-container {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.product-image-container::after {
  content: '🔍';
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(255, 255, 255, 0.7);
  color: #333;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}

.product-image-container:hover::after {
  opacity: 1;
}

/* CSS styles for smooth loading experience */
.gallery-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 1001;
}

.gallery-loading-spinner .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-progress {
  margin-top: 10px;
  min-width: 200px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: white;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  opacity: 0.8;
}

.gallery-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-image.loaded {
  opacity: 1;
}

.gallery-image.transitioning {
  opacity: 0.7;
}

.gallery-preload-indicator {
  position: absolute;
  top: 20px;
  right: 80px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-preload-indicator.show {
  opacity: 1;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .gallery-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .gallery-close-btn {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
  
  .gallery-counter {
    padding: 4px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .gallery-container {
    width: 95%;
    height: 95%;
  }
  
  .gallery-nav-btn {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
  
  .gallery-close-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
    top: 10px;
    right: 10px;
  }
  
  .gallery-counter {
    padding: 3px 10px;
    font-size: 11px;
  }
  
  .product-image-container::after {
    width: 25px;
    height: 25px;
    font-size: 14px;
  }
}