.carouselContainer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: pan-y;
}

.productImage {
  width: 99%;
  height: auto;
  object-fit: contain;
}

/* Fixed frame container to prevent layout shifts */
.fixedFrameContainer {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  overflow: hidden;
}

/* Style for product card (non-detail view) images */
.cardImage {
  width: auto;
  height: 300px;
  max-width: 100%;
  margin: auto;
  object-fit: contain;
}

/* Style for images inside detail view */
.detailImage {
  width: auto;
  height: auto;
  max-width: 90%;
  max-height: 90%;
  margin: auto;
  object-fit: contain;
}

/* Specific styles for the detail carousel */
.detailCarousel {
  .carouselContainer {
    height: auto;
    min-height: 400px;
  }

  .fixedFrameContainer {
    min-height: 400px;
  }
}

.imageWrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arrowButton {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

  &:hover {
    background-color: white;
  }

  svg {
    color: #333;
  }
}

.leftArrow {
  left: 8px;
}

.rightArrow {
  right: 8px;
}

.carouselWrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.carouselContainer:hover .arrowButton {
  opacity: 1;
}

.indicators {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(200, 200, 200, 0.7);
  transition: background-color 0.2s ease;
  cursor: pointer;

  &:hover {
    background-color: rgba(255, 255, 255, 0.8);
  }

  &.active {
    background-color: #333;
  }
}

.thumbnailContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  justify-content: center;
  width: 100%;
  position: relative;
}

.thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  opacity: 0.7;
  transition: all 0.2s ease;

  &:hover {
    opacity: 1;
  }

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.activeThumbnail {
  opacity: 1;
  border: 2px solid #ff6b00;
}

/* Modal Styles */
.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modalContent {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.closeButton {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: all 0.2s ease;
  color: #333;

  &:hover {
    background-color: grey;
    transform: scale(1.1);
  }
}

.modalImageContainer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  user-select: none;
}

.modalImage {
  max-width: 90%;
  max-height: 80vh;
  object-fit: contain;
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.modalControls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  z-index: 10001;
}

.controlButton {
  width: 30px;
  height: 30px;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;

  &:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
  }

  &:active {
    transform: scale(0.95);
  }

  svg {
    width: 20px;
    height: 20px;
  }
}

/* Responsive styling */
@media (max-width: 768px) {
  .thumbnailContainer {
    justify-content: center;
  }

  .thumbnail {
    width: 50px;
    height: 50px;
  }

  .detailCarousel {
    .carouselContainer {
      min-height: 300px;
    }

    .fixedFrameContainer {
      min-height: 300px;
    }
  }

  .cardImage {
    height: 180px;
  }

  .closeButton {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .modalControls {
    bottom: 10px;
    padding: 8px;
    gap: 6px;
    // flex-wrap: wrap;
    max-width: 90%;
  }

  .controlButton {
    width: 28px;
    height: 28px;

    svg {
      width: 18px;
      height: 18px;
    }
  }

  .modalImage {
    max-width: 95%;
    max-height: 70vh;
  }
}