/* ===== Modal Fixes ===== */

/* ===== Layout - Prevent horizontal scrolling ===== */
html,
body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

.dashboard-main-wrapper,
.dashboard-main-wrapper .main-content,
.dashboard-content,
.dashboard-ecommerce,
.main-content,
.container-fluid {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

nav.navbar.fixed-top {
    max-width: 100vw !important;
    overflow: hidden !important;
}

nav.navbar.fixed-top>.container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 15px !important;
}

/* Only table-responsive should have horizontal scroll */
.table-responsive {
    overflow-x: auto !important;
}

/* Footer - fixed at bottom full width */
.footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 14px 30px !important;
    background-color: #fff !important;
    border-top: 1px solid #e5e7eb !important;
    z-index: 1040 !important; /* Above sidebar (1030) */
}

/* Ensure body or main wrapper has space at the bottom so content isn't hidden behind footer */
body, .dashboard-main-wrapper {
    padding-bottom: 60px !important;
}

/* Flex layout to keep footer at the bottom of short pages */
.dashboard-ecommerce,
.dashboard-main-wrapper .main-content {
    display: flex !important;
    flex-direction: column !important;
}

.dashboard-ecommerce .main-content {
    flex: 1 !important;
}

/* ===== Z-index hierarchy ===== */
.nav-left-sidebar {
    z-index: 1030 !important;
}

.navbar.fixed-top {
    z-index: 1035 !important;
}

/* Force modal to be full-screen overlay when shown */
.modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    overflow-y: auto !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    padding: 1rem !important;
}

/* Modal dialog sizing */
.modal.show .modal-dialog {
    position: relative !important;
    width: 100% !important;
    max-width: 500px !important;
    margin: auto !important;
    pointer-events: none !important;
}

.modal.show .modal-dialog.modal-lg {
    max-width: 800px !important;
}

.modal.show .modal-dialog.modal-xl {
    max-width: 1140px !important;
}

/* Modal content clickable and styled */
.modal.show .modal-content {
    pointer-events: auto !important;
    position: relative !important;
    background-color: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    border: none !important;
}

/* Hide Bootstrap's separate backdrop since we use .modal background */
.modal-backdrop {
    display: none !important;
}

/* Body scroll lock */
body.modal-open {
    overflow: hidden !important;
}

/* Select2 above modal */
.select2-container--open {
    z-index: 99999 !important;
}

.select2-dropdown {
    z-index: 99999 !important;
}

/* Datepicker above modal */
.datepicker {
    z-index: 99999 !important;
}

/* Dismiss buttons */
[data-dismiss="modal"],
[data-bs-dismiss="modal"] {
    cursor: pointer;
}