// animate
@keyframes loading-dash {
  0% {
    stroke-dasharray: 1, 125;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 95, 31;
    stroke-dashoffset: -31px;
  }

  to {
    stroke-dasharray: 6, 120;
    stroke-dashoffset: -120px;
  }
}

@keyframes loading-rotate {
  to {
    transform: rotate(1turn);
  }
}

/**
 * Button
 */

.b-button {
  border: none;
  outline: none;
  -webkit-appearance: none;
  // 去除button默认样式
  user-select: none;
  position: relative;
  display: inline-block;
  //width: 200px;
  //height: 60px;
  //line-height: 60px;
  text-align: center;
  //background: @background-primary-color;
  font-size: 18px;
  font-weight: 500;
  //color: #FFFFFF;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .4s;

  //&.b-button-default {
  //  border: 1px solid #e5e5e5;
  //  color: #888888;
  //  background: #ffffff;
  //}

  &.b-button-default {
    color: @background-default-font-color;
    background: @background-default-color;

    &:hover {
      background: @background-default-hover-color;
    }

    &:active {
      background: @background-default-active-color;
    }
  }

  &.b-button-primary {
    color: @background-primary-font-color;
    background: @background-primary-color;

    &:hover {
      background: @background-primary-hover-color;
    }

    &:active {
      background: @background-primary-active-color;
    }
  }

  &.b-button-success {
    color: @background-success-font-color;
    background: @background-success-color;

    &:hover {
      background: @background-success-hover-color;
    }

    &:active {
      background: @background-success-active-color;
    }
  }

  &.b-button-warning {
    color: @background-warning-font-color;
    background: @background-warning-color;

    &:hover {
      background: @background-warning-hover-color;
    }

    &:active {
      background: @background-warning-active-color;
    }
  }

  &.b-button-danger {
    color: @background-danger-font-color;
    background: @background-danger-color;

    &:hover {
      background: @background-danger-hover-color;
    }

    &:active {
      background: @background-danger-active-color;
    }
  }

  &.b-button-info {
    color: @background-info-font-color;
    background: @background-info-color;

    &:hover {
      background: @background-info-hover-color;
    }

    &:active {
      background: @background-info-active-color;
    }
  }

  &.b-button-text {
    color: @background-text-font-color;
    background: @background-text-color;

    &:hover {
      background: @background-text-hover-color;
    }

    &:active {
      background: @background-text-active-color;
    }
  }

  &.b-button-block {
    display: block;
    width: 100%;
  }

  &.b-button-shape-round {
    border-radius: 1000px;
  }

  & .b-button-slot {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    transition: opacity .4s;


    &.b-button-slot-loading {
      opacity: 0;
    }
  }

  /**
   * Size Style
   */

  &.b-button-size-small {
    //margin: 2px 4px;
    min-width: 40px;
    line-height: 24px;
    height: 24px;
    font-size: 12px;

    .b-button-slot {
      padding: 0 8px;
    }
  }

  &.b-button-size-middle {
    //margin: 2px 4px;
    min-width: 68px;
    line-height: 32px;
    height: 32px;
    font-size: 12px;

    .b-button-slot {
      padding: 0 10px;
    }
  }

  &.b-button-size-default {
    //border: 1px solid #e5e5e5;
    //color: #888888;
    //background: #ffffff;
    min-width: 80px;
    line-height: 40px;
    height: 40px;
    font-size: 14px;

    .b-button-slot {
      padding: 0 12px;
    }
  }

  &.b-button-size-large {
    //margin: 2px 4px;
    min-width: 124px;
    line-height: 48px;
    height: 48px;
    font-size: 18px;

    .b-button-slot {
      padding: 0 14px;
    }
  }

  &.b-button-size-huge {
    //margin: 2px 4px;
    min-width: 124px;
    line-height: 60px;
    height: 60px;
    font-size: 20px;

    .b-button-slot {
      padding: 0 16px;
    }
  }

  //&:hover {
  //  //background: #004DE5;
  //  //color: #ffffff;
  //
  //  &.b-button-default {
  //    color: #505050;
  //    background: @background-default-color;
  //    border: 1px solid #797979;
  //  }
  //}
  //
  //&:active {
  //  background: #0046D0;
  //
  //}

  .b-button-loading {
    cursor: auto;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;

    .loading-svg {
      animation: loading-rotate 1.5s infinite ease-in-out;

      & > .path {
        stroke: rgba(255, 255, 255, 0.6);
        stroke-width: 5;
        animation: loading-dash 1.5s infinite ease-in-out;
      }

      &.b-button-size-small {
        width: 16px;
        height: 16px;
      }

      &.b-button-size-middle {
        width: 20px;
        height: 20px;
      }

      &.b-button-size-default {
        width: 24px;
        height: 24px;

        //circle {
        //  stroke: rgba(0, 70, 208, 0.6) !important;
        //}

        //& > .path {
        //  stroke: rgba(0, 0, 0, 0.6) !important;
        //  stroke-width: 5;
        //  animation: loading-dash 1.5s infinite ease-in-out;
        //}
      }

      &.b-button-size-large {
        width: 30px;
        height: 30px;

        //& > .path {
        //  stroke-width: 4;
        //}
      }

      &.b-button-size-huge {
        width: 34px;
        height: 34px;

        //& > .path {
        //  stroke-width: 4;
        //}
      }

      &.b-button-default, &.b-button-text {
        //circle {
        //  stroke: rgba(0, 70, 208, 0.6) !important;
        //}

        & > .path {
          stroke: rgba(0, 0, 0, 0.6) !important;
          stroke-width: 5;
          animation: loading-dash 1.5s infinite ease-in-out;
        }
      }
    }

    //.loading-css {
    //  box-sizing: border-box;
    //  width: 50px;
    //  height: 50px;
    //  display: inline-block;
    //  border: 5px solid #f3f3f3;
    //  border-top: 5px solid red;
    //  border-radius: 50%;
    //  /* 动画旋转效果 */
    //  animation: rotate-360 1s infinite linear;
    //  display: none;
    //}

    //@keyframes rotate-360 {
    //  0% {
    //    transform: rotate(0deg);
    //  }
    //  100% {
    //    transform: rotate(360deg);
    //  }
    //}
  }
}
