/* ============================================================
   GLOBAL MODAL STYLING - Applied to all modals in the app
   ============================================================ */

/* 1. MODAL CONTAINER - Centered positioning */
.modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1050 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

/* 2. MODAL DIALOG - Centered and responsive sizing */
.modal-dialog {
  position: relative !important;
  margin: auto !important;
  max-height: calc(100vh - 40px) !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

/* Desktop: 70-80% width */
@media (min-width: 1024px) {
  .modal-dialog {
    max-width: 75% !important;
  }
}

/* Tablet: 90% width */
@media (min-width: 768px) and (max-width: 1023px) {
  .modal-dialog {
    max-width: 90% !important;
  }
}

/* Mobile: 95% width */
@media (max-width: 767px) {
  .modal-dialog {
    max-width: 95% !important;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .modal-dialog {
    max-width: 100% !important;
    padding: 10px !important;
  }

  .modal {
    padding: 10px !important;
  }
}

/* 3. MODAL CONTENT - Full height with flexbox */
.modal-content {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  max-height: calc(100vh - 40px) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  border: none !important;
  background: #ffffff !important;
}

/* 4. MODAL HEADER - Fixed at top */
.modal-header {
  flex-shrink: 0 !important;
  padding: 20px 24px !important;
  border-bottom: 1px solid #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  /* background: #EF233C;; */
  border-radius: 12px 12px 0 0 !important;
}

.modal-header .modal-title {
  margin: 0 !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  /* color: #1f2937 !important; */
}

.modal-header .btn-close {
  flex-shrink: 0 !important;
  margin: 0 -8px 0 auto !important;
  padding: 8px !important;
  color: #6b7280 !important;
  opacity: 0.6 !important;
  transition: opacity 0.2s ease !important;
}

.modal-header .btn-close:hover {
  opacity: 1 !important;
}

/* 5. MODAL BODY - Scrollable content area */
.modal-body {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 24px !important;
  color: #1f2937 !important;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
  width: 8px !important;
}

.modal-body::-webkit-scrollbar-track {
  background: #f3f4f6 !important;
  border-radius: 4px !important;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #d1d5db !important;
  border-radius: 4px !important;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af !important;
}

/* 6. MODAL FOOTER - Fixed at bottom */
.modal-footer {
  flex-shrink: 0 !important;
  padding: 16px 24px !important;
  border-top: 1px solid #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  background: #f9fafb !important;
  border-radius: 0 0 12px 12px !important;
}

/* 7. MODAL BACKDROP - Full coverage white overlay */
.modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: #ffffff !important;
  z-index: 1039 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-backdrop.fade {
  opacity: 0 !important;
  transition: opacity 0.3s ease !important;
  pointer-events: none !important;
}

.modal-backdrop.show {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* 8. MODAL STATE - Show/Hide */
.modal.fade {
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.modal.show {
  opacity: 1 !important;
  visibility: visible !important;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease !important;
  transform: scale(0.95) !important;
}

.modal.show .modal-dialog {
  transform: scale(1) !important;
}

/* 9. MODAL-DIALOG-SCROLLABLE - Custom scrollable variant */
.modal-dialog-scrollable {
  display: flex !important;
  flex-direction: column !important;
  max-height: calc(100vh - 40px) !important;
}

.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 40px) !important;
}

/* 10. MODAL SIZES */
/* Small modal */
.modal-dialog.modal-sm {
  max-width: 300px !important;
}

/* Large modal */
.modal-dialog.modal-lg {
  max-width: 80% !important;
}

@media (max-width: 1023px) {
  .modal-dialog.modal-lg {
    max-width: 90% !important;
  }
}

@media (max-width: 767px) {
  .modal-dialog.modal-lg {
    max-width: 95% !important;
  }
}

/* Extra large modal */
.modal-dialog.modal-xl {
  max-width: 90% !important;
}

@media (max-width: 1023px) {
  .modal-dialog.modal-xl {
    max-width: 95% !important;
  }
}

@media (max-width: 767px) {
  .modal-dialog.modal-xl {
    max-width: 100% !important;
  }
}

/* 11. MODAL BUTTONS - Consistent styling */
.modal-footer .btn {
  min-width: 100px !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
}

.modal-footer .btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.modal-footer .btn-primary {
  background: #dc3545 !important;
  border-color: #dc3545 !important;
  color: #ffffff !important;
}

.modal-footer .btn-primary:hover {
  background: #bd2130 !important;
  border-color: #bd2130 !important;
}

.modal-footer .btn-secondary {
  background: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
}

.modal-footer .btn-secondary:hover {
  background: #5a6268 !important;
  border-color: #5a6268 !important;
}

/* 12. REMOVE DEFAULT BOOTSTRAP MODAL BEHAVIORS */
.modal.fade.show {
  opacity: 1 !important;
}

/* Prevent page scroll when modal is shown */
body.modal-open {
  overflow: hidden !important;
  padding-right: 0 !important;
}

/* 13. UTILITY: Modal always visible and centered */
.modal-always-show {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 14. PRINT STYLES - Hide modals when printing */
@media print {

  .modal,
  .modal-backdrop {
    display: none !important;
  }
}

/* 15. HIGH CONTRAST MODE - Accessibility */
@media (prefers-contrast: more) {
  .modal-backdrop {
    background: rgba(0, 0, 0, 0.95) !important;
  }

  .modal-content {
    border: 2px solid #1f2937 !important;
  }
}

/* 16. REDUCED MOTION - Accessibility */
@media (prefers-reduced-motion: reduce) {

  .modal.fade,
  .modal-backdrop.fade,
  .modal-footer .btn {
    transition: none !important;
  }

  .modal.fade .modal-dialog {
    transform: none !important;
  }
}