/* Bootstrap Modal CSS - Fully Converted from SCSS with Modern Features */

/* ========================================
   MODAL COMPONENT
   ======================================== */

/* Container that the modal scrolls within */
.modal {
  /* CSS Custom Properties (Variables) */
  --bs-modal-zindex: 1055;
  --bs-modal-width: 500px;
  --bs-modal-padding: 1rem;
  --bs-modal-margin: 0.5rem;
  --bs-modal-color: #212529;
  --bs-modal-bg: #fff;
  --bs-modal-border-color: rgba(0, 0, 0, 0.175);
  --bs-modal-border-width: 1px;
  --bs-modal-border-radius: 0.375rem;
  --bs-modal-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --bs-modal-inner-border-radius: calc(0.375rem - 1px);
  --bs-modal-header-padding-x: 1rem;
  --bs-modal-header-padding-y: 1rem;
  --bs-modal-header-padding: 1rem 1rem;
  --bs-modal-header-border-color: rgba(0, 0, 0, 0.175);
  --bs-modal-header-border-width: 1px;
  --bs-modal-title-line-height: 1.5;
  --bs-modal-footer-gap: 0.5rem;
  --bs-modal-footer-bg: transparent;
  --bs-modal-footer-border-color: rgba(0, 0, 0, 0.175);
  --bs-modal-footer-border-width: 1px;

  /* Layout Properties */
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--bs-modal-zindex);
  display: none;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;

  /* Modern scrolling behavior */
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* Show state */
.modal.show {
  display: block;
}

/* Shell div to position the modal with bottom padding */
.modal-dialog {
  position: relative;
  width: auto;
  margin: var(--bs-modal-margin);
  pointer-events: none;

  /* Modern transform-origin for better animations */
  transform-origin: center center;
}

/* Fade animations with modern CSS */
.modal.fade .modal-dialog {
  transform: translate(0, -50px);
  transition: transform 0.3s ease-out;
}

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

/* Static modal animation (when backdrop is static) */
.modal.modal-static .modal-dialog {
  transform: scale(1.02);
  animation: modal-static-animation 0.3s ease-out;
}

@keyframes modal-static-animation {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

/* Scrollable modal */
.modal-dialog-scrollable {
  height: calc(100% - var(--bs-modal-margin) * 2);
}

.modal-dialog-scrollable .modal-content {
  max-height: 100%;
  overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
  /* Modern scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

/* Centered modal */
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - var(--bs-modal-margin) * 2);
}

/* Actual modal content */
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  color: var(--bs-modal-color);
  pointer-events: auto;
  background-color: var(--bs-modal-bg);
  background-clip: padding-box;
  border: var(--bs-modal-border-width) solid var(--bs-modal-border-color);
  border-radius: var(--bs-modal-border-radius);
  box-shadow: var(--bs-modal-box-shadow);
  outline: 0;

  /* Modern backdrop-filter for glass effect */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal backdrop */
.modal-backdrop {
  --bs-backdrop-zindex: 1050;
  --bs-backdrop-bg: #000;
  --bs-backdrop-opacity: 0.5;

  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--bs-backdrop-zindex);
  width: 100vw;
  height: 100vh;
  background-color: var(--bs-backdrop-bg);
  opacity: var(--bs-backdrop-opacity);

  /* Modern backdrop animation */
  transition: opacity 0.15s linear;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: var(--bs-backdrop-opacity);
}

/* Modal header */
.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  padding: var(--bs-modal-header-padding);
  border-bottom: var(--bs-modal-header-border-width) solid
    var(--bs-modal-header-border-color);
  border-top-left-radius: var(--bs-modal-inner-border-radius);
  border-top-right-radius: var(--bs-modal-inner-border-radius);

  /* Modern gap for spacing */
  gap: 1rem;
}

