.nut-popover {
  position: absolute;
  display: inline-block;
  word-break: normal;

  &-arrow {
    position: absolute;
    width: scale-px(8px);
    height: scale-px(4px);

    .nut-icon-ArrowRadius {
      position: absolute;
      color: $popover-content-background-color;
      width: scale-px(8px);
      height: scale-px(4px);
    }

    &-top {
      bottom: scale-px(-4px);
    }

    &-bottom {
      top: scale-px(-4px);
    }

    &-left {
      right: scale-px(-6px);
      transform-origin: center top;

      &.nut-popover-arrow-left {
        top: 50%;
        transform: rotate(90deg) translateY(-50%);
      }

      &.nut-popover-arrow-left-top {
        top: scale-px(16px);
        right: scale-px(-8px);
        transform: rotate(90deg) translateY(0%);
      }

      &.nut-popover-arrow-left-bottom {
        top: auto;
        bottom: scale-px(16px);
        right: scale-px(-8px);
        transform: rotate(90deg) translateY(0%);
      }
    }

    &-right {
      transform-origin: center top;
      &.nut-popover-arrow-right {
        top: 50%;
        left: scale-px(-6px);
        transform: rotate(-90deg) translateY(-50%);
      }

      &.nut-popover-arrow-right-top {
        top: scale-px(16px);
        left: scale-px(-8px);
        transform: rotate(-90deg) translateY(0%);
      }

      &.nut-popover-arrow-right-bottom {
        bottom: scale-px(16px);
        left: scale-px(-8px);
        transform: rotate(-90deg) translateY(0%);
      }
    }
  }

  .nut-popover-content {
    position: absolute;
    background: $popover-content-background-color;
    border-radius: $popover-border-radius;
    font-size: $popover-font-size;
    color: $popover-text-color;
    line-height: scale-px(28px);
    /* #ifndef dynamic*/
    max-height: initial;
    overflow-y: initial;
    /* #endif */

    &-group {
      padding: 0 $popover-padding;
    }

    .nut-popover-item {
      display: flex;
      align-items: center;
      justify-content: center;
      border-bottom: scale-px(1px) solid $popover-divider-color;
      max-width: $popover-item-width;
      word-wrap: break-word;

      &:last-child {
        margin-bottom: 0;
        border-bottom: none;
      }

      &-icon,
      &-action-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        width: $font-size-s;
        height: $font-size-s;
        font-size: $font-size-s;
        .nut-icon {
          width: $font-size-s;
          height: $font-size-s;
          font-size: $font-size-s;
        }
      }

      &-icon {
        margin-right: $spacing-xxs;
      }

      &-name {
        width: calc(100% - scale-px(34px));
        word-break: keep-all;
        flex: 1;
      }

      &-action-icon {
        color: $color-text;
        margin-left: $spacing-base;
      }

      &.nut-popover-item-disabled {
        color: $popover-disable-color;
        cursor: not-allowed;
      }

      &.nut-popover-taroitem {
        display: flex;
      }
    }

    &-top {
      .nut-popover-arrow-top {
        left: 50%;
        transform-origin: center left;
        transform: rotate(180deg) translateX(-50%);
      }
    }

    &-top-right {
      right: 0;
      .nut-popover-arrow-top-right {
        right: scale-px(16px);
        bottom: scale-px(-3.5px);
        transform: rotate(180deg) translateX(0%);
      }
    }

    &-top-left {
      left: 0;
      .nut-popover-arrow-top-left {
        left: scale-px(16px);
        bottom: scale-px(-3.5px);
        transform: rotate(180deg) translateX(0%);
      }
    }

    &-bottom {
      .nut-popover-arrow-bottom {
        left: 50%;
        transform: translateX(-50%);
      }
    }

    &-bottom-right {
      right: 0;
      .nut-popover-arrow-bottom-right {
        right: scale-px(16px);
        transform: translateX(0%);
      }
    }

    &-bottom-left {
      left: 0;
      .nut-popover-arrow-bottom-left {
        left: scale-px(16px);
        transform: translateX(0%);
      }
    }

    &-left-bottom {
      bottom: 0;
    }

    &-left-top {
      top: 0;
    }

    &-right-bottom {
      bottom: 0;
    }

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

.nut-popover-dark {
  background: $popover-text-color;
  color: $popover-content-background-color;

  .nut-popover-arrow {
    .nut-icon-ArrowRadius {
      color: $popover-text-color;
    }
  }

  .nut-popover-content {
    background: $popover-text-color !important;
    color: $popover-content-background-color !important;
    .nut-popover-item {
      &-action-icon {
        color: rgba(255, 255, 255, 0.8);
      }
    }
  }
}

[dir='rtl'] .nut-popover,
.nut-rtl .nut-popover {
  .nut-popover-content {
    .nut-popover-item {
      &-name {
        margin-left: 0;
        margin-right: scale-px(4px);
      }

      &-action-icon {
        right: auto;
      }
    }
    &-top {
      .nut-popover-arrow-top {
        left: auto;
        right: 50%;
        transform: translateX(50%);
      }
    }
    &-top-right {
      right: auto;
      left: 0;

      .nut-popover-arrow-top-right {
        right: auto;
        left: scale-px(16px);
      }
    }

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

      .nut-popover-arrow-top-left {
        left: auto;
        right: scale-px(16px);
      }
    }

    &-bottom {
      .nut-popover-arrow-bottom {
        left: auto;
        right: 50%;
        transform: translateX(50%);
      }
    }
    &-bottom-right {
      right: auto;

      left: 0;

      .nut-popover-arrow-bottom-right {
        right: auto;
        left: scale-px(16px);
      }
    }

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

      .nut-popover-arrow-bottom-left {
        left: auto;
        right: scale-px(16px);
      }
    }
  }
}

.nut-popover-enter-from,
.nut-popover-leave-active {
  transform: scale(0.8);
  opacity: 0;
}

.nut-popover-enter-active {
  transition-timing-function: ease-out;
}

.nut-popover-leave-active {
  transition-timing-function: ease-in;
}

.nut-popover-content-bg {
  position: fixed;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background: transparent;
  z-index: 999;
}

[dir='rtl'] .nut-popover-content-bg,
.nut-rtl .nut-popover-content-bg {
  left: auto;
  right: 0;
}

.nut-popover-wrapper {
  display: inline-block;
}

// Taro
.nut-popover-content-copy {
  position: absolute;
  top: scale-px(-99999px);
}
