@import 'common/var.scss';

.qf-switch {
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: 14px;
  line-height: 20px;
  height: 20px;
  vertical-align: middle
}

.qf-switch.is-disabled .qf-switch__core, .qf-switch.is-disabled .qf-switch__label {
  cursor: not-allowed
}

.qf-switch__core, .qf-switch__label {
  display: inline-block;
  cursor: pointer;
  vertical-align: middle
}

.qf-switch__label {
  transition: .2s;
  height: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #303133
}

.qf-switch__label.is-active {
  color: $--color-primary;
}

.qf-switch__label--left {
  margin-right: 10px
}

.qf-switch__label--right {
  margin-left: 10px
}

.qf-switch__label * {
  line-height: 1;
  font-size: 14px;
  display: inline-block
}

.qf-switch__input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  margin: 0
}

.qf-switch__input:focus ~ .qf-switch__core {
  outline: $--color-primary solid 1px
}

.qf-switch__core {
  margin: 0;
  position: relative;
  width: 48px;
  height: 24px;
  border: 1px solid #dcdfe6;
  outline: 0;
  border-radius: 12px;
  box-sizing: border-box;
  background: #dcdfe6;
  transition: border-color .3s, background-color .3s
}

.qf-switch__core .qf-switch__button {
  position: absolute;
  top: 1px;
  left: 1px;
  border-radius: 100%;
  transition: transform .3s;
  width: 20px;
  height: 20px;
  background-color: #fff
}

.qf-switch.is-checked .qf-switch__core {
  border-color: $--color-primary;
  background-color: $--color-primary;
}

.qf-switch.is-disabled {
  opacity: .6
}

.qf-switch--wide .qf-switch__label.qf-switch__label--left span {
  left: 10px
}

.qf-switch--wide .qf-switch__label.qf-switch__label--right span {
  right: 10px
}

.qf-switch .label-fade-enter, .qf-switch .label-fade-leave-active {
  opacity: 0
}
