/* from https://www.w3schools.com/howto/howto_css_tooltip.asp */
/* Tooltip container */

$tooltip-width: 150px !default;

.tooltip {
  position: relative;
  display: inline-block;
}

/* Tooltip text */
.tooltip .tooltiptext {
  visibility: hidden;
  width: $tooltip-width;
  background-color: var(--theme-background-white);
  color: var(--theme-dark-text);
  text-align: center;
  padding: 5px;
  border-radius: 6px;
  border: 1px solid var(--theme-border);

  /* Position the tooltip text */
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -(calc($tooltip-width / 2));

  /* Fade in tooltip */
  opacity: 0;
  transition: opacity 0.3s;

  &.left {
    top: -30%;
    right: 105%;
    bottom: 0;
    left: auto;
    margin-left: 0;
    height: fit-content;
  }
}

/* Tooltip arrow */
.tooltip .tooltiptext::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--theme-border) transparent transparent transparent;
}

.tooltip .tooltiptext.left::after {
  top: 50%;
  left: 100%;
  margin-top: -5px;
  margin-left: 0;
  border-color: transparent transparent transparent var(--theme-border);
}

/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
