@charset "UTF-8";
@import "common/var";
@import "mixins/button";
@import "mixins/mixins";
@import "mixins/utils";

@include newB(button) {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: rgba(0,109,155,1);
  border: 1px solid rgba(0,109,155,1);
  color: #fff;
  -webkit-appearance: none;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  transition: .1s;
  font-weight: $--button-font-weight;

  @include utils-user-select(none);
  & + & {
    margin-left: 10px;
  }

  @include button-size($--button-padding-vertical, $--button-padding-horizontal, $--button-font-size, $--button-border-radius);

  &:hover,
  &:focus {
    color: #fff;
    border-color: rgba(0,109,155,.85);
    background-color: rgba(0,109,155,.85);
  }

  &:active {
    color: #fff;
    border-color: #005C83;
    background-color: #005C83;
    outline: none;
  }

  &::-moz-focus-inner {
    border: 0;
  }

  & [class*="b-icon-"] {
    & + span {
      margin-left: 5px; 
    }
  }


  @include when(disabled) {
    &,
    &:hover,
    &:focus {
      color: #fff;
      cursor: not-allowed;
      background-image: none;
      background-color: rgba(0,109,155,.5);
      border: 1px solid transparent;
    }

    &.b-button--text {
      background-color: transparent;
    }
  }

  @include when(loading) {
    position: relative;
    pointer-events: none;

    &:before {
      pointer-events: none;
      content: '';
      position: absolute;
      left: -1px;
      top: -1px;
      right: -1px;
      bottom: -1px;
      border-radius: inherit;
    }
  }

  @include when(hover) {
    position: relative;
    border-color: rgba(0,109,155,.85);
    background-color: rgba(0,109,155,.85);
  }

  @include when(click) {
    position: relative;
    border-color: #005C83;
    background-color: #005C83;
  }

  @include m(border) {
    background: $--button-default-background-color;
    border: $--border-base;
    border-color: rgba(0,109,155,1);
    color: rgba(0,109,155,1);
    &:hover,
    &:focus {
      color: rgba(0,109,155,.85);
      border-color: rgba(0,109,155,.85);
      background: $--button-default-background-color;
    }

    &:active {
      color: #005C83;
      border-color: #005C83;
      background: $--button-default-background-color;
    }

    &.is-disabled {
      &,
      &:hover,
      &:focus,
      &:active {
        color: #c0c4cc;
        border-color: #c0c4cc;
        background: $--button-default-background-color;
      }
    }
  }

  @include m(gray) {
    color: rgba(0,0,0,0.25);;
    cursor: not-allowed;
    background-image: none;
    background-color: rgba(0,0,0,0.04);;
    border-color: rgba(217,217,217,1);

    &:hover,
    &:focus {
      color: rgba(0,0,0,0.25);;
      cursor: not-allowed;
      background-image: none;
      background-color: rgba(0,0,0,0.04);;
      border-color: rgba(217,217,217,1);
    }

    &:active {
      color: rgba(0,0,0,0.25);;
      cursor: not-allowed;
      background-image: none;
      background-color: rgba(0,0,0,0.04);;
      border-color: rgba(217,217,217,1);
    }

    &.is-disabled {
      &,
      &:hover,
      &:focus,
      &:active {
        background-color: rgba(0,0,0,0.04);;
        border-color: rgba(217,217,217,1);
        color: #c0c4cc;
      }
    }
  }

  @include m(secondary) {
    background: $--button-default-background-color;
    border: $--border-base;
    border-color: rgba(217,217,217,1);
    color: rgba(0,0,0,.65);
    &:hover,
    &:focus {
      border-color: rgba(217,217,217,.85);
      color: rgba(0,0,0,.5);
      background: $--button-default-background-color;
    }

    &:active {
      border-color: rgba(0,0,0,.25);
      color: rgba(0,0,0,.85);
      background: $--button-default-background-color;
    }

    &.is-disabled {
      &,
      &:hover,
      &:focus,
      &:active {
        color: #c0c4cc;
        border-color: #c0c4cc;
        background: $--button-default-background-color;
      }
    }
  }
  @include m(dashed) {
    color: rgba(0,0,0,0.65);
    background: $--button-default-background-color;
    border-style: dashed;
    border-color: #d9d9d9;

    &:hover,
    &:focus {
      color: rgba(0,0,0,0.45);
      background: $--button-default-background-color;
      border-style: dashed;
      border-color: #d9d9d9;
    }

    &:active {
      color: rgba(0,0,0,0.85);
      background: $--button-default-background-color;
      border-style: dashed;
      border-color: #d9d9d9;
    }

    &.is-disabled {
      &,
      &:hover,
      &:focus,
      &:active {
        border-style: dashed;
        background-color: transparent;
        border-color: #c0c4cc;
        color: #c0c4cc;
      }
    }
  }
  @include m(danger) {
    color: #fff;
    border-color: rgba(245,34,45,1);
    background-color: rgba(245,34,45,1);

    &:hover,
    &:focus {
      color: #fff;
      border-color: rgba(245,34,45,.85);
      background-color: rgba(245,34,45,.85);
    }

    &:active {
      color: #fff;
      border-color: #D01C26;
      background-color: #D01C26;
      outline: none; 
    }

    &.is-disabled {
      &,
      &:hover,
      &:focus,
      &:active {
        color: #eee;
        border-color: rgba(245,34,45,1);
        background-color: rgba(245,34,45,1);
      }
    }
  }
  @include m(big) {
    @include button-size(10px, 15px, 14px, $--button-small-border-radius);
  }
  @include m(small) {
    @include button-size(7px, 7px, 12px, $--button-small-border-radius);
  }

  @include m(text) {
    border-color: transparent;
    color: rgba(0,109,155,1);
    background: transparent;
    padding-left: 0;
    padding-right: 0;

    &:hover,
    &:focus {
      color: rgba(0,109,155,.85);
      border-color: transparent;
      background-color: transparent;
    }
    &:active {
      color: #005C83;
      border-color: transparent;
      background-color: transparent;
    }

    &.is-disabled,
    &.is-disabled:hover,
    &.is-disabled:focus {
      border-color: transparent;
    }
  }

  @each $type in (border, success, warning, danger, info) {
    .b-button--#{$type} {
      &:first-child {
        border-right-color: rgba($--color-white, 0.5);
      }
      &:last-child {
        border-left-color: rgba($--color-white, 0.5);
      }
      &:not(:first-child):not(:last-child) {
        border-left-color: rgba($--color-white, 0.5);
        border-right-color: rgba($--color-white, 0.5);
      }
    }
  }
}

@include newB(button-group) {
  @include utils-clearfix;
  display: inline-block;
  vertical-align: middle;

  & > .b-button {
    float: left;
    position: relative;
    & + .b-button {
      margin-left: 8px;
    }
    &.is-disabled {
      z-index: 1;
    }

    &:hover,
    &:focus,
    &:active {
      z-index: 1;
    }

    @include when(active) {
      z-index: 1;
    }
  }
  
  & > .b-dropdown {
    & > .b-button {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      border-left-color: rgba($--color-white, 0.5);
    }
  }

}
