@mixin btn-default {
  @include border-radius(3px);
  font-size: $gl-font-size;
  font-weight: 500;
  padding: $gl-vert-padding $gl-btn-padding;

  &:focus,
  &:active {
    outline: none;
    background-color: $btn-active-gray;
    @include box-shadow($gl-btn-active-background);
  }
}

@mixin btn-middle {
  @include btn-default;
}

@mixin btn-color($light, $border-light, $normal, $border-normal, $dark, $border-dark, $color) {
  background-color: $light;
  border-color: $border-light;
  color: $color;

  &:hover,
  &:focus {
    background-color: $normal;
    border-color: $border-normal;
    color: $color;
  }

  &:active,
  &.active {
    @include box-shadow ($gl-btn-active-background);

    background-color: $dark;
    border-color: $border-dark;
    color: $color;
  }
}

@mixin btn-green {
  @include btn-color($green-light, $border-green-light, $green-normal, $border-green-normal, $green-dark, $border-green-dark, #fff);
}

@mixin btn-blue {
  @include btn-color($blue-light, $border-blue-light, $blue-normal, $border-blue-normal, $blue-dark, $border-blue-dark, #fff);
}

@mixin btn-blue-medium {
  @include btn-color($blue-medium-light, $border-blue-light, $blue-medium, $border-blue-normal, $blue-medium-dark, $border-blue-dark, #fff);
}

@mixin btn-orange {
  @include btn-color($orange-light, $border-orange-light, $orange-normal, $border-orange-normal, $orange-dark, $border-orange-dark, #fff);
}

@mixin btn-red {
  @include btn-color($red-light, $border-red-light, $red-normal, $border-red-normal, $red-dark, $border-red-dark, #fff);
}

@mixin btn-gray {
  @include btn-color($gray-light, $border-gray-light, $gray-normal, $border-gray-light, $gray-dark, $border-gray-dark, #313236);
}

@mixin btn-white {
  @include btn-color($white-light, $border-color, $white-normal, $border-white-normal, $white-dark, $border-white-dark, $btn-white-active);
}

.btn {
  @include btn-default;
  @include btn-white;

  color: $gl-text-color;

  &:focus:active {
    outline: 0;
  }

  &.btn-small,
  &.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
    line-height: 18px;
  }

  &.btn-xs {
    padding: 2px 5px;
  }

  &.btn-success,
  &.btn-new,
  &.btn-create,
  &.btn-save {
    @include btn-green;
  }

  &.btn-gray {
    @include btn-gray;
  }

  &.btn-primary {
    @include btn-blue-medium;
  }

  &.btn-info {
    @include btn-blue;
  }

  &.btn-close,
  &.btn-warning {
    @include btn-orange;
  }

  &.btn-danger,
  &.btn-remove,
  &.btn-red {
    @include btn-red;
  }

  &.btn-cancel {
    float: right;
  }

  &.btn-reopen {
    /* should be same as parent class for now */
  }

  &.btn-grouped {
    margin-right: 7px;
    float: left;
    &:last-child {
      margin-right: 0;
    }
    &.btn-xs {
      margin-right: 3px;
    }
  }
  &.disabled {
    pointer-events: auto !important;
  }

  &[disabled] {
    pointer-events: none !important;
  }

  .caret {
    margin-left: 5px;
  }
}

.btn-lg {
  padding: 12px 20px;
}

.btn-transparent {
  color: $btn-transparent-color;
  background-color: transparent;
  border: 0;

  &:hover,
  &:active,
  &:focus {
    background-color: transparent;
    box-shadow: none;
  }
}

.btn-block {
  width: 100%;
  margin: 0;
  margin-bottom: 15px;
  &.btn {
    padding: 6px 0;
  }
}

.btn-group {
  &.btn-grouped {
    margin-right: 7px;
    float: left;
    &:last-child {
      margin-right: 0;
    }
  }
}

.btn-clipboard {
  border: none;
  padding: 0 5px;
}

.input-group-btn {
  .btn {
    @include btn-middle;

    &:hover {
      outline: none;
    }

    &:focus {
      outline: none;
    }

    &:active {
      outline: none;
    }

    &.btn-clipboard {
      padding-left: 15px;
      padding-right: 15px;
    }
  }

  .active {
    @include box-shadow($gl-btn-active-background);

    border: 1px solid #c6cacf !important;
    background-color: #e4e7ed !important;
  }
}

.btn-loading {
  &:not(.disabled) .fa {
    display: none;
  }

  .fa {
    margin-right: 5px;
  }
}

.btn-text-field {
  width: 100%;
  text-align: left;
  padding: 6px 16px;
  border-color: $border-color;
  color: $btn-placeholder-gray;
  background-color: $background-color;

  &:hover,
  &:active,
  &:focus {
    cursor: text;
    box-shadow: none;
    border-color: $border-color;
    color: $btn-placeholder-gray;
    background-color: $background-color;
  }
}

.btn-file-option {
  background: linear-gradient(180deg, $white-light 25%, $gray-light 100%);
}
