@import '../var.less';

@border-radius-base: 4px;

// rotate
@keyframes f-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg);
  }
}

.f-button {
  user-select: none;
  outline: none;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  border-radius: @border-radius-base;
  &:disabled {
    cursor: not-allowed;
  }
  .f-button-loading-icon {
    display: inline-block; // animation fixed https://stackoverflow.com/questions/27514082/why-wont-my-icon-font-icon-stay-rotated
    animation: f-spin 1s linear infinite;
    font-size: 12px;
    margin-right: 4px;
  }

  // default
  // .f-button-medium();
  // .f-button-text();
}

// size
.f-button-medium {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  padding: 3px 15px;
}
.f-button-small {
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  padding: 3px 7px;
}

// theme
.f-button-primary {
  background: @primary-color;
  color: @light-color;
  border-color: @primary-color;
  &:hover {
    background: @primary-hover-color;
    color: @light-color;
    border-color: @primary-hover-color;
  }
  &:disabled {
    background: @primary-disabled-color;
    color: @light-color;
    border-color: @primary-disabled-color;
  }
  &.f-button-loading {
    background: #bad9f6;
    color: @light-color;
    border-color: #bad9f6;
  }
}
.f-button-danger {
  background: @dangerous-color;
  color: @light-color;
  border-color: @dangerous-color;
  &:hover {
    background: @dangerous-hover-color;
    color: @light-color;
    border-color: @dangerous-hover-color;
  }
  &:disabled {
    background: @dangerous-disabled-color;
    color: @light-color;
    border-color: @dangerous-disabled-color;
  }
  &.f-button-loading {
    background: #fdc7b9;
    color: @light-color;
    border-color: #fdc7b9;
  }
}
.f-button-assist {
  background: @assist-color;
  color: @dangerous-color;
  border-color: @assist-color;
  &:hover {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), @assist-color;
    color: @dangerous-color;
    border-color: linear-gradient(0deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), @assist-color;
  }
  &:disabled {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), @assist-color;
    color: #fb735099;
    border-color: linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), @assist-color;
  }
  &.f-button-loading {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), @assist-color;
    color: #fb735099;
    border-color: linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), @assist-color;
  }
}
.f-button-info {
  background: @gray-5;
  color: @gray-50;
  border-color: @gray-5;
  &:hover {
    background: #f7f6f6;
    color: @gray-40;
    border-color: #f7f6f6;
  }
  &:disabled {
    background: #fcfbfb;
    color: @gray-40;
    border-color: #fcfbfb;
  }
  &.f-button-loading {
    background: #fcfbfb;
    color: @gray-50;
    border-color: #fcfbfb;
  }
}
.f-button-stroke {
  background: @light-color;
  color: @dangerous-color;
  border-color: @dangerous-color;
  &:hover {
    background: @light-color;
    color: @dangerous-hover-color;
    border-color: @dangerous-hover-color;
  }
  &:disabled {
    background: @light-color;
    color: @dangerous-disabled-color;
    border-color: @dangerous-disabled-color;
  }
  &.f-button-loading {
    background: @light-color;
    color: @dangerous-disabled-color;
    border-color: @dangerous-disabled-color;
  }
}
.f-button-text {
  background: transparent;
  color: @gray-40;
  border-color: transparent;
  &:hover {
    background: transparent;
    color: #d5d4d3;
    border-color: transparent;
  }
  &:disabled {
    background: transparent;
    color: #d5d4d3;
    border-color: transparent;
  }
  &.f-button-loading {
    background: transparent;
    color: @gray-20;
    border-color: transparent;
  }
}
.f-button-dangerText {
  background: transparent;
  color: @dangerous-color;
  border-color: transparent;
  &:hover {
    background: transparent;
    color: @dangerous-hover-color;
    border-color: transparent;
  }
  &:disabled {
    background: transparent;
    color: @dangerous-disabled-color;
    border-color: transparent;
  }
  &.f-button-loading {
    background: transparent;
    color: @dangerous-disabled-color;
    border-color: transparent;
  }
}
.f-button-confirm {
  background: @confirm-color;
  color: @dangerous-color;
  border-color: transparent;
  &:hover {
    background: @confirm-hover-color;
    color: @dangerous-color;
    border-color: transparent;
  }
}
