/**
 * @atom Button
 * @section Button
 * @modifiers
 *  .btn-primary  主按钮
 *  .btn-secondary 次按钮
 *  .btn-link 按钮链接
 * @markup
 *  <button class="btn">button</button>
 *  <button class="btn btn-primary">button primary</button>
 *  <button class="btn btn-secondary">button secondary</button>
 *  <button class="btn btn-link">button link</button>
 */
@import "../../../styles/assets/constant.scss";

@mixin btn($hoverColor) {
  .btn-animate {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: 0%;
    transform: translate(-50%, -50%);
    transition: width 0.3s;
    &::before {
      position: relative;
      display: block;
      margin-top: 100%;
      content: "";
    }
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background-color: $hoverColor;
      border-radius: 50%;
      content: "";
    }
  }
  .btn-txt {
    position: relative;
    z-index: 1;
  }
  &:hover {
    .btn-animate {
      width: 120%;
    }
  }
}

.btn {
  display: inline-flex;
  position: relative;
  justify-content: center;
  overflow: hidden;
  align-items: center;
  padding: 5px 15px;
  font-size: 14px;
  font-weight: normal;
  height: 26px;
  color: #333;
  background-color: #ebebeb;
  border: none;
  line-height: 16px;
  white-space: nowrap;

  &:hover {
    // background-color: $basic-aid-gray-color;
    cursor: pointer;
  }

  &:focus {
    outline: 0;
  }
  &:disabled {
    cursor: not-allowed;
    background: #f2f2f2;
    color: #bcbcbc;

    &:hover {
      background: #f2f2f2;
      color: #bcbcbc;
    }
  }
  &.radius {
    border-radius: 2px;
  }
  &.mini {
    padding: 0 15px;
    font-weight: normal;
    height: 26px;
    font-size: $font-size-12;
  }

  .icon:not(:only-child) {
    margin-right: 5px;
  }
}

.btn-primary {
  background-color: rgba(17, 18, 34, 0.85);
  color: #fff;
  &:not(:disabled):hover {
    color: #fff;
  }
  @include btn(#ff5656);
}

.btn-white {
  background: $basic-white-color;
  border: 1px solid rgba(17, 18, 34, 0.85);
  @include btn(rgba(17, 18, 34, 0.09));

  &:hover {
    border: 1px solid rgba(17, 18, 34, 0.5);
    background: rgba(17, 18, 34, 0.06);
    color: #111222;
  }
}

.btn-secondary {
  background-color: #e5efff;
  color: #345ea1;
  &.mini {
    padding: 5px 13px;
    font-weight: normal;
    height: 27px;
    font-size: $font-size-12;
  }
  &:not(:disabled):hover {
    background-color: #d5e3f9;
  }
}
.btn-return {
  background-color: #3a7eea;
  color: #fff;
  &.mini {
    padding: 5px 13px;
    font-weight: normal;
    height: unset;
    font-size: $font-size-12;
  }
  &:not(:disabled):hover {
    background-color: #345ea1;
  }
}

.btn-reset {
  background-color: #e5efff;
  color: $primaryBlueColor;
  &.mini {
    padding: 5px 13px;
    font-weight: normal;
    height: 27px;
    font-size: $font-size-12;
  }
  &:hover,
  &:active {
    background-color: #d5e3f9;
    color: $primaryBlueColor;
    text-decoration: none;
  }
}

.btn-link {
  background-color: transparent;
  color: #333333;
  font-weight: normal;
  line-height: 1.5;

  &:hover {
    text-decoration: underline;
    color: $primaryBlueColor;
  }
}

.btn-danger {
  background-color: $subRedColor;
  color: $basic-white-color;
}

.btn-safe {
  background-color: $subGreenColor;
  color: $basic-white-color;
}

.btn-text {
  background: transparent;
  color: $primaryBlueColor;

  &:hover {
    color: $primaryBlueColor;
    background-color: #e5efff;
  }
}

.btn-dark {
  background: $primaryDarkColor;
  color: $basic-white-color;
}
