/* Modal Fix CSS - Updated to fix pointer events */

/* Reset Bootstrap default modal z-index */
.modal-backdrop {
    z-index: 9000 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgb(0 0 0 / 0%) !important;
    opacity: 0.5 !important;
    pointer-events: none !important; /* Critical - allows clicks to pass through */
}

/* Make sure the modal itself is clickable */
.modal {
    z-index: 9500 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    outline: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: none;
    pointer-events: none !important; /* Allow clicks through modal to dialog */
}

.modal.show {
    display: block !important;
    pointer-events: none !important; /* Allow clicks through modal to dialog */
}

/* Ensure dialog is clickable */
.modal-dialog {
    z-index: 9600 !important;
    position: relative !important;
    pointer-events: auto !important; /* Must be auto to catch clicks */
    margin: 1.75rem auto !important;
    max-width: 500px !important;
    width: auto !important;
    /* Bootstrap's own .modal-dialog-centered trick, applied globally so
       every modal on the site is vertically centered without needing that
       class added to each modal's markup individually. Without this, the
       dialog just sits margin-top:1.75rem from the top of the (full-height)
       overlay — never actually centered. */
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 3.5rem) !important;
}

/* Ensure content is clickable */
.modal-content {
    position: relative !important;
    pointer-events: auto !important; /* Must be auto to catch clicks */
    background-color: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 0.3rem !important;
    outline: 0 !important;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5) !important;
}

/* Modal header needs to be clickable */
.modal-header {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 9650 !important;
}

/* Modal footer needs to be clickable */
.modal-footer {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 9650 !important;
}

/* Modal body needs to be clickable */
.modal-body {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 9650 !important;
}

/* Fix for specific modals seen in screenshots */
#cancelOrderModal, 
#confirmDeleteModal, 
#orderConfirmationModal, 
.bootstrap-dialog, 
.modal {
    z-index: 9500 !important;
}

/* Prevent any elements from appearing above modal backdrop */
html.modal-open {
    overflow: hidden !important;
}

body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Reset z-index for other components when modal is open */
body.modal-open .navbar,
body.modal-open .dropdown-menu,
body.modal-open .position-fixed,
body.modal-open .fixed-top,
body.modal-open .fixed-bottom,
body.modal-open .sticky-top,
body.modal-open canvas,
body.modal-open .tradingview-widget-container,
body.modal-open .tradingview-widget-container iframe {
    z-index: auto !important;
}

/* Fix for modal fade transition */
.fade {
    transition: opacity 0.15s linear !important;
}

.fade:not(.show) {
    opacity: 0 !important;
}

/* Fix for dialog positioning */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out !important;
    transform: translate(0, -50px) !important;
}

.modal.show .modal-dialog {
    transform: none !important;
}

/* Additional media query for mobile */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
        min-height: calc(100% - 1rem) !important;
    }
}

/* Ensure modal buttons are clickable */
.modal-footer .btn, 
.modal-header .btn-close,
.modal-content button,
.modal button,
.modal a,
.modal input,
.modal select,
.modal textarea {
    position: relative !important;
    z-index: 9700 !important;
    pointer-events: auto !important;
} 