/* Minimal, scoped Bootstrap for React-Bootstrap Modal + Button + a few utilities (Option 2) */
/* Utilities (scoped by ancestor .rb on the same element) */
.rb.d-flex {
  display: flex !important;
}
.rb.align-items-start {
  align-items: flex-start !important;
}
.rb.justify-content-center {
  justify-content: center !important;
}
.rb.position-relative {
  position: relative !important;
}
.rb.mt-3 {
  margin-top: 1rem !important;
}

/* Buttons (apply when inside an element with class .rb or the button itself has .rb) */
.rb .btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition:
    color 0.15s ease-in-out,
    background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
  background-color: transparent;
  color: #212529;
}
.rb .btn:disabled,
.rb .btn.disabled {
  pointer-events: none;
  opacity: 0.65;
}
.rb .btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.rb .btn-primary {
  color: #fff;
  background-color: #e3530f;
  border-color: #e3530f;
}
.rb .btn-primary:hover {
  color: #fff;
  background-color: #e3530f;
  border-color: #e3530f;
}
.rb .btn-primary:active,
.rb .btn-primary.active {
  color: #fff;
  background-color: #e3530f;
  border-color: #e3530f;
}
.rb .btn-primary:disabled,
.rb .btn-primary.disabled {
  color: #fff;
  background-color: #e3530f;
  border-color: #e3530f;
}

/* Close (X) button used in modal header */
.rb .btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em 0.25em;
  color: #000;
  background: transparent;
  border: 0;
  opacity: 0.5;
}
.rb .btn-close:hover {
  opacity: 0.75;
}
.rb .btn-close:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.rb .btn-close::before {
  content: "\00D7";
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  color: currentColor;
}

/* Modal root is the element having both .rb and .modal */
.rb.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1055;
  display: none;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}
.rb.modal.show {
  display: block;
}
.rb.modal .modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
  max-width: 500px;
}
/* .rb.modal .modal-70w,
.rb.modal .modal-dialog.modal-70w {
  max-width: 70vw;
} */
@media (min-width: 576px) {
  .rb.modal .modal-dialog {
    margin: 1.75rem auto;
  }
}
.rb.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -10px);
}
.rb.modal.show .modal-dialog {
  transform: none;
}
.rb.modal .modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}
@media (min-width: 576px) {
  .rb.modal .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
}
.rb.modal .modal-dialog-scrollable {
  height: calc(100% - 1rem);
}
@media (min-width: 576px) {
  .rb.modal .modal-dialog-scrollable {
    height: calc(100% - 3.5rem);
  }
}
.rb.modal .modal-dialog-scrollable .modal-content {
  max-height: 100%;
  overflow: hidden;
}
.rb.modal .modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}

/* Modal content */
.rb.modal .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: rgb(249, 225, 206);
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.175);
  border-radius: 0.5rem;
  outline: 0;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  color: rgb(148, 41, 46);
}
.rb.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}
.rb.modal .modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
}
.rb.modal .modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1rem;
}
.rb.modal .modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom-right-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
}

/* Backdrop (class is placed directly on the backdrop element) */
.modal-backdrop.rb {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  width: 100vw;
  height: 100vh;
  background-color: #000;
}
.fade {
  transition: opacity 0.15s linear;
}
.modal-backdrop.rb.fade {
  opacity: 0;
}
.modal-backdrop.rb.show {
  opacity: 0.5;
}

/* Prevent background scrolling when modal is open (safe global) */
body.modal-open {
  overflow: hidden;
}

/* --- Mobile centering fixes for scoped React-Bootstrap modal (.rb.modal) --- */

/* 1) Ensure the dialog is horizontally centered and has auto side margins on narrow screens */
@media (max-width: 575.98px) {
  .rb.modal .modal-dialog {
    margin: 0.5rem auto;
  } /* center horizontally */
}

/* 2) Stronger vertical centering on mobile:
   - Use full-height container
   - Center children with flex
*/
@media (max-width: 575.98px) {
  .rb.modal {
    display: flex;
    align-items: center;
    min-height: 100vh;
  }
  .rb.modal .modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: 100vh; /* full viewport height */
  }
}

/* 3) Allow scrollable content to not push dialog off-screen */
@media (max-width: 575.98px) {
  .rb.modal .modal-dialog {
    max-width: calc(100% - 1rem);
  } /* keep side gutters */
  .rb.modal .modal-content {
    max-height: 90vh;
    overflow: auto;
  } /* keep within viewport and scroll */
}

/* 4) iOS Safari dynamic toolbar quirks: use -webkit-fill-available when possible */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 575.98px) {
    .rb.modal {
      min-height: -webkit-fill-available;
    }
    .rb.modal .modal-dialog-centered {
      min-height: -webkit-fill-available;
    }
  }
}

/* 5) If you have very tall content, keep body locked but let modal scroll */
@media (max-width: 575.98px) {
  .rb.modal .modal-dialog-scrollable {
    height: auto;
  }
  .rb.modal .modal-dialog-scrollable .modal-content {
    max-height: 90vh;
  }
  .rb.modal .modal-dialog-scrollable .modal-body {
    overflow-y: auto;
  }
}
