.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0; /* sama dengan top:0; right:0; bottom:0; left:0 */
}

/* Overlay background hitam khusus modal */
.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* Konten gambar */
.modal-content {
  position: relative;
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  z-index: 2;
  animation: zoomIn 0.3s ease;
}

/* Tombol close */
.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 3;
}

/* Animasi zoom in saat buka */
@keyframes zoomIn {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Animasi shrink saat tutup */
@keyframes shrinkOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.8);
    opacity: 0;
  }
}

/* Saat modal aktif */
.modal.show .modal-overlay {
  opacity: 1;
}

.modal.close .modal-content {
  animation: shrinkOut 0.3s ease forwards;
}

/* Tombol next dan prev */
.prev,
.next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  z-index: 3;
  user-select: none;
  transition: background-color 0.3s;
}

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

.prev {
  left: 20px;
}

.next {
  right: 20px;
}

.modal-content {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.slide-left {
  transform: translateX(100%);
  opacity: 0;
}

.slide-right {
  transform: translateX(-100%);
  opacity: 0;
}
