/*!
 * The MIT License (MIT)
 *
 * Copyright (c) 2020 Karl STEIN
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
@import "./variables";

.cc-tooltip {
  background-color: $tooltip-background-color;
  border-radius: $border-radius;
  box-shadow: $shadow;
  color: $color-inverse;
  display: inline-block;
  margin: $margin;
  max-width: 250px;
  padding: $padding;
  position: absolute;
  transition-property: background, opacity, height, width, transform;
  z-index: 100;
}

.cc-tooltip-content {
  font-size: 0.9em;
  line-height: 1.1em;
}

// TOOLTIP POSITION

.cc-tooltip.anchored-bottom {
  transform-origin: top center;
}

.cc-tooltip.anchored-left {
  transform-origin: right center;
}

.cc-tooltip.anchored-right {
  transform-origin: left center;
}

.cc-tooltip.anchored-top {
  transform-origin: bottom center;
}

.cc-tooltip.anchored-bottom.anchored-left {
  transform-origin: top right;
  border-radius: $border-radius 0 $border-radius $border-radius;
}

.cc-tooltip.anchored-bottom.anchored-right {
  transform-origin: top left;
  border-radius: 0 $border-radius $border-radius $border-radius;
}

.cc-tooltip.anchored-top.anchored-left {
  transform-origin: bottom right;
  border-radius: $border-radius $border-radius 0 $border-radius;
}

.cc-tooltip.anchored-top.anchored-right {
  transform-origin: bottom left;
  border-radius: $border-radius $border-radius $border-radius 0;
}

// TOOLTIP TAIL

.cc-tooltip-tail {
  display: inline-block;
  height: 0;
  width: 0;
  position: absolute;
}

.cc-tooltip-tail-bottom {
  border-left: solid $tooltip-tail-size transparent;
  border-right: solid $tooltip-tail-size transparent;
  border-top: solid $tooltip-tail-size $tooltip-background-color;
  margin: 0 0 -$tooltip-tail-size -$tooltip-tail-size;
  bottom: 0;
  left: 50%;
  right: auto;
  top: auto;
}

.cc-tooltip-tail-left {
  border-bottom: solid $tooltip-tail-size transparent !important;
  border-top: solid $tooltip-tail-size transparent !important;
  border-right: solid $tooltip-tail-size $tooltip-background-color;
  margin: -$tooltip-tail-size 0 0 -$tooltip-tail-size;
  bottom: auto;
  left: 0;
  right: auto;
  top: 50%;
}

.cc-tooltip-tail-right {
  border-bottom: solid $tooltip-tail-size transparent !important;
  border-top: solid $tooltip-tail-size transparent !important;
  border-left: solid $tooltip-tail-size $tooltip-background-color;
  margin: -$tooltip-tail-size -$tooltip-tail-size 0 0;
  bottom: auto;
  left: auto;
  right: 0;
  top: 50%;
}

.cc-tooltip-tail-top {
  border-left: solid $tooltip-tail-size transparent !important;
  border-right: solid $tooltip-tail-size transparent !important;
  border-bottom: solid $tooltip-tail-size $tooltip-background-color;
  margin: -$tooltip-tail-size 0 0 -$tooltip-tail-size;
  bottom: auto;
  left: 50%;
  right: auto;
  top: 0;
}

.cc-tooltip-tail-bottom.cc-tooltip-tail-left,
.cc-tooltip-tail-bottom.cc-tooltip-tail-right,
.cc-tooltip-tail-top.cc-tooltip-tail-left,
.cc-tooltip-tail-top.cc-tooltip-tail-right {
  display: none;
}
