/* Main Gallery Container */
.property-gallery {
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}

/* Thumbnails Container */
.gallery-thumbs-container {
  position: relative;
  margin-top: 15px;
  width: 100%;
  overflow: hidden;
}

.gallery-thumbs {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 10px 0;
  margin: 0 50px; /* Increased margin for buttons */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  scroll-snap-type: x mandatory;
  scroll-padding: 0 10px;
}

.gallery-thumbs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari and Opera */
  height: 0; /* Hide horizontal scrollbar */
}

.gallery-thumb-wrap {
  flex: 0 0 auto;
  scroll-snap-align: start;
  margin: 0 5px;
}

/* Navigation Buttons */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.3s ease;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.gallery-nav:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.1);
}

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

.gallery-nav i {
  font-size: 18px;
  line-height: 1;
}

.gallery-prev {
  left: 10px;
}

.gallery-next {
  right: 10px;
}

/* Hide navigation when not needed */
.gallery-nav[style*="display: none"] {
  display: none !important;
}

/* LightGallery Mobile Overrides */
.lg-outer .lg-toolbar, 
.lg-outer .lg-actions .lg-next, 
.lg-outer .lg-actions .lg-prev,
.lg-outer .lg-toolbar .lg-close,
.lg-outer .lg-toolbar .lg-counter {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Ensure controls are visible on mobile */
.lg-outer .lg-actions .lg-next,
.lg-outer .lg-actions .lg-prev {
  width: 60px !important;
  height: 60px !important;
  font-size: 24px !important;
  line-height: 60px !important;
  text-align: center;
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50%;
  margin-top: -30px !important;
}

/* Close button on mobile */
.lg-outer .lg-toolbar .lg-close {
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 24px !important;
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50%;
  right: 10px !important;
  top: 10px !important;
  color: white !important;
}

/* Counter on mobile */
.lg-outer .lg-toolbar .lg-counter {
  color: white !important;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
  font-size: 16px !important;
  padding: 5px 10px !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border-radius: 10px;
  left: 10px !important;
  top: 10px !important;
}

/* Main Image */
.gallery-main {
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  height: 500px; /* Fixed height for main image */
  background: #f5f5f5;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

/* Thumbnails Container */
.gallery-thumbs-container {
  position: relative;
  padding: 0 30px; /* Space for navigation arrows */
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 5px 0;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.gallery-thumbs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

/* Individual Thumbnail */
.gallery-thumb-wrap {
  flex: 0 0 auto;
  width: 100px;
  height: 75px;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.gallery-thumb-wrap.active {
  border-color: #1a73e8;
  transform: translateY(-5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gallery-thumb {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-thumb:hover img {
  transform: scale(1.05);
}

/* Navigation Arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 50px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 4px;
  color: #333;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 10;
  transition: all 0.3s ease;
}

.gallery-nav:hover {
  background: #1a73e8;
  color: white;
}

.gallery-prev {
  left: 0;
}

.gallery-next {
  right: 0;
}

/* Thumbnail Overlay for More Images */
.thumb-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .gallery-main {
    height: 350px;
  }
  
  .gallery-thumb-wrap {
    width: 80px;
    height: 60px;
  }
  
  .gallery-thumbs-container {
    padding: 0 25px;
  }
  
  .gallery-nav {
    width: 25px;
    height: 40px;
  }
}

/* Lightbox Adjustments */
.lg-outer {
  z-index: 999999;
}

.lg-outer .lg-thumb-outer {
  background-color: rgba(0, 0, 0, 0.9);
}

.lg-outer .lg-thumb-item {
  border-radius: 4px;
  margin: 0 5px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  opacity: 0.7;
}

.lg-outer .lg-thumb-item.active,
.lg-outer .lg-thumb-item:hover {
  border-color: #1a73e8;
  opacity: 1;
}

.lg-outer .lg-thumb {
  border-radius: 2px;
  overflow: hidden;
}

/* Navigation arrows */
.lg-actions .lg-next,
.lg-actions .lg-prev {
  background-color: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  transition: all 0.3s ease;
}

.lg-actions .lg-next:hover,
.lg-actions .lg-prev:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.lg-actions .lg-next:after,
.lg-actions .lg-prev:after {
  color: #fff;
  font-size: 24px;
}

/* Counter */
.lg-toolbar .lg-counter {
  color: #fff;
  font-size: 16px;
  padding: 10px 15px;
}

/* Loading spinner */
.lg-outer .lg-img-rotate {
  border: 4px solid #1a73e8;
  border-radius: 50%;
  border-top-color: transparent;
}

/* Close button */
.lg-outer .lg-close {
  background-color: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  transition: all 0.3s ease;
}

.lg-outer .lg-close:after {
  color: #fff;
  font-size: 24px;
}

.lg-outer .lg-close:hover {
  background-color: rgba(0, 0, 0, 0.7);
}
