@keyframes show {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes hide {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(0);
  }
}

.modal {
  width: 98%;
  height: 98%;
  position: fixed;
  top: 1%;
  right: 1%;
  bottom: 1%;
  left: 1%;
  background-color: $white;
  display: none;
  border-radius: 5px;
  overflow: hidden;
  z-index: 9999;
  grid-template-rows: 64px auto 60px;
  @include mq($from: tablet) {
    max-width: 800px;
    max-height: 600px;
    top: calc((100% - 600px) / 2);
    left: calc((100% - 800px) / 2);
  }

  &--show {
    display: grid;
    animation: show 0.2s linear;
  }

  &--wide {
    @include mq($from: tablet) {
      max-width: 960px;
      max-height: 600px;
    }
  }

  &--simple {
    @include mq($from: tablet) {
      max-width: 600px;
      max-height: 400px;
    }
  }

  &--upload {
    grid-template-rows: 64px auto;
  }

  &--alert {
    max-width: 280px;
    height: auto;
    grid-template-rows: 0 auto 52px;
    margin: 0 auto;
    max-height: 300px;
  }

  &--full-screen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    right: 0;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 0;
  }
  &--search {
    border: 5px solid $primary-color;
    grid-template-rows: 64px auto;
    color: $nearly-black;
  }

  &__header {
    height: 64px;
    padding: 0 20px 0 30px;
    background-color: $white;
    color: $nearly-black;
    border-bottom: 1px solid $grey-light;
    display: flex;
    align-items: center;
    justify-content: space-between;

    &--simple {
      border: 0;
    }

    &--upload {
      border: 0;
    }

    &--alert {
      border: 0;
      height: 0;
    }
  }

  &__title {
    font-size: 1rem;
    font-weight: $font-semi-bold;
    letter-spacing: $x-small-space;
    text-align: left;
    @include mq($from: phablet) {
      font-size: 1.313rem;
    }
  }

  &__close {
    @extend %header-icon;

    &:hover {
      @extend %header-icon-hover;
    }
  }

  &__content {
    padding: 30px;
    text-align: left;
    overflow-y: auto;
    @include mq($from: tablet) {
      padding: 40px;
    }

    &--wide {
      padding: 10px;
      @include mq($from: tablet) {
        padding: 20px;
      }
    }

    &--simple {
      overflow-y: hidden;
      padding: 10px 30px;
    }

    &--alert {
      max-height: 300px;
      overflow-y: scroll;
      padding: 20px;

      & p {
        font-size: 0.875rem;
      }
    }

    &--upload {
      overflow: visible;
      padding-top: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    &--search {
      padding: 20px 0;
      background-color: lighten($blue-grey-50, 5%);
    }

    &::-webkit-scrollbar {
      -webkit-appearance: none;
      width: 8px;
    }

    &::-webkit-scrollbar-thumb {
      border-radius: 5px;
      background-color: rgba(0, 0, 0, 0.2);
      -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.2);
    }
  }

  &__footer {
    height: 60px;
    padding: 0 10px;
    display: flex;
    background-color: $grey-100;
    align-items: center;
    justify-content: flex-end;

    &--alert {
      padding: 0 10px;
      background: none;
    }
  }

  &__button {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;

    & .button:nth-child(n + 2) {
      margin-left: 10px;
    }
  }
}

.overlay {
  background-color: rgba(0, 0, 0, 0.6);
  position: fixed;
  z-index: 998;
  top: -5000px;
  right: -5000px;
  bottom: -5000px;
  left: -5000px;
}

.file-upload-modal {
  & > .modal__content {
    padding: 0;

    .page-header.page-header--sticky {
      z-index: 200;
    }
  }
}
