$hopscotch-bubble-border-width: 1.06125rem;

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(1.25rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation-name: fadeInUp;
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-1.25rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-down {
  animation-name: fadeInDown;
}

@keyframes fadeInRight {
  0% {
    opacity: 0;
    transform: translateX(-1.25rem);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in-right {
  animation-name: fadeInRight;
}

@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(1.25rem);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in-left {
  animation-name: fadeInLeft;
}

.hopscotch-bubble {
  background-color: $dark-popover-background;
  color: $gunmetal;
  font-family: $font-family-sans-serif;
  font-size: 0.8125em;
  position: absolute;
  z-index: 999999;
  box-sizing: content-box;
  background-clip: padding-box;
  margin-top: -1rem;

  &.animate {
    transition-property: top, left;
    transition-duration: 0.5s;
    transition-timing-function: ease-in-out;
  }

  &.invisible {
    opacity: 0;
  }

  &.hide, .hide, .hide-all {
    display: none;
  }

  * {
    box-sizing: content-box;
  }

  h3 {
    @include brand-font-h3();
    font-size: 1.125rem;
    color: $white;
    font-weight: bold;
    line-height: 1.1875rem;
    margin: -0.25rem 0.9375rem 0.5rem 0;
    padding: 0;
  }

  .hopscotch-nav-button {
    @extend .btn;
    font-size: 1rem;
    margin-top: 0.75rem;

    &.next { @extend .btn-primary; }
    &.prev { @extend .btn-secondary; }
  }

  .hopscotch-bubble-container {
    padding: 2rem !important;
    position: relative;
    text-align: left;
    -webkit-font-smoothing: antialiased;
  }

  .hopscotch-content {
    font-family: $font-family-sans-serif;
    font-weight: normal;
    line-height: 1.25rem;
    margin: -0.3125rem 0 0.6875rem;
    padding-top: 0.5rem;
    font-size: 0.9375rem;
    color: $white;
  }

  .hopscotch-bubble-content {
    margin: 0;
  }

  .hopscotch-bubble-close {
    border: 0;
    color: $gray-400;
    background: transparent;
    font-size: 0.825rem;
    display: block;
    position: absolute;
    text-decoration: none;
    top: 1rem;
    right: 1rem;
    margin: 0;
    cursor: pointer;

    &.close, &.hide-all {
      display: none;
    }
  }

  .hopscotch-bubble-number {
    display: none;
  }

  .hopscotch-bubble-arrow-container {
    position: absolute;
    width: 2.125rem;
    height: 2.125rem;

    &.hopscotch-bubble-arrow, &.hopscotch-bubble-arrow-border {
      width: 0;
      height: 0;
    }

    &.up {
      top: -1rem;
      left: 1.625rem;

      .hopscotch-bubble-arrow {
        border: 0;
        position: relative;
        top: -0.625rem;
      }

      .hopscotch-bubble-arrow-border {
        border-bottom: $hopscotch-bubble-border-width solid $dark-popover-background;
        border-left: $hopscotch-bubble-border-width solid transparent;
        border-right: $hopscotch-bubble-border-width solid transparent;
      }
    }

    &.down {
      bottom: -2.1rem;
      left: 0.625rem;

      .hopscotch-bubble-arrow {
        border: 0;
        position: relative;
        top: -1.5rem;
      }

      .hopscotch-bubble-arrow-border {
        border-top: $hopscotch-bubble-border-width solid $dark-popover-background;
        border-left: $hopscotch-bubble-border-width solid transparent;
        border-right: $hopscotch-bubble-border-width solid transparent;
      }
    }

    &.left {
      top: 1.625rem;
      left: -2.125rem;

      .hopscotch-bubble-arrow {
        border: 0;
        position: relative;
        left: 0.4375rem;
        top: -2.125rem;
      }

      .hopscotch-bubble-arrow-border {
        border-right: $hopscotch-bubble-border-width solid $dark-popover-background;
        border-bottom: $hopscotch-bubble-border-width solid transparent;
        border-top: $hopscotch-bubble-border-width solid transparent;
      }
    }

    &.right {
      top: 1.625rem;
      right: -2.5rem;

      .hopscotch-bubble-arrow {
        border: 0;
        position: relative;
        left: -0.4375rem;
        top: -2.125rem;
      }

      .hopscotch-bubble-arrow-border {
        border-left: $hopscotch-bubble-border-width solid $dark-popover-background;
        border-bottom: $hopscotch-bubble-border-width solid transparent;
        border-top: $hopscotch-bubble-border-width solid transparent;
      }
    }
  }

  &.hopscotch-actions {
    margin: 0.625rem 0 0;
    text-align: right;
  }
}

@include media-breakpoint-down(xxs) {
  .hopscotch-bubble {
    max-width: 70%;

    .hopscotch-bubble-container {
      width: auto !important;
    }
  }
}
