.nut-popup {
  position: fixed;
  min-height: 26%;
  max-height: 100%;
  background-color: $overlay-content-bg-color;
  -webkit-overflow-scrolling: touch;
  font-size: $font-size-base;

  &-title {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border-bottom: $popup-title-border-bottom;
    padding: $popup-title-padding;
    position: relative;

    &-wrapper {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    &-title {
      color: $color-title;
      font-weight: $font-weight-bold;
      font-size: $popup-title-font-size;
    }

    &-description {
      color: $color-text;
      font-size: $popup-description-font-size;
      font-weight: $font-weight;
      &-gap {
        margin-top: $popup-description-spacing;
      }
    }

    &-left {
      position: absolute;
      top: $popup-title-padding;
      left: $popup-title-padding;
    }

    &-right {
      position: absolute;
      top: $popup-title-padding;
      right: $popup-title-padding;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1;
      width: $popup-icon-size;
      height: $popup-icon-size;
      color: $color-title;
      cursor: pointer;

      &:active {
        opacity: 0.7;
      }

      &-top-left {
        top: $popup-title-padding;
        left: $popup-title-padding;
      }

      &-bottom-left {
        bottom: $popup-title-padding;
        left: $popup-title-padding;
      }

      &-bottom-right {
        right: $popup-title-padding;
        bottom: $popup-title-padding;
      }
    }
  }

  &-center {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    min-height: 10%;
    max-width: scale-px(295px);
    transform: translate(-50%, -50%);

    &.nut-popup-round {
      border-radius: $popup-border-radius;
    }
  }

  &-bottom {
    bottom: 0;
    left: 0;
    right: auto;
    top: auto;
    width: 100%;

    &.nut-popup-round {
      border-radius: $popup-border-radius $popup-border-radius 0 0;
    }

    &-top {
      position: absolute;
    }
  }

  &-right {
    top: 0;
    right: 0;
    left: auto;
    bottom: auto;
    width: scale-px(100px);
    height: 100%;

    &.nut-popup-round {
      border-radius: $popup-border-radius 0 0 $popup-border-radius;
    }
  }

  &-left {
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: scale-px(100px);
    height: 100%;

    &.nut-popup-round {
      border-radius: 0 $popup-border-radius $popup-border-radius 0;
    }
  }

  &-top {
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: 100%;

    &.nut-popup-round {
      border-radius: 0 0 $popup-border-radius $popup-border-radius;
    }
  }

  &-slide {
    @keyframes popup-scale-fade-in {
      from {
        opacity: 0;
        transform: scale(0.8);
      }
      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    @keyframes popup-scale-fade-out {
      from {
        opacity: 1;
        transform: scale(1);
      }
      to {
        opacity: 0;
        transform: scale(0.8);
      }
    }

    &-none-enter-active {
      animation-fill-mode: both;
      animation-name: popup-scale-fade-in;
      animation-duration: $popup-animation-duration;
    }

    &-none-exit-active {
      animation-fill-mode: both;
      animation-name: popup-scale-fade-out;
      animation-duration: $popup-animation-duration;
    }

    @keyframes popup-fade-in {
      from {
        opacity: 0;
      }
      to {
        opacity: 1;
      }
    }

    @keyframes popup-fade-out {
      from {
        opacity: 1;
      }
      to {
        opacity: 0;
      }
    }

    &-center-enter-active {
      animation-fill-mode: both;
      animation-name: popup-fade-in;
      animation-duration: $popup-animation-duration;
    }

    &-center-exit-active {
      animation-fill-mode: both;
      animation-name: popup-fade-out;
      animation-duration: $popup-animation-duration;
    }

    /* 从顶部滑出 */
    @keyframes popup-slide-top-enter {
      from {
        transform: translate3d(0, -100%, 0);
      }
      to {
        transform: translate3d(0, 0%, 0);
      }
    }

    @keyframes popup-slide-top-exit {
      from {
        transform: translate3d(0, 0%, 0);
      }
      to {
        transform: translate3d(0, -100%, 0);
      }
    }

    &-top-enter-active,
    &-top-appear-active {
      transform: translate3d(0, 0%, 0);
      animation-fill-mode: both;
      animation-name: popup-slide-top-enter;
      animation-duration: $popup-animation-duration;
    }

    &-top-exit-active {
      animation-fill-mode: both;
      animation-name: popup-slide-top-exit;
      animation-duration: $popup-animation-duration;
    }

    /* 从右侧滑出 */
    @keyframes popup-slide-right-enter {
      from {
        transform: translate3d(100%, 0, 0);
      }
      to {
        transform: translate3d(0%, 0, 0);
      }
    }

    @keyframes popup-slide-right-exit {
      from {
        transform: translate3d(0%, 0, 0);
      }
      to {
        transform: translate3d(100%, 0, 0);
      }
    }

    &-right-enter-active,
    &-right-appear-active {
      transform: translate3d(0, 0, 0);
      animation-fill-mode: both;
      animation-name: popup-slide-right-enter;
      animation-duration: $popup-animation-duration;
    }

    &-right-exit {
      animation-fill-mode: both;
      animation-name: popup-slide-right-exit;
      animation-duration: $popup-animation-duration;
    }

    /* 从底部滑出 */
    @keyframes popup-slide-bottom-enter {
      from {
        transform: translate3d(0, 100%, 0);
      }
      to {
        transform: translate3d(0, 0%, 0);
      }
    }

    @keyframes slide-bottom-exit {
      from {
        transform: translate3d(0, 0%, 0);
      }
      to {
        transform: translate3d(0, 100%, 0);
      }
    }

    &-bottom-enter-active,
    &-bottom-appear-active {
      transform: translate(0, 0);
      animation-fill-mode: both;
      animation-name: popup-slide-bottom-enter;
      animation-duration: $popup-animation-duration;
    }

    &-bottom-exit {
      animation-fill-mode: both;
      animation-name: slide-bottom-exit;
      animation-duration: $popup-animation-duration;
    }

    /* 从左侧滑出 */
    @keyframes popup-slide-left-enter {
      from {
        transform: translate3d(-100%, 0, 0);
      }
      to {
        transform: translate3d(0%, 0, 0);
      }
    }

    @keyframes popup-slide-left-exit {
      from {
        transform: translate3d(0%, 0, 0);
      }
      to {
        transform: translate3d(-100%, 0, 0);
      }
    }

    &-left-enter-active,
    &-left-appear-active {
      transform: translate(0, 0);
      animation-fill-mode: both;
      animation-name: popup-slide-left-enter;
      animation-duration: $popup-animation-duration;
    }

    &-left-exit-active,
    &-left-exit-done {
      animation-fill-mode: both;
      animation-name: popup-slide-left-exit;
      animation-duration: $popup-animation-duration;
    }

    &-none-exit-done,
    &-center-exit-done,
    &-left-exit-done,
    &-right-exit-done,
    &-top-exit-done,
    &-bottom-exit-done {
      &.nut-popup {
        display: none;
      }
    }
  }

  .nut-overflow-hidden {
    overflow: hidden;
  }
}

[dir='rtl'] .nut-popup,
.nut-rtl .nut-popup {
  &-title {
    &-left {
      left: auto;
      right: $popup-title-padding;
    }

    &-right {
      right: auto;
      left: $popup-title-padding;

      &-top-left {
        left: auto;
        right: $popup-title-padding;
      }

      &-bottom-left {
        left: auto;
        right: $popup-title-padding;
      }

      &-bottom-right {
        right: auto;
        left: $popup-title-padding;
      }
    }

    .nut-icon-ArrowLeft {
      transform: rotate(180deg);
    }
  }

  &-center {
    left: auto;
    right: 50%;
    transform: translate(50%, -50%);
  }

  &-bottom {
    left: auto;
    right: 0;
  }

  &-top {
    left: auto;
    right: 0;
  }
}
