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

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

    .nut-icon-ArrowRadius {
      position: absolute;
      color: $popover-content-background-color;
    }

    &-top {
      bottom: -4px;
    }

    &-bottom {
      top: -4px;
    }

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

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

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

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

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

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

      &.nut-popover-arrow-right-end {
        bottom: 16px;
        left: -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: 28px;
    max-height: initial;
    overflow-y: initial;

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

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

      &-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 12px;
        height: 12px;
        font-size: 12px;
        .nut-icon {
          width: 12px;
          height: 12px;
          font-size: 12px;
        }
      }

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

      &-action-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 12px;
        height: 12px;
        font-size: 12px;
        color: $color-text;
        .nut-icon {
          width: 12px;
          height: 12px;
          font-size: 12px;
        }
      }

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

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

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

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

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

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

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

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

    &-left-end {
      bottom: 0;
    }

    &-left-start {
      top: 0;
    }

    &-right-end {
      bottom: 0;
    }

    &-right-start {
      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-menu-item {
      &-action-icon {
        color: rgba(255, 255, 255, 0.8);
      }
    }
  }
}

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

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

      .nut-popover-arrow-top-end {
        right: auto;
        left: 16px;
      }
    }

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

      .nut-popover-arrow-top-start {
        left: auto;
        right: 16px;
      }
    }

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

      left: 0;

      .nut-popover-arrow-bottom-end {
        right: auto;
        left: 16px;
      }
    }

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

      .nut-popover-arrow-bottom-start {
        left: auto;
        right: 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: -99999px;
}
