/**
 * Simple Lightbox Compatibility Styles
 * 
 * Styles for the custom lightweight lightbox implementation
 */

/* Prevent scrolling when lightbox is open */
body.simple-lightbox-open {
  overflow: hidden;
}

/* Main lightbox container */
.simple-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}

.simple-lightbox.active {
  display: flex;
}

/* Lightbox content container */
.simple-lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom; /* Allow vertical scrolling but handle horizontal swipes */
  user-select: none; /* Prevent text selection during swipe */
  -webkit-user-select: none;
  transition: transform 0.3s ease;
  margin: auto;
}

/* Image container with white background */
.simple-lightbox-image-container {
  background-color: #fff;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: visible;
  margin: auto;
}

/* Image styling */
.simple-lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  width: auto;
  height: auto;
  max-height: calc(80vh - 20px); /* Account for padding */
}

/* Caption styling */
.simple-lightbox-caption {
  color: #fff;
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  padding: 5px 10px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  max-width: 100%;
}

/* Navigation buttons */
.simple-lightbox-prev,
.simple-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 10;
}

.simple-lightbox-prev:hover,
.simple-lightbox-next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.simple-lightbox-prev {
  left: 20px;
}

.simple-lightbox-next {
  right: 20px;
}

/* Close button */
.simple-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 10;
}

.simple-lightbox-close:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Swipe indicator for mobile devices */
.simple-lightbox-swipe-indicator {
  display: none;
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border-radius: 20px;
  z-index: 10;
  pointer-events: none;
  animation: fade-out 2s forwards 1s;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Mobile-specific adjustments */
@media (max-width: 640px) {
  .simple-lightbox-content {
    max-width: 95%;
    max-height: 90vh;
  }
  
  .simple-lightbox-image-container {
    max-width: 100%;
    max-height: 70vh;
    padding: 5px;
    margin: auto;
  }
  
  .simple-lightbox-image {
    max-height: calc(70vh - 10px);
  }
  
  .simple-lightbox-prev,
  .simple-lightbox-next {
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 30px;
  }
  
  .simple-lightbox-prev {
    left: 5px;
  }
  
  .simple-lightbox-next {
    right: 5px;
  }
  
  .simple-lightbox-close {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 30px;
  }
  
  /* Show swipe indicator on mobile */
  .simple-lightbox-swipe-indicator {
    display: block;
  }
}
