/*
  Buttons
 */

$hover-secondary: #b0d7f2;
$hover-default: #b3b3b3;
$hover-confirm: #0372c3;
$hover-red: #feb6bf;
$hover-red-primary: #c72837;
$hover-orange: #ffd3b5;
$warning-light-orange: #f8b588;

%button {
  @include h6;

  font-weight: 500;
  font-family: Roboto, Arial;
  line-height: 1.25rem;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  border-radius: 6px;
  width: 100%;
  transition: border-color 0.3s ease, background-color 0.3s ease;

  &--disabled,
  &[disabled] {
    cursor: auto;
    opacity: 0.5;
    pointer-events: none;
  }
}

%link {
  @include h4;

  color: $Blue-500;
  line-height: 1.25rem;
  cursor: pointer;
  background-color: transparent;

  &:hover {
    color: $Blue-400;
  }

  &:active {
    color: $Blue-600;
  }

  &--disabled,
  &[disabled] {
    cursor: auto;
    opacity: 1;
    pointer-events: none;
    color: $hover-secondary;
  }
}

%small-link {
  @extend %link;

  @include h6;
}

.button {
  @extend %button;

  &__icon {
    display: flex;
    align-items: center;
    margin-right: 4px;
  }
}

.btn-secondary {
  color: $Blue-500;
  border: 2px solid $hover-secondary;
  background-color: $white;

  &:hover {
    border-color: $Blue-500;
  }

  &:active {
    background: $Blue-000;
    border-color: $Blue-500;
  }

  &--disabled,
  &[disabled] {
    opacity: 1;
    color: $hover-secondary;
  }
}

.btn-warning {
  color: $Orange-500;
  border: 2px solid $hover-orange;
  background-color: $white;

  &:hover {
    border-color: $Orange-500;
  }

  &:active {
    background: $Orange-000;
    border-color: $Orange-500;
  }

  &--disabled,
  &[disabled] {
    opacity: 1;
    color: $hover-orange;
  }
}

.btn-danger {
  color: $Red-500;
  border: 2px solid $hover-red;
  background-color: $white;

  &:hover {
    border-color: $Red-500;
  }

  &:active {
    background: $Red-000;
    border-color: $Red-500;
  }

  &--disabled,
  &[disabled] {
    opacity: 1;
    color: $hover-red;
  }
}

.btn-danger-primary {
  color: $white;
  border: 2px solid $Red-500;
  background-color: $Red-500;

  &:hover {
    border-color: $hover-red-primary;
    background-color: $hover-red-primary;
  }

  &:active {
    background: $Red-600;
    border-color: $Red-600;
  }

  &--disabled,
  &[disabled] {
    opacity: 1;
    border-color: $hover-red;
    background-color: $hover-red;
  }
}

.btn-default {
  color: $Grey-500;
  border: 2px solid $hover-default;

  &:hover {
    border-color: $Grey-500;
  }

  &:active {
    background: #fbfbfc;
    border-color: $Grey-500;
  }

  &--disabled,
  &[disabled] {
    opacity: 1;
    color: $hover-default;
  }
}

.btn-primary {
  color: $white;
  border: 2px solid $Blue-500;
  background-color: $Blue-500;

  &:hover {
    border-color: $hover-confirm;
    background-color: $hover-confirm;
  }

  &:active {
    background: $Blue-600;
    border-color: $Blue-600;
  }

  &--disabled,
  &[disabled] {
    border-color: $hover-secondary;
    background-color: $hover-secondary;
  }
}

.btn-link {
  @extend %link;
}

.btn--large {
  min-height: 54px;
}

/**
  All Buttons styles are deviations from design guide
 */

.btn-raised {
  color: $primary-blue;
  background-color: $white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 6px;
  height: initial;
  min-height: initial;
  width: initial;
  min-width: initial;
}

.btn--first-time {
  height: 54px;
  width: 198px;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.14);
  color: $white;
  font-size: 1.25rem;
  font-weight: 500;
  transition: 200ms ease-in-out;
  background-color: rgba(247, 134, 28, 0.9);
  border-radius: 0;
}

button[disabled],
input[type="submit"][disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  padding: 8px 12px;
  background: #f7861c;
  box-shadow: 0 3px 6px rgba(247, 134, 28, 0.36);
  color: $white;
  font-size: 1.1em;
  font-family: Roboto;
  text-transform: uppercase;
}

.btn--rounded {
  border-radius: 100px;
  will-change: box-shadow;
  transition: box-shadow cubic-bezier(0.6, -0.28, 0.735, 0.045) 200ms;

  &:hover {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  }

  &.btn-secondary {
    border: 1px solid $Blue-500;

    &--disabled,
    &[disabled] {
      border-color: $hover-secondary;
      color: $hover-secondary;
    }

    &:active {
      border-color: $Blue-600;
    }
  }

  &.btn-default {
    border: 1px solid $Grey-500;

    &--disabled,
    &[disabled] {
      border-color: $Grey-100;
      color: $hover-default;
    }

    &:active {
      border-color: $Grey-600;
    }
  }

  &.btn-danger {
    border: 1px solid $Red-500;

    &--disabled,
    &[disabled] {
      border-color: $Red-100;
      color: $Red-300;
    }

    &:active {
      border-color: $Red-600;
    }
  }

  &.btn-warning {
    border: 1px solid $Orange-500;

    &--disabled,
    &[disabled] {
      border-color: $warning-light-orange;
      color: $warning-light-orange;
    }

    &:active {
      border-color: $Orange-600;
    }
  }

  &.btn-primary {
    background-color: $Blue-500;

    &--disabled,
    &[disabled] {
      background-color: $hover-secondary;
    }

    &:active {
      background-color: $Blue-600;
    }
  }

  &.btn-danger-primary {
    background-color: $Red-500;

    &--disabled,
    &[disabled] {
      background-color: $Red-300;
    }

    &:active {
      background-color: $Red-600;
    }
  }
}
