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

@tooltip-prefix-cls: ~"@{ui-prefix}-tooltip";

// Base class
.@{tooltip-prefix-cls} {
  .reset-component;
  position: absolute;
  z-index: @zindex-tooltip;
  display: block;
  visibility: visible;

  &_hidden {
    display: none;
  }

  &_placement_top,
  &_placement_topLeft,
  &_placement_topRight {
    padding-bottom: @tooltip-distance;
  }
  &_placement_right,
  &_placement_rightTop,
  &_placement_rightBottom {
    padding-left: @tooltip-distance;
  }
  &_placement_bottom,
  &_placement_bottomLeft,
  &_placement_bottomRight {
    padding-top: @tooltip-distance;
  }
  &_placement_left,
  &_placement_leftTop,
  &_placement_leftBottom {
    padding-right: @tooltip-distance;
  }

  // Wrapper for the tooltip content
  &__content {
    max-width: @tooltip-max-width;
    padding: 6px 8px;
    color: @tooltip-color;
    text-align: left;
    text-decoration: none;
    background-color: @tooltip-bg;
    border-radius: @border-radius-base;
    box-shadow: @box-shadow-base;
    min-height: 32px;
  }

  // Arrows
  &__arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
  }

  &_placement_top &__arrow,
  &_placement_topLeft &__arrow,
  &_placement_topRight &__arrow {
    bottom: @tooltip-distance - @tooltip-arrow-width;
    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
    border-top-color: @tooltip-arrow-color;
  }

  &_placement_top &__arrow {
    left: 50%;
    margin-left: -@tooltip-arrow-width;
  }

  &_placement_topLeft &__arrow {
    left: 16px;
  }

  &_placement_topRight &__arrow {
    right: 16px;
  }

  &_placement_right &__arrow,
  &_placement_rightTop &__arrow,
  &_placement_rightBottom &__arrow {
    left: @tooltip-distance - @tooltip-arrow-width;
    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;
    border-right-color: @tooltip-arrow-color;
  }

  &_placement_right &__arrow {
    top: 50%;
    margin-top: -@tooltip-arrow-width;
  }

  &_placement_rightTop &__arrow {
    top: 8px;
  }

  &_placement_rightBottom &__arrow {
    bottom: 8px;
  }

  &_placement_left &__arrow,
  &_placement_leftTop &__arrow,
  &_placement_leftBottom &__arrow {
    right: @tooltip-distance - @tooltip-arrow-width;
    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;
    border-left-color: @tooltip-arrow-color;
  }

  &_placement_left &__arrow {
    top: 50%;
    margin-top: -@tooltip-arrow-width;
  }

  &_placement_leftTop &__arrow {
    top: 8px;
  }

  &_placement_leftBottom &__arrow {
    bottom: 8px;
  }

  &_placement_bottom &__arrow,
  &_placement_bottomLeft &__arrow,
  &_placement_bottomRight &__arrow {
    top: @tooltip-distance - @tooltip-arrow-width;
    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
    border-bottom-color: @tooltip-arrow-color;
  }

  &_placement_bottom &__arrow {
    left: 50%;
    margin-left: -@tooltip-arrow-width;
  }

  &_placement_bottomLeft &__arrow {
    left: 16px;
  }

  &_placement_bottomRight &__arrow {
    right: 16px;
  }
}
