/* ==========================================================================
   POPUP MODAL - MODERN GLASSMORPHISM STYLE
   ========================================================================== */

:root {
  --popup-z-index: 9999;
}

/* Overlay Gelap dengan Glassmorphism Blur */
#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65); /* Modern Slate Dark Tone */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: calc(var(--popup-z-index) - 1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              visibility 0.8s cubic-bezier(0.16, 1, 0.3, 1); /* Diperlambat dari 0.4s ke 0.8s */
}

#popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Container Popup Box */
#popup-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: var(--popup-z-index);
  max-width: 400px; /* Disesuaikan agar ukuran popup ideal dan tidak terlalu besar */
  max-height: 50vh;
  padding: 0;
  background: transparent;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.8s ease, 
              visibility 0.8s ease; /* Diperlambat dari 0.3s ke 0.8s agar lajunya pelan & mulus */
  will-change: transform, opacity;
            display: flex;
            justify-content: center;
            align-items: center;
}

#popup-box.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Frame & Elemen Gambar */
#popup-box img {
  display: block;
  max-width: 100%;
  max-height: 70vh; /* Ukuran tinggi gambar disesuaikan agar pas di layar */
  border-radius: 12px;
  object-fit: contain;
  cursor: pointer;
  border: none !important; /* Bingkai/border putih DIHILANGKAN total */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#popup-box img:hover {
  transform: scale(1.01);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Responsive Optimization */
@media (max-width: 576px) {
  #popup-box {
    max-width: 90%;
  }
  #popup-box img {
    max-height: 65vh;
  }
}