/* Z-Index Hierarchy Management */
/* Đảm bảo thứ tự hiển thị: SweetAlert2 (cao nhất) > Popup > Navbar (thấp nhất) */

/* 1. Navbar - Z-Index thấp nhất */
.tab-bar,
#fixed-menu,
.navbar {
    z-index: 1000 !important;
}

/* 2. Loading overlay */
.loading {
    z-index: 2000 !important;
}

/* 3. Popups và Modals - Z-Index trung bình */
.modal,
.popup,
[class*="modal"],
[id*="modal"],
[id*="Modal"] {
    z-index: 9000 !important;
}

/* Specific modals */
#editUserModal,
#resetMilestonesModal,
#addUserModal,
#addMilestoneModal,
#editMilestoneModal,
#addXuModal,
#addGiftcodeModal,
#editGiftcodeModal {
    z-index: 9000 !important;
}

/* Gacha popup */
.gacha-popup,
.gacha-modal {
    z-index: 9500 !important;
}

/* 4. SweetAlert2 - Z-Index cao nhất */
.swal2-container {
    z-index: 10000 !important;
}

.swal2-popup {
    z-index: 10001 !important;
}

.swal2-backdrop-show {
    z-index: 9999 !important;
}

/* Override SweetAlert2 default styles */
div.swal2-container {
    z-index: 10000 !important;
}

div.swal2-container.swal2-backdrop-show {
    z-index: 10000 !important;
}

div.swal2-container .swal2-popup {
    z-index: 10001 !important;
}

/* 5. Tooltips và Dropdowns */
.tooltip,
.dropdown-menu,
[class*="tooltip"],
[class*="dropdown"] {
    z-index: 8000 !important;
}

/* 6. Fixed elements khác */
.fixed-button,
.floating-button {
    z-index: 1500 !important;
}

/* Đảm bảo overlay của popup không che SweetAlert2 */
.modal-overlay,
.popup-overlay,
[class*="overlay"] {
    z-index: 8999 !important;
}

/* Specific cho các popup trong admin */
.admin-modal {
    z-index: 9000 !important;
}

.admin-modal .modal-overlay {
    z-index: 8999 !important;
}

/* Đảm bảo content bên trong popup có z-index phù hợp */
.modal-content,
.popup-content {
    position: relative;
    z-index: 1;
}

/* Fix cho các element có thể bị che */
.form-control:focus,
.input:focus,
select:focus,
textarea:focus {
    z-index: 1 !important;
    position: relative;
}
