/* The content block stays hidden until the script moves it into the overlay. */
#popupWidget { display: none; }

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* The modal box itself (your #popupWidget once it's inside the overlay). */
.popup-overlay #popupWidget {
  display: block;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 32px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s ease;
}
.popup-overlay.is-open #popupWidget {
  transform: none;
}

.popup-close {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box !important;
  width: 40px !important;
  height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 50% !important;
  background: #fff;
  color: #333;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  /* Neutralize theme button hover effects that would resize/move the button
     and make it flicker. Only the background may change. */
  transform: none !important;
  transition: background 0.15s ease !important;
  -webkit-appearance: none;
  appearance: none;
}

.popup-close:hover,
.popup-close:focus {
  top: 18px !important;
  background: #f1f1f1;
  transform: none !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  outline: none;
}

/* Stops the page behind from scrolling while the popup is open. */
body.popup-open { overflow: hidden; }
