.ui-backdrop {
  @include position(fixed, 0);
  background: rgba(black, .75);
  padding: $spacer;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  z-index: 10000;

  &::after {
    height: $spacer;
    display: block;
    content: "";
    width: 1px;
    flex: 0 0 auto;
  }
}

$dialog-margin: 2rem;
$dialog-sizes: (
        medium: 480px,
        small: 320px,
        large: 640px,
)
;

.ui-modal {
  padding: $dialog-margin;
  background: white;
  margin: auto;
  box-shadow: rgba(black, .7) 0 1px 3px;
  border-radius: 1px;
  box-sizing: content-box;

  &.ui-modal--slim {
    padding: $dialog-margin / 2;
  }

  @each $size, $width in $dialog-sizes {
    &.ui-modal--#{$size} {
      width: $width;
    }
  }
}

.ui-modal__close {
  margin-right: -$dialog-margin;
  padding: $dialog-margin $dialog-margin 0;
  margin-top: -$dialog-margin;
}

.ui-modal__header {
  flex: 1 1 auto;
}

.ui-modal__title {
  font-weight: bold;
  font-size: 0.875rem;
}

.ui-modal__top-bar {
  display: flex;
  margin-bottom: $dialog-margin * 0.75;
}

@include media-breakpoint-down('sm') {
  .ui-dialog {
    padding: $dialog-margin / 2;
  }

  @each $size, $width in $dialog-sizes {
    .ui-modal.ui-modal--#{$size} {
      width: 100%;
      box-sizing: border-box;
    }
  }
}
