/// ========================================================================
/// ZUI: switch.less
/// http://zui.sexy
/// ========================================================================
/// Copyright 2017 cnezsoft.com; Licensed MIT
/// ========================================================================


// Switch base style

.switch {
  position: relative;

  > input {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    display: block;
  }

  > label {
    display: block;
    padding: 5px 0 5px 35px;
    line-height: 20px;
    font-weight: normal;
    margin: 0;

    &:before,
    &:after {
      content: ' ';
      display: block;
      position: absolute;
      left: 0;
      top: 5px;
      height: 20px;
      border-radius: 10px;
      border: 1px solid #ddd;
      width: 30px;
      pointer-events: none;
      .transition-normal();
    }

    &:after {
      width: 18px;
      height: 18px;
      border-radius: 9px;
      top: 6px;
      border-color: #ccc;
      background-color: @color-white;
      box-shadow: rgba(0,0,0,.05) 0 1px 4px, rgba(0,0,0,.12) 0 1px 2px;
    }
  }

  > input:checked + label {
    &:before {
      background-color: @color-primary;
      border-color: @color-primary;
    }

    &:after {
      border-color: @color-white;
      left: 11px;
    }
  }

  &.text-left {
    > label {
      padding: 5px 35px 5px 0;

      &:before,
      &:after {
        right: 0;
        left: auto;
      }

      &:after {
        right: 12px;
      }
    }

    > input:checked + label {
      &:after {
        left: auto;
        right: 1px;
      }
    }
  }

  &.disabled {
    pointer-events: none;
  }

  &.disabled > label,
  > input[disabled] + label {
    pointer-events: none;
    color: @component-disabled-color;

    &:before {
      background-color: #fafafa;
    }

    &:after {
      opacity: .7;
    }
  }

  &.disabled > input:checked + label,
  > input[disabled]:checked + label {
    &:before {
      border-color: #ccc;
      background-color: #ccc;
    }
  }

  input:focus + label {
    color: @color-primary;

    &:before {
      border-color: @color-primary;
    }
  }
}



// switch inline
.switch-inline {
  display: inline-block;
}
