.hui-Button {
  @extend %general-reset;
  @extend %a-reset;
  transition: all 160ms ease-out;
  display: inline-block;
  position: relative;
  overflow: hidden;
  margin: 2px;
  line-height: $x-11;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  outline-color: transparent;
  outline-style: none;
  vertical-align: middle;
  background-color: transparent;
  box-sizing: border-box;
  font-feature-settings: "liga" 0;

  &:hover, &:focus {
    color: white;
    text-decoration: none;
  }
}

.hui-Button--cta,
.hui-Button--primary,
.hui-Button--secondary,
.hui-Button--tertiary,
.hui-Button--facebook,
.hui-Button--twitter,
.hui-Button--googleplus,
.hui-Button--strava,
.hui-Button--mapmyfitness,
.hui-Button--fitbit,
.hui-Button--pinterest {
  border-width: 1px;
  border-style: solid;
  border-radius: $border-radius;
}

a.hui-Button {
  padding: 1px 1px 0px 0;
}

.hui-Button__label {
  font-size: 14px;
  padding: 0 $x-5;
  letter-spacing: 0.15em;
  position: relative;
}

.hui-Button__icon {
  transition: all 240ms ease-out;
  width: 0;
  opacity: 0;
  float: right;
  border-width: 0;
  overflow: hidden;
  position: relative;
  border-color: rgba($white, 0.4);
}

.hui-Button--cta,
.hui-Button--primary,
.hui-Button--secondary,
.hui-Button--tertiary,
.hui-Button--facebook,
.hui-Button--twitter,
.hui-Button--googleplus,
.hui-Button--strava,
.hui-Button--mapmyfitness,
.hui-Button--fitbit,
.hui-Button--pinterest {
  .hui-Button__icon {
    margin-left: -5px;
    border-style: solid;
    border-left-width: 1px;
  }
}

.hui-Button--cta-borderless,
.hui-Button--primary-borderless,
.hui-Button--secondary-borderless,
.hui-Button--tertiary-borderless,
.hui-Button--facebook-borderless,
.hui-Button--twitter-borderless,
.hui-Button--googleplus-borderless,
.hui-Button--facebook-borderless,
.hui-Button--mapmyfitness-borderless,
.hui-Button--fitbit-borderless,
.hui-Button--pinterest-borderless {
  .hui-Button__icon {
    margin-left: -30px;
  }
}

.hui-Button--uppercase {
  text-transform: uppercase;

  .hui-Button__label  {
    font-size: $x-3;
  }
}

.hui-Button--iconLeft .hui-Button__icon {
  margin-left: 0;
  border-left-width: 0;
  border-right-width: 1px;
  margin-right: -5px;
  float: left;
}

.hui-Button--hasIcon .hui-Button__icon {
  width: $x-11;
  opacity: 1;
}

.hui-Button--slim.hui-Button--hasIcon .hui-Button__icon {
  width: 30px;
}

.hui-Button--cta,
.hui-Button--primary {
  line-height: $x-11;
}

.hui-Button--thin {
  line-height: $x-9;
}

.hui-Button--slim {
  line-height: $x-7;

  .hui-Button__label {
    padding: 0 $x-2;
    letter-spacing: 0.12em;
  }
}

a.hui-Button--slim {
  line-height: $x-7 - 1;
}

.hui-Button--cta,
.hui-Button--secondary {
  border-color: $green;
  &:hover, &:focus {
    background-color: $green-active;
  }
  .hui-Button__icon {
    border-color: $green-light;
  }
}

.hui-Button--facebook {
  &:hover, &:focus {
    background-color: darken($facebook, 10%);
  }
}

.hui-Button--twitter {
  &:hover, &:focus {
    background-color: darken($twitter, 10%);
  }
}

.hui-Button--googleplus {
  &:hover, &:focus {
    background-color: darken($googleplus, 10%);
  }
}

.hui-Button--pinterest {
  &:hover, &:focus {
    background-color: darken($pinterest, 10%);
  }
}

.hui-Button--strava {
  &:hover, &:focus {
    background-color: darken($strava, 10%);
  }
}

.hui-Button--mapmyfitness {
  &:hover, &:focus {
    background-color: darken($mmf, 10%);
  }
}

.hui-Button--fitbit {
  &:hover, &:focus {
    background-color: darken($fitbit, 10%);
  }
}

.hui-Button--primary,
.hui-Button--tertiary {
  border-color: $grey;
  &:hover, &:focus {
    background-color: $grey;
  }
  .hui-Button__icon {
    border-color: $grey-light;
  }
}

