@import "../../style/themes/default";
@import "../../style/mixins/index";

@popover-prefix-cls: ~"@{ant-prefix}-popover";

.@{popover-prefix-cls} {
  position: absolute;
  top: 0;
  left: 0;
  z-index: @zindex-popover;
  cursor: auto;
  user-select: text;
  white-space: normal;
  font-size: @font-size-base;
  line-height: @line-height-base;
  font-weight: normal;
  text-align: left;

  &:after {
    content: "";
    position: absolute;
    background: rgba(255, 255, 255, 0.01);
  }

  &-hidden {
    display: none;
  }

  // Offset the popover to account for the popover arrow
  &-placement-top,
  &-placement-topLeft,
  &-placement-topRight {
    padding-bottom: @popover-distance;
  }

  &-placement-right,
  &-placement-rightTop,
  &-placement-rightBottom {
    padding-left: @popover-distance;
  }

  &-placement-bottom,
  &-placement-bottomLeft,
  &-placement-bottomRight {
    padding-top: @popover-distance;
  }

  &-placement-left,
  &-placement-leftTop,
  &-placement-leftBottom {
    padding-right: @popover-distance;
  }

  &-inner {
    background-color: @popover-bg;
    background-clip: padding-box;
    border-radius: @border-radius-base;
    box-shadow: @box-shadow-base;
  }

  &-title {
    min-width: @popover-min-width;
    margin: 0; // reset heading margin
    padding: 8px 16px;
    min-height: 32px;
    border-bottom: 1px solid @border-color-split;
    color: @popover-color;
    font-weight: 500;
  }

  &-inner-content {
    padding: 8px 16px;
    color: @popover-color;
  }

  &-message {
    padding: 8px 0 16px;
    font-size: @font-size-base;
    color: @popover-color;
    > .@{iconfont-css-prefix} {
      color: @warning-color;
      line-height: 17px;
      position: absolute;
    }
    &-title {
      padding-left: 20px;
    }
  }

  &-buttons {
    text-align: right;
    margin-bottom: 8px;
    button {
      margin-left: 8px;
    }
  }

  // Arrows
  // .popover-arrow is outer, .popover-arrow:after is inner

  &-arrow {
    &,
    &:after {
      position: absolute;
      display: block;
      width: 0;
      height: 0;
      border-color: transparent;
      border-style: solid;
    }
  }

  &-arrow {
    border-width: @popover-arrow-outer-width;
  }

  &-arrow:after {
    border-width: @popover-arrow-width;
    content: "";
  }

  &-placement-top > &-content > &-arrow,
  &-placement-topLeft > &-content >  &-arrow,
  &-placement-topRight > &-content >  &-arrow {
    border-bottom-width: 0;
    border-top-color: @popover-arrow-outer-color;
    bottom: @popover-distance - @popover-arrow-outer-width;
    &:after {
      content: " ";
      bottom: 1px;
      margin-left: -@popover-arrow-width;
      border-bottom-width: 0;
      border-top-color: @popover-arrow-color;
    }
  }
  &-placement-top > &-content >  &-arrow {
    left: 50%;
    margin-left: -@popover-arrow-outer-width;
  }
  &-placement-topLeft > &-content >  &-arrow {
    left: 16px;
  }
  &-placement-topRight > &-content >  &-arrow {
    right: 16px;
  }

  &-placement-right > &-content >  &-arrow,
  &-placement-rightTop > &-content >  &-arrow,
  &-placement-rightBottom > &-content >  &-arrow {
    left: @popover-distance - @popover-arrow-outer-width;
    border-left-width: 0;
    border-right-color: @popover-arrow-outer-color;
    &:after {
      content: " ";
      left: 1px;
      bottom: -@popover-arrow-width;
      border-left-width: 0;
      border-right-color: @popover-arrow-color;
    }
  }
  &-placement-right > &-content >  &-arrow {
    top: 50%;
    margin-top: -@popover-arrow-outer-width;
  }
  &-placement-rightTop > &-content >  &-arrow {
    top: 12px;
  }
  &-placement-rightBottom > &-content >  &-arrow {
    bottom: 12px;
  }

  &-placement-bottom > &-content >  &-arrow,
  &-placement-bottomLeft > &-content >  &-arrow,
  &-placement-bottomRight > &-content >  &-arrow {
    border-top-width: 0;
    border-bottom-color: @popover-arrow-outer-color;
    top: @popover-distance - @popover-arrow-outer-width;
    &:after {
      content: " ";
      top: 1px;
      margin-left: -@popover-arrow-width;
      border-top-width: 0;
      border-bottom-color: @popover-arrow-color;
    }
  }
  &-placement-bottom > &-content >  &-arrow {
    left: 50%;
    margin-left: -@popover-arrow-outer-width;
  }
  &-placement-bottomLeft > &-content >  &-arrow {
    left: 16px;
  }
  &-placement-bottomRight > &-content >  &-arrow {
    right: 16px;
  }

  &-placement-left > &-content >  &-arrow,
  &-placement-leftTop > &-content >  &-arrow,
  &-placement-leftBottom > &-content >  &-arrow {
    right: @popover-distance - @popover-arrow-outer-width;
    border-right-width: 0;
    border-left-color: @popover-arrow-outer-color;
    &:after {
      content: " ";
      right: 1px;
      border-right-width: 0;
      border-left-color: @popover-arrow-color;
      bottom: -@popover-arrow-width;
    }
  }
  &-placement-left > &-content >  &-arrow {
    top: 50%;
    margin-top: -@popover-arrow-outer-width;
  }
  &-placement-leftTop > &-content >  &-arrow {
    top: 12px;
  }
  &-placement-leftBottom > &-content >  &-arrow {
    bottom: 12px;
  }
}
