@import "./../../style-config/colors";
@import "./../../style-config/general";
@import "./../../style-config/input-field";
@import "./../../style-config/mixins";
@import "./../../style-config/buttons";

.carbon-button {
  border: $carbon-button__border--secondary;
  border-radius: $carbon-button__border-radius;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block;
  line-height: 16px;
  font-size: $app-font-size;
  font-weight: $carbon-button__font-weight;
  height: $input-common-height;
  margin-left: 0;
  margin-right: 0;
  padding: $carbon-button__padding;
  outline: none;
  text-decoration: none;

  &:focus {
    @include transition(box-shadow linear 0.1s);

    box-shadow: 0 0 6px rgba(25,99,246,0.6);
  }

  &.carbon-button--small {
    border-radius: 3px;
    font-size: 11px;
    height: 25px;
    letter-spacing: 0.5px;
    padding: 2px 10px 2px 10px;
  }

  &.carbon-button--large {
    font-size: 16px;
    height: 43px;
    padding: 12px 20px;
  }
}

@mixin button-theme($theme, $color, $hover, $active, $text-color) {
  .carbon-button--#{$theme} {
    background-color: $color;
    border: $carbon-button__border--primary;
    color: $text-color;

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

      .carbon-link__content {
         text-decoration: none;
      }
    }

    &:focus {
      box-shadow: 0 0 6px rgba($active,0.6);
    }

    &:not(.carbon-button--disabled):active {
      background-color: $active;
      border-color: $active;
      color: $text-color;
    }

    &.carbon-button--secondary:not(.carbon-button--disabled) {
      background-color: transparent;
      border-color: $color;
      color: $color;

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

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

@each $set in $buttonColorSets {
  @include button-theme($set...);
}

.carbon-button--disabled,
.carbon-button--disabled:hover {
  background-color: $carbon-button__background-color--disabled;
  border-color: $carbon-button__border-color--disabled;
  color: $carbon-button__color--disabled;
  cursor: default;
}
