/* Modal Components */
/* Reusable modal styles and animations */

/* --- Modal Enhancements --- */
.modal-content {
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: none;
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 1.5rem;
}

/* --- Modal Sizes --- */
.modal-sm .modal-content {
  max-width: 400px;
}

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

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

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

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

/* --- Modal Fade Animation --- */
.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  transform: scale(0.95) translateY(-20px);
  opacity: 0;
}

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

/* --- Modal Scrollable Body --- */
.modal-body-scrollable {
  max-height: 60vh;
  overflow-y: auto;
}

/* --- Modal with Tabs --- */
.modal-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0 1.5rem;
  margin-bottom: 1rem;
}

.modal-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1rem;
  color: var(--bs-secondary);
  transition: all 0.2s ease;
}

.modal-tabs .nav-link:hover {
  color: var(--bs-primary);
  border-bottom-color: rgba(13, 110, 253, 0.3);
}

.modal-tabs .nav-link.active {
  color: var(--bs-primary);
  border-bottom-color: var(--bs-primary);
  font-weight: 500;
}

/* --- Modal Loading State --- */
.modal-loading {
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-loading::after {
  content: '';
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--bs-primary);
  border-radius: 50%;
  animation: modal-spinner 0.8s linear infinite;
}

@keyframes modal-spinner {
  to { transform: rotate(360deg); }
}

/* --- Confirmation Modal Variants --- */
.modal-confirm-danger .modal-header {
  background-color: rgba(220, 53, 69, 0.1);
  border-bottom-color: rgba(220, 53, 69, 0.3);
}

.modal-confirm-danger .modal-title {
  color: var(--bs-danger);
}

.modal-confirm-warning .modal-header {
  background-color: rgba(255, 193, 7, 0.1);
  border-bottom-color: rgba(255, 193, 7, 0.3);
}

.modal-confirm-warning .modal-title {
  color: var(--bs-warning);
}

/* --- Side Modal (Drawer Style) --- */
.modal-side .modal-dialog {
  position: fixed;
  margin: 0;
  width: 400px;
  max-width: 90vw;
  height: 100%;
  right: 0;
  top: 0;
}

.modal-side .modal-content {
  height: 100%;
  border-radius: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-side.fade .modal-dialog {
  transform: translateX(100%);
}

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

/* --- Full Screen Modal on Mobile --- */
@media (max-width: 576px) {
  .modal-fullscreen-sm-down {
    padding: 0 !important;
  }
  
  .modal-fullscreen-sm-down .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100%;
  }
  
  .modal-fullscreen-sm-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }
}

/* --- Modal Close Button Enhancement --- */
.modal-header .btn-close {
  margin: -0.5rem -0.5rem -0.5rem auto;
  padding: 0.5rem;
}

.modal-header .btn-close:focus {
  box-shadow: none;
  opacity: 0.75;
}

/* --- Modal Icon --- */
.modal-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.modal-icon-success {
  background-color: rgba(25, 135, 84, 0.1);
  color: var(--bs-success);
}

.modal-icon-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--bs-danger);
}

.modal-icon-warning {
  background-color: rgba(255, 193, 7, 0.1);
  color: var(--bs-warning);
}

.modal-icon-info {
  background-color: rgba(13, 202, 240, 0.1);
  color: var(--bs-info);
}

/* --- Modal Overlay Blur (for modern browsers) --- */
@supports (backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px)) {
  .modal-backdrop-blur {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.3) !important;
  }
}
