/* Popup background */
.gallery-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

.gallery-modal.active {
  display: block;
}

/* Popup content container */
.gallery-content {
  position: relative;
  margin: 50px auto;
  max-width: 90%;
  max-height: 80%;
  background: #fff;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
  font-size: 40px;
  color: #fff;
  z-index: 1010;
}

/* Main image container */
.main-image-container {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.gallery-main-image {
  width: auto; /* Allow width to adjust based on image aspect ratio */
  max-width: 100%; /* Ensure it does not exceed the container width */
  height: auto; /* Maintains aspect ratio */
  max-height: 60vh; /* Allow full height */
  object-fit: contain; /* Ensure the entire image is visible */
}

/* Thumbnails container */
.thumbnails-container {
  display: flex;
  overflow-x: scroll; /* Force scrollbar */
  gap: 10px;
  padding-bottom: 15px; /* Extra space for scrollbar */
  width: 100%;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom scrollbar styling */
.thumbnails-container::-webkit-scrollbar {
  height: 8px; /* Always show scrollbar track */
}

.thumbnails-container::-webkit-scrollbar-track {
  background: #000;
  border-radius: 4px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Firefox scrollbar */
@supports (scrollbar-color: #888 #000) {
  .thumbnails-container {
    scrollbar-color: #888 #000;
    scrollbar-width: thin;
  }
}

/* Thumbnail images */
.thumbnail {
  height: 100px; /* Fixed height for consistency */
  width: auto; /* Allow width to vary based on image aspect ratio */
  object-fit: cover;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  border: 2px solid transparent;
}

.thumbnail:hover,
.thumbnail.active {
  opacity: 1;
  border-color: #000;
}
