// Button color generator for primary and themed buttons

// New button hotness
@mixin btn-solid($color, $bg, $bg2) {
  color: $color;
  background: $bg2;

  @if $bg == $gray-000 {
    &:focus {
      box-shadow: $btn-input-focus-shadow;
    }

    &:hover {
      background: darken($bg2, 3%);
      border-color: rgba($black, 0.35);
    }

    &:active {
      background: darken(desaturate($bg, 10%), 6%);
      border-color: rgba($black, 0.35); // repeat to avoid shift on click-drag off of button
      box-shadow: $btn-active-shadow;
    }

    &:checked {
      background: darken(desaturate($bg, 10%), 6%);
      border-color: rgba($black, 0.35); // repeat to avoid shift on click-drag off of button
      box-shadow: $btn-checked-shadow;
    }

    &:disabled {
      color: rgba($color, 0.4);
      background: $bg2;
      border-color: $border-color-button;
      box-shadow: none;
    }

  }
  @else {
    border-color: $bg2;

    &:focus {
      box-shadow: 0 0 0 0.2em rgba($bg, 0.4);
    }

    &:hover {
      background: darken($bg2, 2%);
      border-color: darken($bg2, 2%);
    }

    &:active {
      background: darken(mix($bg, $bg2, 50%), 7%);
      border-color: darken($bg2, 2%);
      box-shadow: $btn-active-shadow;
    }

    &:disabled {
      color: rgba($white, 0.65);
      background: mix($bg2, $white, 50%);
      border-color: transparent;
      box-shadow: none;
    }
  }
}

// Inverse button hover style
@mixin btn-inverse($color, $bg, $bg2) {
  color: $color;
  background: $bg;
  border: 2px solid;
  box-shadow: 0 2px 3px rgba($black, 0.12);

  &:focus {
    box-shadow: 0 0 0 0.2em rgba($color, 0.4);
  }

  &:hover {
    color: $text-white;
    background: $color;
    border-color: $black-fade-50;
  }

  &:active {
    color: $text-white;
    background: darken($color, 5%);
    border-color: $black-fade-50;
    box-shadow: $btn-active-shadow;
  }

  &:disabled {
    color: rgba($color, 0.4);
    background: $bg2;
    border-color: $border-color-button;
    box-shadow: none;
  }
}

// Outline color generator for btn-outline to make the hover state inverse the text and bg colors.
@mixin btn-outline($text-color: $text-blue, $bg-color: $bg-white) {
  color: $text-color;
  background: $bg-color;

  &:hover,
  &:active {
    color: $bg-color;
    background: $text-color;
    border-color: $text-color;
  }

  &:focus {
    border-color: $text-color;
    box-shadow: 0 0 0 0.2em rgba($text-color, 0.4);
  }

  &:disabled {
    color: $black-fade-30;
    background: $bg-white;
    border-color: $black-fade-15;
    box-shadow: none;
  }
}
