body.no-scroll {
  overflow: hidden;
}

img {
  cursor: pointer;
}

.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  overflow: hidden;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox.show {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  margin-bottom: 10px;
  transition: transform 0.3s ease, transform-origin 0.3s ease; /* Add transition for smooth zooming and origin change */
}

.lightbox .caption {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(50, 50, 50, 0.8);
  color: #d3d3d3;
  font-size: 16px;
  text-align: center;
  padding: 10px;
  width: auto;
  max-width: 90%;
  word-wrap: break-word;
  border-radius: 5px;
}

.lightbox .close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.lightbox .close:hover,
.lightbox .close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

.nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav .prev,
.nav .next {
  cursor: pointer;
  font-size: 40px;
  color: white;
  padding: 16px;
  margin-top: -22px;
  user-select: none;
}

.nav .prev:hover,
.nav .next:hover {
  color: #ccc;
}

.controls-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
}

.controls {
  display: none;
  flex-direction: row;
  background-color: rgba(50, 50, 50, 0.8);
  padding: 5px;
  border-radius: 5px;
  align-items: center;
  margin-right: 10px;
}

.controls span,
.controls input,
.controls button,
.controls label {
  margin-left: 5px;
  color: #d3d3d3;
}

.controls input {
  width: 50px;
}

.controls button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

.controls button:hover {
  color: #bbb;
}

.overlay {
  position: relative;
}

.overlay sup {
  position: absolute;
  top: -0.5em;
  right: -0.5em;
  font-size: 0.5em;
  color: #d3d3d3;
}

.nested-controls {
  display: none;
  flex-direction: row;
  background-color: rgba(50, 50, 50, 0.8);
  padding: 5px;
  border-radius: 5px;
  margin-top: 10px;
  position: absolute;
  bottom: 60px;
  right: 20px;
  justify-content: center;
}

.menu-button {
  background-color: rgba(50, 50, 50, 0.8);
  border: none;
  color: #d3d3d3;
  font-size: 24px;
  border-radius: 5px;
  cursor: pointer;
  padding: 10px;
}

.menu-button:hover {
  color: #bbb;
}

/* Media query to adjust toolbar icon spacing for smaller screens */
@media (max-width: 480px) {
  .controls span,
  .controls input,
  .controls button,
  .controls label {
    margin-left: 2px;
  }

  .controls input {
    width: 40px;
  }

  .controls button {
    font-size: 16px;
  }
}
