@import "../../styles/variables.scss";

.button {
  border-radius: $base-border-radius;
  position: relative;
  border: none;
  box-shadow: $base-box-shadow;
  cursor: pointer;
  display: inline-block;
  font-size: $body-font-size;
  padding: 0 $l-spacing;
  height: $base-input-height;
  line-height: $base-input-height;
  white-space: nowrap;
}

.margin {
  margin-right: $m-spacing;
}

.fitWidth {
  width: 100%;
}

.icon {
  color: $brand-grey;
  margin-right: 10px;
}

.disabled {
  cursor: default;
  border: none;
  box-shadow: none;
}

.buttonLoading {
  cursor: default;
}

.default {
  background-color: $brand-white;
  border: $base-border;
  color: $brand-darkGrey;
  line-height: calc(#{$base-input-height} - (#{$base-border-width} * 2));

  &:hover {
    background-color: lighten($brand-blue, 33%);
    border-color: $brand-blue;
    color: $brand-blue;

    .icon {
      color: $brand-blue;
    }
  }

  &.disabled{
     background-color: $brand-nearWhite;
     border: 0;
     color: lighten($brand-grey, 15%);

     &:hover {
       border: 0;
     }
  }

  &.buttonLoading:hover {
    background-color: inherit;
    border-color: $base-border-color;
    color: $brand-darkGrey;
    cursor: default;
  }
}

.primary {
  background-color: $brand-blue;
  color: $brand-white;

  &:hover {
    background-color: $brand-blue-hover;
  }

  &.disabled {
     opacity: 0.4;

     &:hover {
       background-color: $brand-blue;
     }
  }

  &.buttonLoading:hover {
    background-color: $brand-blue;
    cursor: default;
  }

  .icon {
    color: $brand-white;
  }
}

.destructive {
  background-color: $brand-destructive;
  color: $brand-white;

  &:hover {
    background-color: $brand-destructive-hover;
  }

  &.disabled{
     opacity: 0.4;

     &:hover {
       background-color: $brand-destructive;
     }
  }

  &.buttonLoading:hover {
    background-color: $brand-destructive;
    cursor: default;
  }

  .icon {
    color: $brand-white;
  }
}

.action {
  background-color: $brand-green;
  color: $brand-white;

  &:hover {
    background-color: $brand-green-hover;
  }

  &.disabled {
    opacity: 0.4;

    &:hover {
      background-color: $brand-green;
    }
  }

  &.buttonLoading:hover {
    background-color: $brand-green;
    cursor: default;
  }

  .icon {
    color: $brand-white;
  }
}

.link {
  background-color: transparent;
  color: $brand-blue;
  text-decoration: underline;
  border: none;
  box-shadow: none;
  padding: 0;
  height: auto;
  line-height: 1;

  &:hover {
    opacity: 0.75;
  }

  &.disabled {
    opacity: 0.4;
  }
}


.link-destructive {
  background-color: none;
  color: $brand-red;
  text-decoration: underline;
  border: none;
  box-shadow: none;
  padding: 0;
  height: auto;
  line-height: 1;

  &:hover {
    opacity: 0.75;
  }

  &.disabled {
    opacity: 0.4
  }
}

.childwrapper {
  visibility: hidden;
}

.loader {
  margin: auto;
  left: 0;
  right: 0;
  top: -35px;
  bottom: 0;
  position: absolute;
}