.modal-header .btn-close {
  padding: calc(var(--bs-modal-header-padding-y) * 0.5)
    calc(var(--bs-modal-header-padding-x) * 0.5);
  margin-top: calc(-0.5 * var(--bs-modal-header-padding-y));
  margin-right: calc(-0.5 * var(--bs-modal-header-padding-x));
  margin-bottom: calc(-0.5 * var(--bs-modal-header-padding-y));
  margin-left: auto;

  /* Modern focus styles */
  border: none;
  background: transparent;
  opacity: 0.5;
  transition: opacity 0.15s ease-in-out;
}

.modal-header .btn-close:hover,
.modal-header .btn-close:focus {
  opacity: 1;
}

/* Title text within header */
.modal-title {
  margin-bottom: 0;
  line-height: var(--bs-modal-title-line-height);
  font-weight: 500;
  flex-grow: 1;
}

/* Modal body */
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: var(--bs-modal-padding);
}

/* Footer for actions */
.modal-footer {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: calc(var(--bs-modal-padding) - var(--bs-modal-footer-gap) * 0.5);
  background-color: var(--bs-modal-footer-bg);
  border-top: var(--bs-modal-footer-border-width) solid
    var(--bs-modal-footer-border-color);
  border-bottom-left-radius: var(--bs-modal-inner-border-radius);
  border-bottom-right-radius: var(--bs-modal-inner-border-radius);

  /* Modern gap instead of margins */
  gap: var(--bs-modal-footer-gap);
}

/* Legacy support for margin-based spacing */
.modal-footer > * {
  margin: calc(var(--bs-modal-footer-gap) * 0.5);
}

/* ========================================
     RESPONSIVE BREAKPOINTS
     ======================================== */

/* Small and up (≥576px) */
@media (min-width: 576px) {
  .modal {
    --bs-modal-margin: 1.75rem;
    --bs-modal-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }

  .modal-dialog {
    max-width: var(--bs-modal-width);
    margin-right: auto;
    margin-left: auto;
  }

  .modal-sm {
    --bs-modal-width: 300px;
  }
}

/* Large and up (≥992px) */
@media (min-width: 992px) {
  .modal-lg,
  .modal-xl {
    --bs-modal-width: 800px;
  }
}

/* Extra large and up (≥1200px) */
@media (min-width: 1200px) {
  .modal-xl {
    --bs-modal-width: 1140px;
  }
}

/* ========================================
     FULLSCREEN MODALS
     ======================================== */

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

.modal-fullscreen .modal-content {
  height: 100%;
  border: 0;
  border-radius: 0;
}

.modal-fullscreen .modal-header,
.modal-fullscreen .modal-footer {
  border-radius: 0;
}

.modal-fullscreen .modal-body {
  overflow-y: auto;
}

/* Responsive fullscreen variants */
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-fullscreen-sm-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .modal-fullscreen-sm-down .modal-header,
  .modal-fullscreen-sm-down .modal-footer {
    border-radius: 0;
  }

  .modal-fullscreen-sm-down .modal-body {
    overflow-y: auto;
  }
}

