@import './variables.css';

/* Reset */
button {
  cursor: pointer;
  border: none;
  background: none;
  margin: none;
  padding: none;
  outline: none;
}

.button {
  position: relative;
  font-family: 'Source Sans Pro', Arial, Helvetica, Helvetica Neue, sans-serif;
  font-size: 16px;
  color: var(--textColor);
  background-color: var(--white);
  border: 1px solid var(--lightGray);
  border-radius: var(--borderRadius);
  transition: all ease-in-out var(--transitionTiming);
  padding: 8px 14px;
  outline: 0;
  display: flex;
  align-items: center;
  text-align: center;

  &:hover {
    background-color: var(--darkWhite);
    text-decoration: none;
  }

  &:active {
    background-color: var(--gray);
  }

  &.primary {
    background-color: var(--primaryColor);
    border: 1px solid transparent;
    color: var(--white);

    &:hover {
      background-color: var(--primaryColorDark);
    }

    & .button-loading path {
      fill: var(--white);
    }
  }

  &.cta {
    background-color: var(--ctaColor);
    font-weight: bold;
    border: 1px solid transparent;
    color: var(--white);

    &:hover {
      background-color: var(--ctaColorDark);
    }

    & .button-loading path {
      fill: var(--white);
    }
  }

  &.danger {
    background-color: var(--errorColor);
    border: 1px solid transparent;
    color: var(--white);

    &:hover {
      background-color: var(--errorColorDark);
    }

    & .button-loading path {
      fill: var(--white);
    }
  }

  &.large {
    padding: 16px 32px;
  }

  &.small {
    padding: 3px 8px;
    font-size: 14px;
  }

  &.subtle {
    border: none;
    outline: none;
    color: var(--textColor);
    text-decoration: none;
  }

  &.full-width {
    width: 100%;
  }

  &.square {
    padding: 8px 8px;
  }

  &.disabled {
    background-color: var(--gray) !important;
    cursor: default;
  }

  & .button-loading {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    padding: 5px;
    background-color: inherit;
    opacity: 0;

    &.visible {
      opacity: 1;
      transition: opacity var(--transitionTiming) ease-in;
    }
  }
}

a,
.button.link {
  padding: 0;
  color: var(--primaryColor);
  text-decoration: none;
  border: none;
  cursor: pointer;
  align-self: center;

  &:hover {
    text-decoration: underline;
    background: none;
  }
}

.button-group {
  display: flex;

  & .button,
  & a {
    margin-right: 8px;
  }
}
