@use 'mixins/mixins' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@include b(tooltip) {
  @include set-var-value(color, getCssVar(text));

  background: getColor('color');
  color: getColor('background');
  text-align: center;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  max-width: 350px;
  min-width: 30px;
  min-height: 30px;

  &::after {
    background-color: getColor(color);
  }

  @include when(loading) {
    color: getColor('background', 0.2);
    * {
      opacity: 0.5;
      pointer-events: none;
    }
  }
  @include when(border-thick) {
    background: getColor('background');
    color: getColor('color');
    box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, getCssVar(shadow-opacity));

    &[data-popper-placement*='top'] {
      border-bottom: 4px solid getColor('color');
      &:after {
        bottom: -7px;
      }
    }
    &[data-popper-placement*='left'] {
      border-right: 4px solid getColor('color');
      &:after {
        right: -7px;
      }
    }
    &[data-popper-placement*='right'] {
      border-left: 4px solid getColor('color');
      &:after {
        left: -7px;
      }
    }
    &[data-popper-placement*='bottom'] {
      border-top: 4px solid getColor('color');
      &:after {
        top: -7px;
      }
    }

    &:before {
      width: 100%;
      height: 100%;
      z-index: -1;
      background: inherit;
      border-radius: inherit;
      top: 0px;
      left: 0px;
      content: '';
      position: absolute;
    }
    &:after {
      background: getColor('color') !important;
    }
  }
  @include when(border) {
    background: getColor('background');
    color: getColor('color');
    border: 2px solid getColor('color');
    &:before {
      width: 100%;
      height: 100%;
      z-index: -1;
      background: inherit;
      border-radius: inherit;
      top: 0px;
      left: 0px;
      content: '';
      position: absolute;
    }
    &:after {
      border: 2px solid getColor('color');
      width: 12px !important;
      height: 12px !important;
    }
  }
  @include when(circle) {
    border-radius: 20px;
  }
  @include when(square) {
    border-radius: 0px;
  }
  @include when(not-arrow) {
    &:after {
      display: none;
    }
  }
  @include when(shadow) {
    background: getColor('background');
    color: getColor('color');
    box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, getCssVar(shadow-opacity));

    &:before {
      width: 100%;
      height: 100%;
      z-index: -1;
      background: inherit;
      border-radius: inherit;
      top: 0px;
      left: 0px;
      content: '';
      position: absolute;
    }
    &:after {
      background: getColor('background');
      box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, getCssVar(shadow-opacity));
    }
  }
  @include when(light) {
    @include set-var-value(color, getCssVar(gray-3));
    color: $color-white;
  }
}
