.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
}

.tooltip:focus-within .tooltip-text {
  visibility: visible;
}

/* Tooltip text */
.tooltip .tooltip-text {
  visibility: hidden;
  width: 400px;
  background-color: dimgrey;
  color: #fff;
  padding: 5px;
  border-radius: 6px;
  font-size: small;
  position: absolute;
  display:inline;
  z-index: 1;
}

.tooltip-text.left {
  top: -5px;
  left: 105%;
}

.tooltip-text.top {
  bottom: 100%;
  left: 50%;
  margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */
}

.tooltip .tooltip-text.left::after {
  content: " ";
  position: absolute;
  top: 50%;
  right: 100%; /* To the left of the tooltip */
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent dimgrey transparent transparent;
}