.hui-Button--cta {
  color: white;
  background-color: $green;
}

.hui-Button--primary {
  color: white;
  background-color: $grey;
}

.hui-Button--secondary {
  color: $green;
  background-color: transparent;
  &:active {
    color: $green;
  }
}

.hui-Button--tertiary {
  color: $grey;
  background-color: transparent;
  &:active {
    color: $grey;
  }
}

.hui-Button--facebook {
  color: white;
  background-color: $facebook;
}
.hui-Button--twitter {
  color: white;
  background-color: $twitter;
}
.hui-Button--googleplus {
  color: white;
  background-color: $googleplus;
}
.hui-Button--pinterest {
  color: white;
  background-color: $pinterest;
}
.hui-Button--strava {
  color: white;
  background-color: $strava;
}
.hui-Button--mapmyfitness {
  color: white;
  background-color: $mmf;
}
.hui-Button--fitbit {
  color: white;
  background-color: $fitbit;
}

.hui-Button--primary.hui-Button--inverse {
  border-color: white;
  &:hover, &:focus {
    background-color: $grey-lighter;
  }
}

.hui-Button--secondary.hui-Button--inverse,
.hui-Button--tertiary.hui-Button--inverse {
  border-color: white;
  &:hover, &:focus {
    background-color: $grey-lighter;
  }
  .hui-Button__icon {
    border-color: white;
  }
}

.hui-Button--primary.hui-Button--inverse {
  color: $grey;
  background-color: white;
}

.hui-Button--secondary.hui-Button--inverse {
  color: white;
  &:hover, &:focus {
    color: $green;
  }
}

.hui-Button--tertiary.hui-Button--inverse {
  color: white;
  &:hover, &:focus {
    color: $grey;
  }
}

.hui-Button--cta-borderless,
.hui-Button--primary-borderless,
.hui-Button--secondary-borderless,
.hui-Button--tertiary-borderless,
.hui-Button--facebook-borderless,
.hui-Button--twitter-borderless,
.hui-Button--googleplus-borderless,
.hui-Button--pinterest-borderless  {

  .hui-Button__label {
    padding: 0 12px;
  }

  .hui-IconWrapper.hui-Button__icon {
    width: $x-5;
    margin-left: 0;
  }

  &:hover, &:focus {
    color: $green;
    text-decoration: underline;
  }
}

.hui-Button--primary-borderless {
  color: $grey;
}

.hui-Button--cta-borderless,
.hui-Button--primary-borderless,
.hui-Button--secondary-borderless,
.hui-Button--tertiary-borderless,
.hui-Button--facebook-borderless,
.hui-Button--twitter-borderless,
.hui-Button--googleplus-borderless,
.hui-Button--strava-borderless,
.hui-Button--mapmyfitness-borderless,
.hui-Button--fitbit-borderless,
.hui-Button--pinterest-borderless {
  &.hui-Button--inverse {
    background: none;
    color: white;
    &:hover, &:focus {
      color: $grey-lighter;
    }
  }
}

.hui-Button--disabled {
  color: $grey-light !important;
  border-color: $grey-light !important;
  border-style: dashed !important;
  background-color: $grey-lighter;
  &:hover, &:focus {
    background-color: transparent !important;
  }
  .hui-Button__icon {
    border-color: $grey-light !important;
    border-style: dashed !important;
  }
}

.hui-Button--facebook,
.hui-Button--twitter,
.hui-Button--googleplus,
.hui-Button--mapmyfitnes,
.hui-Button--strava,
.hui-Button--fitbit,
.hui-Button--pinterest {
  .hui-Button__icon {
    font-size: $x-5;
  }
}

.hui-Button--cta-borderless,
.hui-Button--primary-borderless,
.hui-Button--secondary-borderless,
.hui-Button--tertiary-borderless,
.hui-Button--facebook-borderless,
.hui-Button--twitter-borderless,
.hui-Button--googleplus-borderless,
.hui-Button--strava-borderless,
.hui-Button--mapmyfitness-borderless,
.hui-Button--fitbit-borderless,
.hui-Button--pinterest-borderless {
  &.hui-Button--disabled {
    border: 0px;
    background: transparent;
    &:hover, &:focus {
      text-decoration: none;
    }
  }
}

.hui-Button--disabled.hui-Button--inverse {
  background-color: transparent;
}

.hui-Button--disabled.hui-Button--primary.hui-Button--inverse {
  background-color: $grey-lighter;
}

@media screen and (max-width: 399px) {
  .hui-Button__label {
    padding: 0 $x-3;
    font-size: 12px;
    letter-spacing: 0.05em;
  }
}
