/* Scroll inside an open modal. The page lock hides the document scrollbar, so the body must scroll itself. */
.modal.show {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1080;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.modal.show .modal-dialog {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.modal.show .modal-content {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}

.modal.show .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* A centered dialog stays in the viewport. The tall spacer and full-height column otherwise pin it to the bottom. */
.modal.show:has(> .modal-dialog-centered) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.show > .modal-dialog.modal-dialog-centered:not(.modal-dialog-scrollable) {
  flex: 0 1 auto;
  height: auto;
  min-height: 0;
  max-height: calc(100% - 2rem);
  margin: 0 auto;
  overflow: visible;
  top: 50%;
  transform: translateY(-50%);
}

.modal.show > .modal-dialog.modal-dialog-centered:not(.modal-dialog-scrollable)::before {
  content: none;
}

.modal.show > .modal-dialog.modal-dialog-centered:not(.modal-dialog-scrollable) > .modal-content {
  flex: 0 1 auto;
  width: 100%;
  max-height: 100%;
}
