/* Modal Fix - Ensure modals are always interactive and on top */

/* Remove any inert attributes that may have been set */
[inert] {
  pointer-events: auto !important;
}

/* Ensure modal has proper z-index hierarchy */
.modal.show {
  z-index: 1050 !important;
  pointer-events: auto !important;
}

.modal-dialog {
  z-index: 1051 !important;
  pointer-events: auto !important;
  position: relative;
}

.modal-content {
  z-index: 1052 !important;
  pointer-events: auto !important;
  position: relative;
}

.modal-header {
  z-index: 1053 !important;
  pointer-events: auto !important;
  position: relative;
}

.modal-body {
  z-index: 1052 !important;
  pointer-events: auto !important;
  position: relative;
}

/* Ensure all interactive elements in modal are clickable */
.modal input,
.modal button,
.modal select,
.modal textarea,
.modal a,
.modal .btn,
.modal .btn-close,
.modal .form-control,
.modal .modal-close-btn {
  pointer-events: auto !important;
  position: relative;
  z-index: 1054 !important;
}

/* Ensure close button is always clickable */
.modal .btn-close,
.modal .modal-close-btn,
.modal button[aria-label="Close"],
.modal button[aria-label="Close modal"] {
  pointer-events: auto !important;
  z-index: 10000 !important;
  position: absolute !important;
  cursor: pointer !important;
}

/* Prevent modal backdrop from blocking modal content */
.modal.show::before {
  pointer-events: none !important;
}

/* Ensure modal is above any page-wraper */
.page-wraper {
  position: relative;
  z-index: 1 !important;
}

/* Modal should be sibling to page-wraper or child, but always on top */
#sign_up_popup,
#sign_up_popup2,
.modal {
  position: fixed !important;
  z-index: 1050 !important;
}

/* Override any inert styling that might be applied */
.page-wraper[inert],
.page-wraper[inert] *,
.page-content[inert],
.page-content[inert] *,
main[inert],
main[inert] * {
  pointer-events: auto !important;
}

/* But the modals should ALWAYS be interactive */
.modal[inert],
.modal[inert] *,
#sign_up_popup[inert],
#sign_up_popup[inert] *,
#sign_up_popup2[inert],
#sign_up_popup2[inert] * {
  pointer-events: auto !important;
}

/* Ensure form elements in modals are always interactive */
.modal .form-group,
.modal .form-group * {
  pointer-events: auto !important;
}

/* Modal backdrop should not interfere */
.modal-backdrop {
  z-index: 1049 !important;
  pointer-events: none !important;
}

/* Fix for when body has modal-open class */
body.modal-open .modal {
  pointer-events: auto !important;
}

body.modal-open .modal * {
  pointer-events: auto !important;
}
