@import "../../style/themes/default";
@import "../../style/mixins/index";

@switchPrefixCls: ant-button-switch;

@duration: .3s;

.@{switchPrefixCls} {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  // width: 44px;
  // height: 22px;
  line-height: 1.5;
  vertical-align: middle;
  border-radius: 4px 4px;
  border: 1px solid @border-color-base;
  background-color: #fff;
  cursor: pointer;
  transition: all @duration cubic-bezier(0.35, 0, 0.25, 1);
  padding: 4px 10px;

  &:hover {
    border: 1px solid @primary-color;
  }

  &-inner {
    color: #666;
    font-size: 14px;
  }

  &-icon {
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 4px;
    border-radius: 6px 6px;
    content: " ";
    cursor: pointer;
    border: none;
    transform: scale(1);
    transition: left @duration cubic-bezier(0.35, 0, 0.25, 1);
    animation-timing-function: cubic-bezier(0.35, 0, 0.25, 1);
    animation-duration: @duration;
  }

  &:focus {
    box-shadow: 0 0 0 2px tint(@primary-color, 80%);
    outline: none;
  }

  &-checked {
    border: 1px solid @primary-color;

    &:hover {
      .@{switchPrefixCls}-inner {
        transition: color @duration ease-in-out;
        color: @primary-color;
      }
    }

    .@{switchPrefixCls}-inner {
      left: 6px;
      color: @primary-color-dark;
    }

    .@{switchPrefixCls}-icon {
      left: ~"calc(100% - 27px)";
    }

  }

  &-disabled {
    cursor: no-drop;
    background: #F7F7F7;
    border-color: #D9D9D9;

    .@{switchPrefixCls}-inner {
      color: @border-radius-base;
    }

    .@{switchPrefixCls}-icon {
      color: #ccc;
      background: #D9D9D9;
      animation-name: none;
      cursor: no-drop;

      &:hover {
        transform: scale(1);
        animation-name: none;
      }
    }

  }

  &-label {
    display: inline-block;
    line-height: 20px;
    font-size: 14px;
    padding-left: 10px;
    vertical-align: middle;
    white-space: normal;
    pointer-events: none;
    user-select: text;
  }
}

