:root {
  --van-popup-background: var(--van-background-2);
  --van-popup-transition: transform var(--van-duration-base);
  --van-popup-round-radius: 16px;
  --van-popup-close-icon-size: 22px;
  --van-popup-close-icon-color: var(--van-gray-5);
  --van-popup-close-icon-margin: 16px;
  --van-popup-close-icon-z-index: 1;
}

.van {
  &-overflow-hidden {
    overflow: hidden !important;
  }

  &-popup {
    position: fixed;
    max-height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--van-popup-background);
    transition: var(--van-popup-transition);
    -webkit-overflow-scrolling: touch;

    &--center {
      top: 50%;
      left: 0;
      right: 0;
      width: fit-content;
      max-width: calc(100vw - var(--van-padding-md) * 2);
      margin: 0 auto;
      transform: translateY(-50%);

      &.van-popup--round {
        border-radius: var(--van-popup-round-radius);
      }
    }

    &--top {
      top: 0;
      left: 0;
      width: 100%;

      &.van-popup--round {
        border-radius: 0 0 var(--van-popup-round-radius)
          var(--van-popup-round-radius);
      }
    }

    &--right {
      top: 50%;
      right: 0;
      transform: translate3d(0, -50%, 0);

      &.van-popup--round {
        border-radius: var(--van-popup-round-radius) 0 0
          var(--van-popup-round-radius);
      }
    }

    &--bottom {
      bottom: 0;
      left: 0;
      width: 100%;

      &.van-popup--round {
        border-radius: var(--van-popup-round-radius)
          var(--van-popup-round-radius) 0 0;
      }
    }

    &--left {
      top: 50%;
      left: 0;
      transform: translate3d(0, -50%, 0);

      &.van-popup--round {
        border-radius: 0 var(--van-popup-round-radius)
          var(--van-popup-round-radius) 0;
      }
    }

    &-slide-top-enter-active,
    &-slide-left-enter-active,
    &-slide-right-enter-active,
    &-slide-bottom-enter-active {
      transition-timing-function: var(--van-ease-out);
    }

    &-slide-top-leave-active,
    &-slide-left-leave-active,
    &-slide-right-leave-active,
    &-slide-bottom-leave-active {
      transition-timing-function: var(--van-ease-in);
    }

    &-slide-top-enter-from,
    &-slide-top-leave-active {
      transform: translate3d(0, -100%, 0);
    }

    &-slide-right-enter-from,
    &-slide-right-leave-active {
      transform: translate3d(100%, -50%, 0);
    }

    &-slide-bottom-enter-from,
    &-slide-bottom-leave-active {
      transform: translate3d(0, 100%, 0);
    }

    &-slide-left-enter-from,
    &-slide-left-leave-active {
      transform: translate3d(-100%, -50%, 0);
    }

    &__close-icon {
      position: absolute;
      z-index: var(--van-popup-close-icon-z-index);
      color: var(--van-popup-close-icon-color);
      font-size: var(--van-popup-close-icon-size);

      &--top-left {
        top: var(--van-popup-close-icon-margin);
        left: var(--van-popup-close-icon-margin);
      }

      &--top-right {
        top: var(--van-popup-close-icon-margin);
        right: var(--van-popup-close-icon-margin);
      }

      &--bottom-left {
        bottom: var(--van-popup-close-icon-margin);
        left: var(--van-popup-close-icon-margin);
      }

      &--bottom-right {
        right: var(--van-popup-close-icon-margin);
        bottom: var(--van-popup-close-icon-margin);
      }
    }
  }
}
