/* =====================================================
   TOUR GALLERY LIGHTBOX STYLES
   ===================================================== */

/* Lightbox Overlay */
.tour-gallery-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tour-gallery-lightbox.active {
  display: flex;
  opacity: 1;
}

/* Lightbox Content Container */
.lightbox-content {
  position: relative;
  width: 90%;
  height: 90%;
  max-width: 1400px;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  outline: none !important;
}

/* Main Image */
.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: transparent;
}

.lightbox-image.loaded {
  opacity: 1;
  transform: scale(1);
}

/* Ensure no borders anywhere in lightbox */
.tour-gallery-lightbox,
.tour-gallery-lightbox *,
.tour-gallery-lightbox img,
.tour-gallery-lightbox .lightbox-content,
.tour-gallery-lightbox .lightbox-image {
  border: 0 !important;
  border-width: 0 !important;
  outline: 0 !important;
  outline-width: 0 !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

/* Specifically target the image element with all possible selectors */
img.lightbox-image,
#lightboxImage,
.lightbox-content img {
  border: 0 !important;
  border-width: 0 !important;
  outline: 0 !important;
  padding: 0 !important;
  margin: 0 auto !important;
  display: block !important;
}

/* Loading Spinner */
.lightbox-loader {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Navigation Buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.lightbox-nav.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-nav svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Image Counter and Caption */
.lightbox-info {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  min-width: 150px;
  text-align: center;
}

.lightbox-counter {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
}

.lightbox-caption {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  max-width: 600px;
  line-height: 1.5;
}

/* Clickable Gallery Items */
.thumbnail,
.hero-image {
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.thumbnail:hover,
.tour-hero__main:hover .hero-image {
  opacity: 0.9;
  transform: scale(1.02);
}

.thumbnail:active,
.tour-hero__main:active .hero-image {
  transform: scale(0.98);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .lightbox-content {
    width: 95%;
    height: 95%;
  }

  .lightbox-image {
    max-height: 70vh;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .lightbox-info {
    bottom: 20px;
    padding: 10px 20px;
    max-width: 90%;
  }

  .lightbox-counter {
    font-size: 12px;
  }

  .lightbox-caption {
    font-size: 12px;
  }
}

/* Prevent Body Scroll When Lightbox Open */
body.lightbox-open {
  overflow: hidden;
}

/* Smooth Image Transitions */
.lightbox-image-exit {
  animation: imageExit 0.2s ease;
}

.lightbox-image-enter {
  animation: imageEnter 0.3s ease;
}

@keyframes imageExit {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes imageEnter {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Accessibility - Focus Styles */
.lightbox-nav:focus,
.lightbox-close:focus {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {
  .lightbox-nav,
  .lightbox-close {
    width: 50px;
    height: 50px;
  }

  .thumbnail:hover,
  .tour-hero__main:hover .hero-image {
    opacity: 1;
    transform: none;
  }
}
