/* Modal Styles */

.modal-content {
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 1rem 1.5rem;
}

.modal-header .modal-title {
  font-weight: 600;
  color: #212529;
}

.modal-header .btn-close {
  padding: 0.5rem;
  margin: -0.5rem -0.5rem -0.5rem auto;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 0.5rem 0.5rem;
  padding: 1rem 1.5rem;
}

/* Modal sizes */
.modal-sm {
  max-width: 300px;
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1140px;
}

.modal-fullscreen {
  width: 100vw;
  max-width: none;
  height: 100%;
  margin: 0;
}

/* Modal backdrop */
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Modal animations */
.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translateY(-50px);
}

.modal.show .modal-dialog {
  transform: translateY(0);
}

/* Confirmation modals */
.modal-confirm .modal-header {
  background-color: #fff3cd;
  border-bottom-color: #ffc107;
}

.modal-danger .modal-header {
  background-color: #f8d7da;
  border-bottom-color: #dc3545;
}

.modal-success .modal-header {
  background-color: #d1e7dd;
  border-bottom-color: #198754;
}

.modal-info .modal-header {
  background-color: #cff4fc;
  border-bottom-color: #0dcaf0;
}

/* Form modals */
.modal-body .form-group {
  margin-bottom: 1rem;
}

.modal-body .form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Loading state in modals */
.modal-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.modal-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3rem;
  height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  border: 0.25rem solid #f3f3f3;
  border-top: 0.25rem solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Scrollable modals */
.modal-body-scroll {
  max-height: 60vh;
  overflow-y: auto;
}

/* Modal with tabs */
.modal-body .nav-tabs {
  margin-bottom: 1rem;
  border-bottom: 2px solid #dee2e6;
}

.modal-body .nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: #6c757d;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.modal-body .nav-tabs .nav-link:hover {
  border-bottom-color: #0d6efd;
  color: #0d6efd;
}

.modal-body .nav-tabs .nav-link.active {
  border-bottom-color: #0d6efd;
  color: #0d6efd;
  background-color: transparent;
}

/* Dark mode support (respect app theme toggle, not OS preference) */
[data-bs-theme="dark"] .modal-content {
  background-color: #212529;
  color: #f8f9fa;
  border-color: #495057;
}

[data-bs-theme="dark"] .modal-header {
  background-color: #2c3035;
  border-bottom-color: #495057;
}

[data-bs-theme="dark"] .modal-header .modal-title {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .modal-footer {
  background-color: #2c3035;
  border-top-color: #495057;
}

[data-bs-theme="dark"] .modal-confirm .modal-header {
  background-color: #3e3006;
  border-bottom-color: #d39e00;
}

[data-bs-theme="dark"] .modal-confirm .modal-header .modal-title {
  color: #ffc107;
}

[data-bs-theme="dark"] .modal-danger .modal-header {
  background-color: #4c1d22;
  border-bottom-color: #b02a37;
}

[data-bs-theme="dark"] .modal-danger .modal-header .modal-title {
  color: #dc3545;
}

[data-bs-theme="dark"] .modal-success .modal-header {
  background-color: #0f5132;
  border-bottom-color: #198754;
}

[data-bs-theme="dark"] .modal-success .modal-header .modal-title {
  color: #d1e7dd;
}

[data-bs-theme="dark"] .modal-info .modal-header {
  background-color: #055160;
  border-bottom-color: #0dcaf0;
}

[data-bs-theme="dark"] .modal-info .modal-header .modal-title {
  color: #cff4fc;
}

[data-bs-theme="dark"] .modal-body .form-control,
[data-bs-theme="dark"] .modal-body .form-select {
  background-color: #2c3035;
  border-color: #495057;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .modal-body .form-control:focus,
[data-bs-theme="dark"] .modal-body .form-select:focus {
  background-color: #2c3035;
  border-color: #86b7fe;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .modal-body .nav-tabs .nav-link {
  color: #adb5bd;
}

[data-bs-theme="dark"] .modal-body .nav-tabs .nav-link.active {
  color: #0d6efd;
  background-color: transparent;
  border-bottom-color: #0d6efd;
}

[data-bs-theme="light"] .modal-content {
  background-color: #ffffff !important;
  color: #1f2a37 !important;
  border: 1px solid rgba(17, 24, 39, 0.08) !important;
}

[data-bs-theme="light"] .modal-header {
  background-color: #f8f9fa !important;
  border-bottom: 1px solid #dee2e6 !important;
  color: #212529 !important;
}

[data-bs-theme="light"] .modal-header .modal-title {
  color: #212529 !important;
}

[data-bs-theme="light"] .modal-header .btn-close {
  filter: none !important;
}

[data-bs-theme="light"] .modal-footer {
  background-color: #f8f9fa !important;
  border-top: 1px solid #dee2e6 !important;
  color: #212529 !important;
}

[data-bs-theme="light"] .modal-body .form-control,
[data-bs-theme="light"] .modal-body .form-select,
[data-bs-theme="light"] .modal-body textarea.form-control {
  background-color: #ffffff !important;
  border-color: #ced4da !important;
  color: #212529 !important;
}

[data-bs-theme="light"] .modal-body .form-control:focus,
[data-bs-theme="light"] .modal-body .form-select:focus,
[data-bs-theme="light"] .modal-body textarea.form-control:focus {
  background-color: #ffffff !important;
  border-color: #86b7fe !important;
  color: #212529 !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .modal-body .text-muted,
[data-bs-theme="light"] .modal-body small {
  color: #6c757d !important;
}

/* SweetAlert overrides */
[data-bs-theme="dark"] .swal2-popup,
[data-bs-theme="dark"] .swal-dark-mode {
    background: #08151d !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-content,
[data-bs-theme="dark"] .swal2-html-container,
[data-bs-theme="dark"] .swal-dark-mode-title,
[data-bs-theme="dark"] .swal-dark-mode-content {
      color: #ffffff !important;
}
