@import (reference) './variable.less';

@popupPrefix: ant-popup;

.@{popupPrefix} {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 998;
  touch-action: none;
  &-top-image {
    width: 100%;
  }
  &-mask {
    width: 100%;
    height: 100%;
    background-color: @popup-mask-product;
    .mask-appear();
    &.center {
      .mask-appear(300ms);
    }
    &-closing {
      .mask-close();
      &.center {
        .mask-close(300ms);
      }
    }
  }
  &-content {
    overflow: hidden;
    position: fixed;
    background: @popup-background;
    color: @popup-color;
    &-bg {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      background-size: cover;
      background-repeat: no-repeat;
    }
    &-header {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 114rpx;
      position: relative;
      &-title {
        font-family: 500;
        line-height: 50 * @rpx;
        font-size: 36 * @rpx;
        color: @popup-color;
        text-align: center;
      }
      &-icon {
        width: 48 * @rpx;
        height: 48 * @rpx;
        font-size: 42 * @rpx;
        position: absolute;
        top: 33 * @rpx;
        color: @popup-assit-color;
        display: flex;
        justify-content: center;
        align-items: center;
        &-back {
          left: 24 * @rpx;
        }
        &-close {
          right: 24 * @rpx;
        }
      }
    }
  }
  &-transform {
    &-top {
      top: 0;
      left: 0;
      right: 0;
      transform: translateY(-100%);
      .animation-transform(ant-popup-transform-top);
      border-radius: 0 0 @popup-radius @popup-radius;
      &-close {
        transform: translateY(0);
        .animation-transform-close(ant-popup-transform-top-close);
      }
    }
    &-right {
      top: 0;
      right: 0;
      bottom: 0;
      transform: translateX(100%);
      .animation-transform(ant-popup-transform-right);
      &-close {
        transform: translateX(0);
        .animation-transform-close(ant-popup-transform-right-close);
      }
    }
    &-bottom {
      left: 0;
      right: 0;
      bottom: 0;
      transform: translateY(100%);
      .animation-transform(ant-popup-transform-bottom);
      border-radius: @popup-radius @popup-radius 0 0;
      &-close {
        transform: translateY(0);
        .animation-transform(ant-popup-transform-bottom-close);
      }
    }
    &-left {
      top: 0;
      left: 0;
      bottom: 0;
      transform: translateX(-100%);
      .animation-transform(ant-popup-transform-left);
      &-close {
        transform: translateX(0);
        .animation-transform(ant-popup-transform-left-close);
      }
    }
    &-center {
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0) scale(0.6);
      opacity: 0;
      .animation-center();
      border-radius: @popup-radius;
      background: none;
      &-close {
        transform: translate3d(-50%, -50%, 0) scale(1);
        opacity: 1;
        .animation-center-close();
      }
    }
  }
  &-position {
    &-top {
      left: 0;
      right: 0;
      top: -100%;
      .animation-transform(ant-popup-position-top);
      border-radius: 0 0 @popup-radius @popup-radius;
      &-close {
        top: 0;
        .animation-transform(ant-popup-position-top-close);
      }
    }
    &-right {
      top: 0;
      bottom: 0;
      right: -100%;
      .animation-transform(ant-popup-position-right);
      &-close {
        right: 0;
        .animation-transform(ant-popup-position-right-close);
      }
    }
    &-bottom {
      left: 0;
      right: 0;
      bottom: -100%;
      .animation-transform(ant-popup-position-bottom);
      border-radius: @popup-radius @popup-radius 0 0;
      &-close {
        bottom: 0;
        .animation-transform(ant-popup-position-bottom-close);
      }
    }
    &-left {
      top: 0;
      bottom: 0;
      left: -100%;
      .animation-transform(ant-popup-position-left);
      &-close {
        left: 0;
        .animation-transform(ant-popup-position-left-close);
      }
    }
    &-center {
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0) scale(0.6);
      opacity: 0;
      .animation-position-center();
      border-radius: @popup-radius;
      background: none;
      &-close {
        transform: translate3d(-50%, -50%, 0) scale(1);
        opacity: 1;
        .animation-position-center-close();
      }
    }
  }
}

@keyframes ant-popup-transform-top {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes ant-popup-transform-bottom {
  0% {
    transform: translateY(100%);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes ant-popup-transform-left {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes ant-popup-transform-right {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes ant-popup-transform-center-scale {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(0.6);
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
}

@keyframes ant-popup-transform-center-opacity {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes ant-popup-transform-top-close {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100%);
  }
}

@keyframes ant-popup-transform-bottom-close {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(100%);
  }
}

@keyframes ant-popup-transform-left-close {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes ant-popup-transform-right-close {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes ant-popup-transform-center-close-scale {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(0.6);
  }
}

@keyframes ant-popup-transform-center-close-opacity {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes ant-popup-position-top {
  0% {
    top: -100%;
  }
  100% {
    top: 0;
  }
}

@keyframes ant-popup-position-bottom {
  0% {
    bottom: -100%;
  }
  100% {
    bottom: 0;
  }
}

@keyframes ant-popup-position-left {
  0% {
    left: -100%;
  }
  100% {
    left: 0;
  }
}

@keyframes ant-popup-position-right {
  0% {
    right: -100%;
  }
  100% {
    right: 0;
  }
}

@keyframes ant-popup-position-center-scale {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(0.6);
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
}

@keyframes ant-popup-position-center-opacity {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes ant-popup-position-top-close {
  0% {
    top: 0;
  }
  100% {
    top: -100%;
  }
}

@keyframes ant-popup-position-bottom-close {
  0% {
    bottom: 0;
  }
  100% {
    bottom: -100%;
  }
}

@keyframes ant-popup-position-left-close {
  0% {
    left: 0;
  }
  100% {
    left: -100%;
  }
}

@keyframes ant-popup-position-right-close {
  0% {
    right: 0;
  }
  100% {
    right: -100%;
  }
}

@keyframes ant-popup-position-center-close-scale {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(0.6);
  }
}

@keyframes ant-popup-position-center-close-opacity {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes ant-popup-mask-appear {
  0% {
    background-color: @popup-mask-close-bg;
  }
  100% {
    background-color: @popup-mask-product;
  }
}

@keyframes ant-popup-mask-close {
  0% {
    background-color: @popup-mask-product;
  }
  100% {
    background-color: @popup-mask-close-bg;
  }
}
