@import "mixins/mixins";
@import "common/var";

@include b(switch) {
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: $--switch-font-size;
  line-height: $--switch-height;
  height: $--switch-height;
  vertical-align: middle;
  @include when(disabled) {
    & .el-switch__core,
    & .el-switch__label {
      cursor: not-allowed;
    }
  }

  @include e(label) {
    transition: .2s;
    height: $--switch-height;
    display: inline-block;
    font-size: $--switch-font-size;
    cursor: pointer;
    color: $--color-text-primary;
    @include when(active) {
      color: $--color-primary;
    }
    @include m(left) {
      margin-left: 4px;
    }
    @include m(right) {
      margin-left: 24px;
    }
  }

  @include e(input) {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    margin: 0;
    //&:focus ~ .el-switch__core {
    //  outline: 1px solid $--color-primary;
    //}
  }

  @include e(core) {
    margin: 0;
    display: inline-block;
    position: relative;
    //min-width: $--switch-width !important;
    height: $--switch-height;
    border: 1px solid $--switch-off-color !important;
    outline: none;
    border-radius: $--switch-core-border-radius;
    box-sizing: border-box;
    background: $--switch-off-color !important;
    cursor: pointer;
    transition: border-color .3s, background-color .3s;
    vertical-align: middle;
    & .el-switch__label {
      font-size: 14px;
      line-height: $--switch-height;
      color: #ffffff;
    }
    & .el-switch__button {
      position: absolute;
      top: 1px;
      left: 1px;
      border-radius: $--border-radius-circle;
      transition: transform .3s;
      width: $--switch-button-size;
      height: $--switch-button-size;
      background-color: $--color-white;
    }
  }

  @include when(checked) {
    .el-switch__core {
      border-color: $--switch-on-color !important;
      background-color: $--switch-on-color !important;
    }
  }

  @include when(disabled) {
    opacity: 0.6;
    .el-switch__core {
      background: #EEEEEE !important;
      border-color: #EEEEEE !important;
      .el-switch__button {
        background-color: #F9FAFC;
      }
    }
  }
  //@include m(wide) {
  //  .el-switch__label {
  //    &.el-switch__label--left {
  //      span {
  //        left: 10px;
  //      }
  //    }
  //    &.el-switch__label--right {
  //      span {
  //        right: 10px;
  //      }
  //    }
  //  }
  //}

  & .label-fade-enter,
  & .label-fade-leave-active {
    opacity: 0;
  }
}
