@import 'src/styles/variables';

@keyframes pulse {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

.button {
  @include outer_shadow();

  position: relative;
  height: $input_height;
  border: none;
  box-sizing: border-box;
  padding: 0 30px;
  color: white;
  text-transform: uppercase;
  font: $font_14_semibold;

  outline: none;
  cursor: pointer;
  margin: 0;

  background: $color_primary;
  border-radius: $radius;

  fill: white;
  stroke: white;
  user-select: none;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: opacity 0.25s, filter 0.25s, box-shadow 0.25s,
    background-color 0.5s;

  input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    bottom: 0;
    opacity: 0;
  }

  svg.icon {
    fill: white;
    stroke: white;
  }

  span {
    flex: 1;
  }

  &:global(.disabled) {
    touch-action: none;
    pointer-events: none;
  }

  &:hover {
    opacity: 1;

    &:global(.disabled) {
      cursor: auto;
    }
  }

  &:global(.stretchy) {
    flex: 1;
    width: 100%;
  }

  &:global(.disabled),
  &:global(.grey) {
    background: $gray_90;
    color: white;
  }

  &:global(.disabled) {
    opacity: 0.3;
  }

  &:global(.icon) {
    padding-left: 10px;
    padding-right: 10px;

    svg {
      margin: 0 !important;
    }
  }

  &:global(.is_loading) {
    span,
    svg {
      animation: pulse 0.25s infinite alternate;
    }
  }

  &.has_icon_left {
    padding-left: $gap;
    padding-right: $gap;
  }

  &.has_icon_right {
    padding-left: $gap;
    padding-right: $gap;
  }

  &.outline {
    background: transparent;
    box-shadow: inset $gray_75 0 0 0 2px;
    color: $gray_75;

    svg {
      fill: $gray_75;
    }
  }

  &.outline-white {
    background: transparent;
    box-shadow: inset $white 0 0 0 2px;
    color: $white;

    svg {
      fill: $white;
    }
  }

  &.gray {
    background: $content_bg_lightest;
  }

  &.link {
    background: transparent;
    color: white;
    box-shadow: none;
    padding: 0 $gap;

    svg {
      fill: white;
    }
  }
}

.micro {
  height: 20px;
  font: $font_12_semibold;
  padding: 0 15px;
  border-radius: $radius * 0.5;

  &:global(.round) {
    border-radius: 10px;
  }
}

.mini {
  height: 26px;
  border-radius: $radius * 0.5;

  &:global(.round) {
    border-radius: 14px;
  }
}

.small {
  height: 32px;

  svg.icon {
    width: 24px;
    height: 24px;
  }

  &:global(.round) {
    border-radius: 16px;
  }
}

.normal {
  height: 38px;

  &:global(.round) {
    border-radius: 19px;
  }
}

.big {
  height: 40px;

  &:global(.round) {
    border-radius: 20px;
  }
}

.giant {
  height: 50px;
  padding: 0 30px;
  min-width: 50px;

  &:global(.round) {
    border-radius: 25px;
  }

  &.has_icon_left {
    padding-left: 20px;
    padding-right: 30px;
  }
}

.disabled {
  opacity: 0.5;
}

.icon_left {
  margin-right: $gap * 0.5 !important;
  width: 20px;
  height: 20px;
}

.icon_right {
  margin-left: $gap * 0.5 !important;
  width: 20px;
  height: 20px;
}

.primary {
  @include outer_shadow;
  background: $primary_gradient;
}

.danger {
  @include outer_shadow;
  background: $danger_gradient;
}

.info {
  @include outer_shadow;
  background: $info_gradient;
}

.lab {
  background: $lab_gradient;
}

.flow {
  background: $flow_gradient;
}

.flat {
  box-shadow: none;
  background: $content_bg_light;
  color: $gray_25;
}

.loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: $content_bg_backdrop;
}
