// Modals
.modal {
  align-items: center;
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  opacity: 0;
  overflow: hidden;
  padding: $layout-spacing;
  position: fixed;
  right: 0;
  top: 0;

  &:target,
  &.active {
    display: flex;
    opacity: 1;
    z-index: $zindex-4;

    .modal-overlay {
      @include useTheme('background', 'background-overlay', 'modals');
      width: 100%;
      bottom: 0;
      cursor: default;
      display: block;
      left: 0;
      position: absolute;
      right: 0;
      top: 0;
    }

    .modal-container {
      animation: slide-down .2s ease 1;
      z-index: $zindex-0;
    }
  }
  .modal-title {
    margin-bottom: 0;
  }

  &.modal-sm {
    .modal-container {
      max-width: $control-width-sm;
    }
  }

  &.modal-lg {
    .modal-overlay {
      @include useTheme('background', 'background-overlay', 'modals');
    }

    .modal-container {
      max-width: $control-width-lg;
    }
  }
}

.modal-container {
  @include shadow-variant(.2rem);
  @include useTheme('background', 'background-panel');
  border-radius: $border-radius;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  max-width: $control-width-md;
  padding: 0 $unit-8;
  width: 100%;

  &.modal-fullheight {
    max-height: 100vh;
  }

  .modal-header {
    border-bottom: 1px solid;
    padding: $unit-6 $unit-8;
    margin: 0 (-$unit-8);
    @include useTheme('color', 'text-color');
    @include useTheme('border-color', 'border-color');
  }

  .modal-body {
    overflow-y: auto;
    padding: $unit-6 $unit-8 $unit-8;
    margin: 0 (-$unit-8);
    position: relative;
  }

  .modal-footer {
    border-top: 1px solid;
    padding: $unit-6 $unit-8;
    text-align: center;
    margin: 0 (-$unit-8);
    background: rgba(230, 230, 230, 0.12);
    @include useTheme('border-color', 'border-color');
  }
}