@media (max-width: 767.98px) {
  .modal-fullscreen-md-down {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-fullscreen-md-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .modal-fullscreen-md-down .modal-header,
  .modal-fullscreen-md-down .modal-footer {
    border-radius: 0;
  }

  .modal-fullscreen-md-down .modal-body {
    overflow-y: auto;
  }
}

@media (max-width: 991.98px) {
  .modal-fullscreen-lg-down {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-fullscreen-lg-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .modal-fullscreen-lg-down .modal-header,
  .modal-fullscreen-lg-down .modal-footer {
    border-radius: 0;
  }

  .modal-fullscreen-lg-down .modal-body {
    overflow-y: auto;
  }
}

@media (max-width: 1199.98px) {
  .modal-fullscreen-xl-down {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-fullscreen-xl-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .modal-fullscreen-xl-down .modal-header,
  .modal-fullscreen-xl-down .modal-footer {
    border-radius: 0;
  }

  .modal-fullscreen-xl-down .modal-body {
    overflow-y: auto;
  }
}

@media (max-width: 1399.98px) {
  .modal-fullscreen-xxl-down {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-fullscreen-xxl-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .modal-fullscreen-xxl-down .modal-header,
  .modal-fullscreen-xxl-down .modal-footer {
    border-radius: 0;
  }

  .modal-fullscreen-xxl-down .modal-body {
    overflow-y: auto;
  }
}

/* ========================================
     MODERN ENHANCEMENTS
     ======================================== */

/* Improved accessibility */
.modal {
  /* Better focus management */
  focus-trap: true;
}

.modal[aria-hidden="true"] {
  display: none;
}

/* Dark theme support */
/* @media (prefers-color-scheme: dark) {
  .modal {
    --bs-modal-color: #fff;
    --bs-modal-bg: #212529;
    --bs-modal-border-color: rgba(255, 255, 255, 0.175);
    --bs-modal-header-border-color: rgba(255, 255, 255, 0.175);
    --bs-modal-footer-border-color: rgba(255, 255, 255, 0.175);
  }
} */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog {
    transition: none;
  }

  .modal-backdrop {
    transition: none;
  }

  .modal-static .modal-dialog {
    animation: none;
  }
}

/* Print styles */
@media print {
  .modal {
    display: none !important;
  }
}

.siu-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}
.siu-modal.show {
  display: flex;
}
.siu-modal-box {
  width: max-content;
  margin: auto;
  margin: auto;
  padding: 16px 24px;
  border-radius: 8px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--Base-Palette-Blue-Blue_950, #fcfeff);
  box-shadow: 0px 4px 4px 0px rgba(5, 56, 107, 0.24);
}

.siu-modal-box--xl {
    width: 1200px;
}
/* Modal Styles - Light Theme */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-index-modal);
  backdrop-filter: blur(2px);
}

.modal {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius-s);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: var(--spacing-m);
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: var(--border-radius-s) var(--border-radius-s) 0 0;
}

.modal-title {
  font-family: var(--font-family-title);
  font-weight: var(--font-weights-headers-h5);
  font-size: var(--font-size-headers-h5);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6c757d;
  padding: 4px 8px;
  border-radius: var(--border-radius-xs);
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: #e9ecef;
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-m);
}

.modal-footer {
  padding: var(--spacing-m);
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-s);
  background: #f8f9fa;
  border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
}

/* Supplier Modal Specific Styles */
.supplier-modal {
  min-width: 400px;
}

.supplier-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-s);
}

.supplier-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-s);
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius-xs);
  transition: var(--transition-fast);
}

.supplier-item:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.supplier-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.supplier-name {
  font-weight: var(--font-weights-body-bold);
  font-size: var(--font-size-body-default);
  color: var(--text-primary);
}

.supplier-details {
  font-size: var(--font-size-body-fine-print);
  color: #6c757d;
}

.supplier-price {
  font-weight: var(--font-weights-body-bold);
  font-size: var(--font-size-body-default);
  color: var(--brand-green);
}

.supplier-select-btn {
  background: var(--brand-green);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
  font-family: var(--font-family-body);
  font-weight: var(--font-weights-other-button);
  font-size: var(--font-size-body-fine-print);
  transition: var(--transition-fast);
}

.supplier-select-btn:hover {
  background: var(--brand-green-hover);
}

/* Animation */
.modal-overlay.fade-in {
  animation: fadeIn var(--transition-normal);
}

.modal.slide-in {
  animation: slideIn var(--transition-normal);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal {
    max-width: 95vw;
    margin: var(--spacing-s);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-s);
  }

  .supplier-modal {
    min-width: auto;
  }

  .supplier-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }
}

/* Focus Management */
.modal-overlay:focus-within .modal {
  outline: 2px solid var(--brand-green);
  outline-offset: -2px;
}


.siu-modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.siu-modal-close:hover,
.siu-modal-close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}