$press: #EDEDEF;
$primaryPress: #c85e93;
$dangerPress: #cc405c;
$disabledOpacity: 0.6;
@mixin flat {
  background-color: transparent;
  border-color: transparent;
  &:hover {
    background-color: $white;
    border-color: $white;
  }
  &.active,
  &:active {
    background-color: $press;
    border-color: $press;
  }
  &.disabled {
    &.active,
    &:active,
    &:hover {
      background-color: transparent;
      border-color: transparent;
    }
  }
}

@keyframes ani-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ma-button {
  display: inline-block;
  background: $white;
  border: 1px solid $outlines;
  border-radius: 4px;
  line-height: 18px;
  font-size: $font14;
  color: $base;
  padding: 6px 15px;
  text-align: center;
  min-width: 90px;
  cursor: pointer;
  @include unselect();
  .iconfont {
    font-size: $font14;
    position: relative;
    margin-right: 5px;
  }
  > span {
    display: inline-block;
    + .iconfont {
      margin-right: 0px;
      margin-left: 5px;
    }
  }
  &.loading {
    &:before {
      content: "\EEE3";
      font-family: "iconfont" !important;
      margin-right: 5px;
      animation: ani-spin 1s linear infinite;
      display: inline-block;
    }
  }
  &.large {
    padding: 8px 15px;
    min-width: 100px;
    .iconfont {
      font-size: $font14;
      @include transition();
    }
  }
  &.small {
    padding: 4px 10px;
    font-size: $font12;
    min-width: 70px;
    .iconfont {
      font-size: $font12;
      line-height: $font12;
      @include transition();
    }
  }
  &.mini {
    padding: 2px 8px;
    font-size: $font12;
    min-width: 60px;
    .iconfont {
      font-size: $font12;
      line-height: $font12;
      @include transition();
      margin-right: 4px;
    }
  }
  &.active,
  &:active {
    background-color: $press;
  }
  &.disabled {
    opacity: $disabledOpacity;
    cursor: not-allowed;
    &.active,
    &:active {
      background-color: $white;
    }
  }
  &.flat {
    @include flat();
  }
  &.primary {
    background-color: $primary;
    border-color: $primary;
    color: $white;
    &.active,
    &:active {
      background-color: $primaryPress;
      border-color: $primaryPress;
    }
    &.disabled {
      opacity: $disabledOpacity;
      cursor: not-allowed;
      &.active,
      &:active {
        background-color: $primary;
        border-color: $primary;
      }
    }
    &.flat {
      @include flat();
      color: $primary;
    }
  }
  &.danger {
    background-color: $danger;
    border-color: $danger;
    color: $white;
    &.active,
    &:active {
      background-color: $dangerPress;
      border-color: $dangerPress;
    }
    &.disabled {
      opacity: $disabledOpacity;
      cursor: not-allowed;
      &.active,
      &:active {
        background-color: $danger;
        border-color: $danger;
      }
    }
    &.flat {
      @include flat();
      color: $danger;
    }
  }
}

.ma-button-group {
  letter-spacing: -0.33em;
  > .ma-button {
    letter-spacing: normal;
    border-radius: 0px;
    border-right-width: 0px;
    &:first-child {
      border-top-left-radius: 4px;
      border-bottom-left-radius: 4px;
    }
    &:last-child {
      border-top-right-radius: 4px;
      border-bottom-right-radius: 4px;
      border-right-width: 1px;
    }
  }
}
