.lb-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 15, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1055;
  overflow: hidden;
}

.lb-overlay img.lb-img {
  max-width: 95vw;
  max-height: 90vh;
  height: auto;
  width: auto;
  transition: transform 0.1s ease-out, opacity 0.3s ease;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-overlay img.lb-img.zoomed {
  cursor: grab;
  max-width: none;
  max-height: none;
}

.lb-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.lb-caption {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.lb-prev,
.lb-next,
.lb-close {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.lb-prev img,
.lb-next img,
.lb-close img {
  width: 40px;
  height: 40px;
}

.lb-close { top: 20px; right: 20px; }

.lb-prev:hover,
.lb-next:hover,
.lb-close:hover {
  opacity: 0.7;
}

@media (max-width: 768px) {
  .lb-prev img,
  .lb-next img,
  .lb-close img {
    width: 30px;
    height: 30px;
  }
  .lb-caption {
    bottom: 10px;
    font-size: 0.8rem;
  }
}

/* Position navigation buttons at bottom, same height as caption */
.lb-overlay .lb-prev,
.lb-overlay .lb-next {
  position: absolute;          /* fix to viewport */
  bottom: 1.5rem;           /* always above bottom */
  width: auto;
  height: auto;
  max-height: 2.5rem;
  padding: 0.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1000;            /* above overlay content */
}

.lb-overlay .lb-prev img,
.lb-overlay .lb-next img {
  display: block;
  height: 100%;
  width: auto;
}

.lb-overlay .lb-prev {
  left: 1rem;
}

.lb-overlay .lb-next {
  right: 1rem;
}

/* Caption pinned to bottom as well */
.lb-overlay .lb-caption {
  position: fixed;           /* pin to viewport */
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  max-width: 90%;
  text-align: center;
  z-index: 1001;             /* above buttons */
}
/* Adjust on smaller mobile screens */
@media (max-width: 768px) {
  .lb-overlay .lb-prev,
  .lb-overlay .lb-next {
    max-height: 2rem; 
  }
  .lb-overlay .lb-caption {
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
  }
}