// Base class
.tooltip {
  position: fixed;
  z-index: $zindex-tooltip;
  display: block;
  // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
  // So reset our font and text properties to avoid inheriting weird values.
  font-size: $font-size-base;
  // Allow breaking very long words so they don't overflow the tooltip's bounds
  word-wrap: break-word;
  opacity: 0;
  transition: $tooltip-transition;

  &.in {
    opacity: $tooltip-opacity;
  }

  &.tooltip-top {
    padding-bottom: $tooltip-arrow-width;

    .tooltip-arrow {
      bottom: 0;
      left: 50%;
      margin-left: -$tooltip-arrow-width;
      border-width: $tooltip-arrow-width $tooltip-arrow-width 0;
      border-top-color: $tooltip-arrow-color;
    }
  }

  &.tooltip-right {
    padding-left: $tooltip-arrow-width;

    .tooltip-arrow {
      top: 50%;
      left: 0;
      margin-top: -$tooltip-arrow-width;
      border-width: $tooltip-arrow-width $tooltip-arrow-width
        $tooltip-arrow-width 0;
      border-right-color: $tooltip-arrow-color;
    }
  }

  &.tooltip-bottom {
    padding-top: $tooltip-arrow-width;

    .tooltip-arrow {
      top: 0;
      left: 50%;
      margin-left: -$tooltip-arrow-width;
      border-width: 0 $tooltip-arrow-width $tooltip-arrow-width;
      border-bottom-color: $tooltip-arrow-color;
    }
  }

  &.tooltip-left {
    padding-right: $tooltip-arrow-width;

    .tooltip-arrow {
      top: 50%;
      right: 0;
      margin-top: -$tooltip-arrow-width;
      border-width: $tooltip-arrow-width 0 $tooltip-arrow-width
        $tooltip-arrow-width;
      border-left-color: $tooltip-arrow-color;
    }
  }
}

// Wrapper for the tooltip content
.tooltip-inner {
  max-width: $tooltip-max-width;
  padding: $tooltip-padding-y $tooltip-padding-x;
  color: $tooltip-color;
  text-align: left;
  background-color: $tooltip-bg;
  border-radius: $tooltip-border-radius;
  line-height: $tooltip-line-height;
}

// Arrows
.tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
}
