
@mixin generate-button-colors($textColor, $backgroundColor) {
  background-color: $backgroundColor;
  color: $textColor;
  &:hover {
    background-color: lighten($backgroundColor, 8%);
    box-shadow: $bs-med;
    text-decoration: none;
    color: $textColor;
  }
  &:active {
    background-color: darken($backgroundColor, 8%);
  }
  &:focus {
    background-color: lighten($backgroundColor, 4%);
    box-shadow: $bs-light;
    text-decoration: none;
    color: $textColor;
  }
}

// Button Specific Variables
$button-border-radius: 2px;

.button-base {
  text-decoration: none;
  font-size: $fs-m;
  line-height: 1.4em;
  padding: $-xs $-m;
  margin: $-xs $-xs $-xs 0;
  display: inline-block;
  border: none;
  font-weight: 500;
  font-family: $text;
  outline: 0;
  border-radius: $button-border-radius;
  cursor: pointer;
  transition: all ease-in-out 120ms;
  box-shadow: 0 0.5px 1.5px 0 rgba(0, 0, 0, 0.21);
  @include generate-button-colors(#EEE, $primary);
}

.button, input[type="button"], input[type="submit"]  {
  @extend .button-base;
  &.pos {
    @include generate-button-colors(#EEE, $positive);
  }
  &.neg {
    @include generate-button-colors(#EEE, $negative);
  }
  &.secondary {
    @include generate-button-colors(#EEE, $secondary);
  }
  &.muted {
    @include generate-button-colors(#EEE, #888);
  }
  &.muted-light {
    @include generate-button-colors(#666, #e4e4e4);
  }
}

.text-button {
  @extend .link;
  background-color: transparent;
  padding: 0;
  margin: 0;
  border: none;
  &:focus, &:active {
    outline: 0;
  }
  &:hover {
    text-decoration: none;
  }
  &.neg {
    color: $negative;
  }
}

.button-group {
  @include clearfix;
  .button, button[type="button"] {
    margin: $-xs 0 $-xs 0;
    float: left;
    border-radius: 0;
    &:first-child {
      border-radius: $button-border-radius 0 0 $button-border-radius;
    }
    &:last-child {
      border-radius: 0 $button-border-radius $button-border-radius 0;
    }
  }
}

.button.block {
  width: 100%;
  text-align: center;
  display: block;
  &.text-left {
    text-align: left;
  }
}

.button.icon {
  i {
    padding-right: 0;
  }
}

.button.svg {
  svg {
    display: inline-block;
    position: absolute;
    left: $-m;
    top: $-s - 2px;
    width: 24px;
  }
  padding: $-s $-m;
  padding-bottom: $-s - 2px;
  padding-left: $-m*2 + 24px;
}

.button[disabled] {
  background-color: #BBB;
  cursor: default;
  &:hover {
    background-color: #BBB;
    cursor: default;
    box-shadow: none;
  }
}