/**
 * Modal fixes for compatibility with Divi, Elementor and other theme editors
 */

/* Custom backdrop for our modals */
.modal-backdrop-ppc3d {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000000;
  background-color: rgba(0, 0, 0, 0.5);
}

/* Ensure our modals are above everything else */
.ppc3d-modal-active {
  z-index: 2000001 !important;
}

/* Modal dialog positioning */
.ppc3d-modal-active .modal-dialog {
  margin: 1.75rem auto;
  max-width: 90%;
}

@media (min-width: 576px) {
  .ppc3d-modal-active .modal-dialog {
    max-width: 500px;
  }
  
  .ppc3d-modal-active .modal-dialog.modal-lg {
    max-width: 800px;
  }
  
  .ppc3d-modal-active .modal-dialog.modal-xl {
    max-width: 1140px;
  }
}

/* Fade animation for backdrop */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Ensure modal content is visible */
.ppc3d-modal-active .modal-content {
  position: relative;
  background-color: #fff;
  border-radius: 0.3rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  outline: 0;
}

/* Fix for Divi's z-index issues */
body.et-db #et-boc .et-l .ppc3d-modal-active,
body.et-db #et-boc .et-l .modal-backdrop-ppc3d {
  z-index: 2000001 !important;
}

/* Fix for Elementor's z-index issues */
body.elementor-page .ppc3d-modal-active,
body.elementor-page .modal-backdrop-ppc3d {
  z-index: 2000001 !important;
}

/* Ensure modal buttons are clickable */
.ppc3d-modal-active .modal-content button,
.ppc3d-modal-active .modal-content .btn {
  position: relative;
  z-index: 2000002;
}

/* Fix for modal close button */
.ppc3d-modal-active .close {
  position: absolute;
  right: 15px;
  top: 15px;
  z-index: 2000003;
  cursor: pointer;
}
