body.wpbm-modal-open {
  overflow: hidden;
}

.wpbm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wpbm-modal {
  background: #fff;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 6px;
  position: relative;
  padding: 0 0 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.wpbm-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  z-index: 2;
}

.wpbm-modal-body img,
.wpbm-modal-body video {
  max-width: 100%;
  height: auto;
}

.wpbm-modal-loading,
.wpbm-modal-error {
  text-align: center;
  padding: 40px 20px;
}

/* Se in futuro vuoi nascondere il bottone "Back" dentro la popup
   (dato che porta a un link vero e ti farebbe uscire dal popup),
   decommenta la riga qui sotto e aggiorna il selettore con quello
   reale del tuo tema. */
/* .wpbm-modal-body #pa-back-button { display: none !important; } */

@media (max-width: 600px) {
  .wpbm-modal {
    max-height: 95vh;
  }
}