/* Basic styles for the page */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

/* Image container where random images will be placed */
#image-container {
  position: relative;
  width: 100%;
  height: 100vh; /* Ensure it takes the full viewport height */
  overflow: hidden; /* Prevent images from overflowing the screen */
}

/* Image style */
.image {
  position: absolute;
  transition: transform 0.3s ease, opacity 0.3s ease;
  cursor: pointer;
  object-fit: contain; /* Ensures images maintain their aspect ratio */
}

/* Hover effect for images */
.image:hover {
  transform: scale(1.05); /* Slightly enlarge the image */
}

/* Preview modal background (dark overlay) */
.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.8); /* Slight dark overlay */
  z-index: 1000;
  padding: 10px; /* Reduced padding around modal */
  box-sizing: border-box;
  overflow: hidden; /* Prevent overflow */
}

/* Modal content with compact layout */
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: white;
  padding: 8px; /* Reduced padding inside modal */
  width: 80%; /* Smaller width for a more compact modal */
  max-width: 400px; /* Max width to keep it proportional */
  box-sizing: border-box;
  overflow: hidden; /* Prevent content overflow */
}

/* Close button (X) */
.close-preview {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: transparent;
  border: none;
  font-size: 20px;
  color: #333;
  cursor: pointer;
}

/* Preview image inside modal */
.preview-image {
  width: 100%;
  height: auto;
  max-height: 60vh; /* Limit the height of the preview image to fit the screen */
  margin-bottom: 4px; /* Reduced space between image and carousel */
  object-fit: contain; /* Ensures images retain their aspect ratio */
}

/* Carousel container for sub-images */
.carousel-container {
  display: flex;
  justify-content: center;
  gap: 5px; /* Reduce space between carousel images */
  margin-bottom: 8px;
  overflow: visible; /* Disable horizontal scrolling */
}

/* Carousel image styles */
.carousel-image {
  width: 50px;
  height: 50px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease;
  will-change: transform;
}

/* Hover effect for carousel images */
.carousel-image:hover {
  transform: scale(1.1); /* Slightly enlarge carousel images on hover */
}

/* Product title styling */
.product-title {
  font-size: 1.1em; /* Slightly smaller font size */
  font-weight: bold;
  text-align: center;
  margin: 8px 0; /* Reduced margin */
  color: #333;
  word-wrap: break-word;
}

/* Description text styling */
.description-text {
  font-size: 13px; /* Smaller font size */
  margin: 2px 0; /* Reduced margin */
  text-align: center;
  color: #666;
  word-wrap: break-word;
}

/* Price text styling */
.price-text {
  font-size: 16px; /* Smaller font size */
  font-weight: bold;
  margin: 2px 0; /* Reduced margin */
  text-align: center;
  color: #008000; /* Green color for price */
}

/* Pay button (Buy Now button) */
.pay-button {
  padding: 8px 18px; /* Adjust padding for smaller button */
  font-size: 13px;
  font-weight: bold;
  background-color: #008000; /* Green background */
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-align: center;
  margin-top: 6px; /* Added margin-top to create some space between price/description and the button */
}

/* Hover effect for pay button */
.pay-button:hover {
  background-color: #006400;
}

/* Modal content for smaller screens */
@media (max-width: 768px) {
  .modal-content {
    width: 90%; /* Ensure it adapts to mobile screen */
  }

  .preview-image {
    max-height: 70vh; /* Limit the image height on mobile */
  }

  .product-title {
    font-size: 1.2em;
  }

  .description-text, .price-text {
    font-size: 12px;
  }

  .pay-button {
    font-size: 14px;
    padding: 8px 15px;
  }
}

/* Style for the images when viewed on mobile */
@media (max-width: 768px) {
  .image {
    width: 70px;
    height: 70px;
  }
}

/* Style for larger screens (desktop) */
@media (min-width: 769px) {
  .image {
    width: 180px;
    height: 180px;
  }

  /* Make modal even smaller on desktop */
  .modal-content {
    width: 40%; /* Further reduce width for smaller modal on desktop */
    max-width: 300px; /* Max width set to 350px for a smaller modal */
  }
}
