/*
 * basic button component
 */
/*
 * HTML template example:
 * preferably use <button> for buttons !
 * use .button or .btn (for structure) and .btn-- (for variants) (see appearance mixin)
 */

/*
 * button reset
 */

%btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: $spacer-small $spacer-medium-plus;
  cursor: pointer;
  user-select: none;
  transition: 0.25s;
  transition-property: box-shadow, background-color, color, border;
  text-decoration: none;
  border: none;
  box-shadow: none;
  border-radius: 20px;
  letter-spacing: 1px;
  font-weight: 600;
}

.btn,
.button {
  @extend %btn;

  &:focus {
    -webkit-tap-highlight-color: transparent;
  }
}

// button state variants
.btn,
.button {
  background-color: $color-alpha;
  [class^="icon-"] {
    margin-right: $spacer-small;
  }
  &:hover {
    background-color: darken($color-alpha, 10%);
  }
  &.isLoading {
    background-image: url("https://res.cloudinary.com/btbassets/image/upload/v1614770507/icons/loading.svg");
    background-size: 18px;
    background-position: 9px center;
    background-repeat: no-repeat;
  }
  &-orange {
    background-color: $orange;
    color: white;
    border: solid transparent 2px;
    &:hover {
      background-color: darken($orange, 10%);
      color: white;
    }
    &:focus,
    &:hover {
      background-color: white;
      border: solid $orange 2px;
      color: $orange;
    }
  }
  &-purple {
    background-color: $accent-color;
    color: white;
    border: solid transparent 2px;
    &:hover {
      background-color: darken($accent-color, 10%);
      color: white;
    }
    &:focus,
    &:hover {
      background-color: white;
      border: solid $accent-color 2px;
      color: $accent-color;
    }
  }
  &-green {
    background-color: $color-alternate-1;
    color: white;
    border: solid transparent 2px;
    cursor: default;
    &:hover {
      background-color: darken($color-alternate-1, 10%);
      color: white;
    }
  }
  &-white {
    background-color: white;
    &:hover {
      background: darken(white, 10%);
    }
  }
  &-light {
    background-color: transparent;
    border: 2px solid $blue-light;
    padding: 0;
  }
  &--small {
    padding: $spacer-tiny-plus $spacer-small;
    font-size: 0.8em;
  }
  &--unstyled {
    padding: 0;
    border: none;
    text-align: left;
    background: none;
    border-radius: 0;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    &:focus {
      box-shadow: none;
      outline: none;
    }
    &:hover {
      background: transparent;
    }
  }
  &-round {
    border-radius: 50%;
    padding: 0;
    width: 40px;
    height: 40px;
    position: relative;
    [class^="icon-"] {
      margin-right: 0;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      line-height: 0;
    }
  }
  &--gradient {
    padding: 4px;
    border-radius: 20px;
    background: linear-gradient(to right, $orange, $dark-blue);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background ease-in 0.25s;
    &:hover {
      background: linear-gradient(to right, $dark-blue, $dark-blue);
    }

    span {
      background: white;
      color: $dark-blue;
      padding: 4px 30px;
      border-radius: 20px;
      font-size: 1.7rem;
      line-height: 1;
      font-weight: 600;
      display: block;
      @media screen and (max-width: 768px)  {
        padding:4px 10px
      }
    }
  }
}
