/**
 * ====================================================================
 * UNIVERSAL MODAL CSS FIX
 * Global styles to fix modal z-index issues across the platform
 * ====================================================================
 */

/* ====================================================================
   UNIVERSAL MODAL FIX - Applies to ALL modals in the platform
   This ensures all modal windows appear above backdrop layers
   ==================================================================== */

.modal {
    z-index: 999999 !important;
    position: fixed !important;
}

.modal.show,
.modal.fade.show,
.modal.in {
    z-index: 999999 !important;
    position: fixed !important;
}

.modal .modal-dialog {
    z-index: 1000000 !important;
    position: relative !important;
}

.modal-backdrop {
    z-index: 999998 !important;
    position: fixed !important;
}

body.modal-open {
    overflow: hidden !important;
}

/* Ensure all modal content is clickable */
.modal * {
    pointer-events: auto !important;
}

/* Fix for nested modals (modal inside modal) */
.modal.show~.modal.show {
    z-index: 1000009 !important;
}

.modal.show~.modal.show~.modal-backdrop {
    z-index: 1000008 !important;
}

/* Ensure modal content wrapper is properly positioned */
.modal-content {
    position: relative !important;
    z-index: inherit !important;
}

/* Fix for modals opened via AJAX */
.modal[aria-hidden="false"] {
    z-index: 999999 !important;
}

/* Responsive fixes for mobile */
@media (max-width: 768px) {
    .modal {
        padding-right: 0 !important;
    }

    .modal-dialog {
        margin: 10px !important;
    }
}

/* Fix for modals with animations */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out !important;
}

/* Ensure backdrop doesn't block modal */
.modal-backdrop.show {
    opacity: 0.5 !important;
}

/* Fix for fullscreen modals */
.modal-fullscreen {
    z-index: 999999 !important;
}

.modal-fullscreen .modal-dialog {
    z-index: 1000000 !important;
}