%header-icon {
  margin: 0 2px;
  border: 0;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .5s ease;
  cursor: pointer;
}

%header-icon-hover {
  background: #eeeeee;
}

.modal {
  width: 98%;
  height: 98%;
  position: fixed;
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: $white;
  border-radius: 5px;
  overflow: hidden;
  z-index: 999;
  display: none;
  grid-template-rows: 64px auto 52px;
  @include mq($from: tablet) {
    max-width: 700px;
    max-height: 500px;
  }

  &--show {
    display: grid;
  }

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

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

  &--full-screen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }

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

    &--simple {
      border: 0;
    }

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

  &__title {
    font-size: 1rem;
    font-weight: $font-semi-bold;
    letter-spacing: $x-small-space;
    @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;

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

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

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

    &::-webkit-scrollbar-thumb {
      border-radius: 5px;
      background-color: rgba(0, 0, 0, .2);
      -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .2);
    }
    @include mq($from: tablet) {
      padding: 20px 40px;
    }
  }

  &__footer {
    height: 52px;
    padding: 0 10px;
    display: flex;
    background-color: $grey-lightest;
    border-top: 1px solid darken($grey-lightest, 3%);
    align-items: center;
    justify-content: flex-end;

    &--simple {
      border: 0;
      padding: 0 30px;
    }

    &--alert {
      border: 0;
      padding: 0 30px;
    }
  }

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

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

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