/*
 * Sonar UI Common
 * Copyright (C) 2019-2020 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
.tooltip {
  position: absolute;
  z-index: var(--tooltipZIndex);
  display: block;
  height: auto;
  box-sizing: border-box;
  font-size: var(--baseFontSize);
  font-weight: 300;
  line-height: 1.5;
  animation: fadeIn 0.3s forwards;
}

.tooltip.top {
  padding: 5px 0;
  margin-top: -3px;
}

.tooltip.right {
  padding: 0 5px;
  margin-left: 3px;
}

.tooltip.bottom {
  padding: 5px 0;
  margin-top: 3px;
}

.tooltip.left {
  padding: 0 5px;
  margin-left: -3px;
}

.tooltip-inner {
  max-width: 300px;
  text-align: left;
  text-decoration: none;
  border-radius: 4px;
  overflow: hidden;
  word-break: break-word;
}

.tooltip-inner {
  padding: 12px 17px;
  color: #fff;
  background-color: #475760;
  letter-spacing: 0.04em;
}

.tooltip-inner .alert {
  margin-bottom: 5px;
  border-radius: 4px;
}

.tooltip-inner a {
  border-bottom-color: #8da6b3;
  color: #a5d0ea;
}

.tooltip-inner hr {
  background-color: #5d6d75;
}

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

.tooltip.top .tooltip-arrow {
  bottom: 0;
  left: 50%;
  border-width: 5px 5px 0;
  transform: translateX(-5px);
  border-top-color: #475760;
}

.tooltip.right .tooltip-arrow {
  top: 50%;
  left: 0;
  transform: translateY(-5px);
  border-width: 5px 5px 5px 0;
  border-right-color: #475760;
}

.tooltip.left .tooltip-arrow {
  top: 50%;
  right: 0;
  transform: translateY(-5px);
  border-width: 5px 0 5px 5px;
  border-left-color: #475760;
}

.tooltip.bottom .tooltip-arrow {
  top: 0;
  left: 50%;
  transform: translateX(-5px);
  border-width: 0 5px 5px;
  border-bottom-color: #475760;
}

/* Workaround for react issue with onMouseLeave in disabled buttons: https://github.com/facebook/react/issues/4251 */
.tooltip button[disabled] {
  pointer-events: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
