/* Popup container */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
  min-width: 280px;
  min-height: 200px;
  overflow-y: auto;
  font-size: clamp(14px, 2vw, 20px);
  font-family: sans-serif;
  z-index: 9999;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: fadeIn 0.3s ease-in-out;
  box-sizing: border-box;
  touch-action: auto; /* Allow native touch scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Popup image */
.popup img {
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

/* Close button */
.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: white;
  font-size: 24px;
  border: none;
  cursor: pointer;
  z-index: 10000;
  pointer-events: auto;
}

/* Scrollbar styling for WebKit browsers */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
}

/* Fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translate(-50%, -50%);
  }
  to {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%);
  }
}

/* Responsive adjustments for desktop */
@media (min-width: 1024px) {
  .popup {
    max-width: 800px;
    padding: 30px;
  }
}

/* Responsive adjustments for tablets */
@media (max-width: 1023px) and (min-width: 601px) {
  .popup {
    max-width: 90vw;
    padding: 25px;
    font-size: 16px;
  }
}

/* Responsive adjustments for mobile */
@media (max-width: 600px) {
  .popup {
    max-width: 95vw;
    padding: 20px;
    font-size: 15px;
  }

  .popup-close {
    font-size: 20px;
    top: 5px;
    right: 5px;
  }
}
