@import '~scss/variables';
@import '~scss/mixins';

:global {
  .ReactModal {
    &__Body--open {
      overflow: hidden;
    }

    &__Overlay {
      text-align: center;
      white-space: nowrap;
      opacity: 0;

      &::before {
        content: '';
        display: inline-block;
        height: 100%;
        vertical-align: middle;
        width: 0;
      }

      &--after-open {
        opacity: 1;
        transition: opacity 0.2s;
      }

      &--before-close {
        opacity: 0;
      }
    }

    &__Content {
      white-space: normal;
      opacity: 0;

      &--after-open {
        opacity: 1;
        transition: opacity 0.1s;
      }

      &--before-close {
        opacity: 0;
      }
    }
  }
}

.modal {
  display: inline-block;
  position: relative;
  top: 0;
  width: 744px;
  text-align: left;
  border-radius: 4px;
  background-color: $white;
  box-shadow: 0 4px 8px 0 rgba(72, 91, 127, 0.2);
  vertical-align: middle;
  outline: none;
}

.header {
  position: relative;
  padding: 10px 40px 10px 20px;
  color: $title-color;
  border-radius: 4px 4px 0 0;
  border-bottom: 1px solid $border-color;
  background-color: $lightest;
  font-size: $size-normal;
  z-index: 1;

  @at-root {
    .description {
      h3 {
        line-height: 1.67;
        font-size: 12px;
        font-weight: 600;
        color: $dark-color07;
      }
      small {
        display: block;
        line-height: 1.67;
        font-weight: normal;
        font-size: 12px;
        color: $dark-color01;
      }
    }
  }

  .title {
    display: flex;
    align-items: center;
    min-height: 40px;

    :global .icon {
      margin-right: 12px;
    }
  }

  .close {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    cursor: pointer;
    border-radius: 4px;
    padding: 3px !important;
    :global {
      .icon {
        width: 24px;
        height: 24px;
      }
    }
  }

  & ~ .body {
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
  }
}

.body {
  padding: 20px;
  border-radius: 4px;
  max-height: calc(100vh - 158px);
  overflow-y: auto;
}

.footer,
.formFooter {
  padding: 16px 20px;
  border-radius: 0 0 4px 4px;
  background-color: $lightest;
  text-align: right;

  button {
    margin-left: 10px;
    &:first-of-type {
      margin-left: 0;
    }
  }

  & ~ .body {
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
  }
}

.formBody {
  padding: 0;
  max-height: none;
  overflow-y: hidden;
}

.formWrapper {
  max-height: calc(100vh - 180px);
  padding: 20px;
  overflow: auto;
}

.formFooter {
  background-color: $bg-color;
}

.fullscreen {
  position: relative;
  margin: 0;
  width: calc(100vw - 40px);
  height: calc(100vh - 40px);

  & > :global(.spin-nested-loading) {
    display: flex;
    width: 100%;
    height: 100%;
  }

  .body {
    position: absolute;
    left: 0;
    right: 0;
    top: 60px;
    bottom: 60px;
    overflow: hidden;
  }

  .footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
  }
}

.rightScreen {
  position: absolute;
  margin: 0;
  right: 0;
  bottom: 0;
  top: 0;
  max-width: 1070px;
  min-width: 800px;
  width: 80%;
  border-radius: 0;
  height: auto;

  .header {
    position: relative;
    height: 144px;
    color: $title-color;
    border-radius: 4px 4px 0 0;
    border-bottom: 1px solid $border-color;
    background-color: $bg-color;
    font-size: $size-normal;
    z-index: 1;

    .description {
      h3 {
        margin-bottom: 8px;
        line-height: 32px;
        font-size: 24px;
        font-weight: bold;
        color: $title-color;
      }
      small {
        display: block;
        margin-right: 60px;
        line-height: 20px;
        font-weight: normal;
        font-size: 12px;
        color: $second-text-color;
      }
    }

    .title {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      line-height: 24px;
      font-weight: $font-bold;
      align-items: center;
      text-align: left;

      :global .icon {
        margin-right: 12px;
        flex-shrink: 0;
        align-self: center;
      }
    }

    .image {
      display: inline-block;
      width: 48px;
      height: 48px;
      line-height: 48px;
      margin-right: 12px;
    }
  }

  .iconBg {
    position: absolute;
    right: 0;
    top: 0;
    width: 200px;
    height: 200px;
    line-height: 144px;
    opacity: 0.1;
    mix-blend-mode: multiply;
  }

  .body {
    position: absolute;
    left: 0;
    right: 0;
    top: 144px;
    z-index: 2;
    bottom: 60px;
    overflow: auto;
  }

  .footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: $bg-color;
  }
}
