/* ============================================
   MODAL COMPONENT - CASCADE OF HOPE HMS
   ============================================ */

/* ============================================
   MODAL BACKDROP - STYLING ONLY
   ============================================ */

.modal-backdrop {
  background-color: var(--bg-overlay);
  backdrop-filter: blur(var(--blur-sm));
  animation: fadeIn var(--transition-fast);
}

.modal-backdrop.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================
   MODAL CONTAINER - STYLING ONLY
   ============================================ */

.modal-content {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.modal-dialog {
  animation: slideUp var(--transition-base) var(--ease-out);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(2rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   MODAL HEADER - STYLING ONLY
   ============================================ */

.modal-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.modal-close {
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================
   MODAL BODY - STYLING ONLY
   ============================================ */

.modal-body {
  color: var(--text-secondary);
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--neutral-400);
  border-radius: var(--radius-full);
}

/* Text elements in modal body */
.modal-body p {
  color: var(--text-secondary);
}

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4,
.modal-body h5,
.modal-body h6 {
  color: var(--text-primary);
}

.modal-body strong,
.modal-body b {
  color: var(--text-primary);
}

/* ============================================
   MODAL FOOTER - STYLING ONLY
   ============================================ */

.modal-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
}

/* ============================================
   MODAL VARIANTS - STYLING ONLY
   ============================================ */

/* Success Modal */
.modal-success .modal-header {
  background-color: var(--success-light);
  border-bottom-color: var(--success);
}

.modal-success .modal-title {
  color: var(--success-dark);
}

/* Danger Modal */
.modal-danger .modal-header {
  background-color: var(--danger-light);
  border-bottom-color: var(--danger);
}

.modal-danger .modal-title {
  color: var(--danger-dark);
}

/* Warning Modal */
.modal-warning .modal-header {
  background-color: var(--warning-light);
  border-bottom-color: var(--warning);
}

.modal-warning .modal-title {
  color: var(--warning-dark);
}

/* Info Modal */
.modal-info .modal-header {
  background-color: var(--info-light);
  border-bottom-color: var(--info);
}

.modal-info .modal-title {
  color: var(--info-dark);
}

/* ============================================
   CONFIRMATION MODAL ICON - STYLING ONLY
   ============================================ */

.modal-confirm-icon {
  border-radius: var(--radius-full);
}

.modal-confirm-icon.danger {
  background-color: var(--danger-light);
  color: var(--danger);
}

.modal-confirm-icon.warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.modal-confirm-icon.info {
  background-color: var(--info-light);
  color: var(--info);
}

.modal-confirm-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.modal-confirm-message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ============================================
   IMAGE/VIDEO MODAL - STYLING ONLY
   ============================================ */

.modal-media .modal-body {
  background-color: var(--neutral-900);
}

/* ============================================
   LOADING MODAL - STYLING ONLY
   ============================================ */

.modal-loading-spinner {
  border: 4px solid var(--neutral-300);
  border-top-color: var(--primary-500);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-loading-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* ============================================
   BOOTSTRAP CLOSE BUTTON - STYLING ONLY
   ============================================ */

.btn-close {
  background: transparent;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.btn-close:hover {
  opacity: 1;
}

/* ============================================
   FORM ELEMENTS IN MODALS - STYLING ONLY
   ============================================ */

.modal-body .form-label,
.modal-body label {
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

.modal-body .form-control,
.modal-body .form-select,
.modal-body input,
.modal-body select,
.modal-body textarea {
  background-color: var(--bg-primary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.modal-body .form-control:focus,
.modal-body .form-select:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  background-color: var(--bg-primary);
  border-color: var(--primary-500);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.modal-body .form-control::placeholder,
.modal-body input::placeholder,
.modal-body textarea::placeholder {
  color: var(--text-tertiary);
}

.modal-body .input-group-text {
  background-color: var(--bg-secondary);
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

/* Select dropdown options */
.modal-body select option {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* Disabled/readonly inputs */
.modal-body .form-control:disabled,
.modal-body .form-control[readonly],
.modal-body input:disabled,
.modal-body input[readonly] {
  background-color: var(--bg-secondary);
  border-color: var(--border-light);
  color: var(--text-tertiary);
  opacity: 0.6;
}

/* ============================================
   TABLES IN MODALS - STYLING ONLY
   ============================================ */

.modal-body .table {
  color: var(--text-secondary);
}

.modal-body .table thead {
  background-color: var(--bg-secondary);
}

.modal-body .table thead th {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.modal-body .table tbody td {
  border-color: var(--border-light);
}

.modal-body .table tbody tr:hover {
  background-color: var(--bg-secondary);
}

/* ============================================
   ALERTS IN MODALS - STYLING ONLY
   ============================================ */

.modal-body .alert {
  background-color: var(--bg-secondary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

/* ============================================
   DARK MODE SPECIFIC OVERRIDES
   ============================================ */

[data-theme="dark"] .modal-content {
  background-color: var(--bg-secondary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .modal-header {
  background-color: var(--bg-tertiary);
  border-bottom-color: var(--border-medium);
}

[data-theme="dark"] .modal-footer {
  background-color: var(--bg-tertiary);
  border-top-color: var(--border-medium);
}

[data-theme="dark"] .modal-title {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-body {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-close {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-close:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* Bootstrap close button in dark mode */
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Form elements in dark mode */
[data-theme="dark"] .modal-body .form-control,
[data-theme="dark"] .modal-body .form-select,
[data-theme="dark"] .modal-body input,
[data-theme="dark"] .modal-body select,
[data-theme="dark"] .modal-body textarea {
  background-color: var(--bg-tertiary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

[data-theme="dark"] .modal-body .form-control:focus,
[data-theme="dark"] .modal-body .form-select:focus,
[data-theme="dark"] .modal-body input:focus,
[data-theme="dark"] .modal-body select:focus,
[data-theme="dark"] .modal-body textarea:focus {
  background-color: var(--bg-tertiary);
  border-color: var(--primary-500);
}

[data-theme="dark"] .modal-body .input-group-text {
  background-color: var(--bg-elevated);
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

/* Confirmation icon backgrounds in dark mode */
[data-theme="dark"] .modal-confirm-icon.danger {
  background-color: rgba(255, 68, 68, 0.2);
  color: var(--danger);
}

[data-theme="dark"] .modal-confirm-icon.warning {
  background-color: rgba(255, 193, 7, 0.2);
  color: var(--warning);
}

[data-theme="dark"] .modal-confirm-icon.info {
  background-color: rgba(74, 144, 226, 0.2);
  color: var(--info);
}

/* Modal variant headers in dark mode */
[data-theme="dark"] .modal-success .modal-header {
  background-color: rgba(46, 204, 113, 0.15);
  border-bottom-color: var(--success);
}

[data-theme="dark"] .modal-success .modal-title {
  color: var(--success);
}

[data-theme="dark"] .modal-danger .modal-header {
  background-color: rgba(255, 68, 68, 0.15);
  border-bottom-color: var(--danger);
}

[data-theme="dark"] .modal-danger .modal-title {
  color: var(--danger);
}

[data-theme="dark"] .modal-warning .modal-header {
  background-color: rgba(255, 193, 7, 0.15);
  border-bottom-color: var(--warning);
}

[data-theme="dark"] .modal-warning .modal-title {
  color: var(--warning);
}

[data-theme="dark"] .modal-info .modal-header {
  background-color: rgba(74, 144, 226, 0.15);
  border-bottom-color: var(--info);
}

[data-theme="dark"] .modal-info .modal-title {
  color: var(--info);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.modal-close:focus-visible,
.btn-close:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .modal-backdrop,
  .modal {
    display: none !important;
  }
}