/**
 * Copyright 2016-present, Baifendian, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

@import '../variables.less';

.bfd-switch {
  cursor: pointer;
  margin: 0;
  height: 20px;
  line-height: 20px;
  display: inline-block;
  input {
    display: none;
    &:checked {
      + .bfd-switch__text {
        background-color: @success-color;
        padding-left: 8px;
        padding-right: 20px;
        &:before {
          left: calc(~"100% - 18px");
        }
      }
    }
  }
}

.bfd-switch__text {
  background-color: #ccc;
  display: inline-block;
  vertical-align: top;
  min-width: 40px;
  height: 100%;
  border-radius: 20px;
  padding: 0 8px;
  padding-left: 20px;
  color: #fff;
  position: relative;
  user-select: none;
  &:before {
    position: absolute;
    content: '';
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background-color: #fff;
    border-radius: 50%;
    transition: left .2s;
  }
}
