@import '../../style/theme/index';

$switch-prefix-cls: #{$anna-prefix}-switch;

.#{$switch-prefix-cls} {
  box-sizing: border-box;
  position: relative;
  display: inline-block;
  overflow: hidden;
  &-default{
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
  }
  &-checked{
    & + .#{$switch-prefix-cls}-checkbox{
      background: $brand-color;

      &:before{
        transform: scale(0);
      }

      &:after{
        transform: translateX(20PX);
      }
    }
  }
  &-disabled{
    & + .#{$switch-prefix-cls}-checkbox{
      opacity: 0.3;
    }
  }
  &-checkbox{
    width: 51PX;
    height: 31PX;
    border-radius: 31PX;
    box-sizing: border-box;
    background: #e5e5e5;
    z-index: 0;
    margin: 0;
    padding: 0;
    appearance: none;
    border: 0;
    cursor: pointer;
    position: relative;
    transition: all 300ms;

    &:before{
      content: ' ';
      position: absolute;
      left: 1.5PX;
      top: 1.5PX;
      width: 48PX;
      height: 28PX;
      border-radius: 28PX;
      box-sizing: border-box;
      background: $light-base;
      z-index: 1;
      transition: all 200ms;
      transform: scale(1);
    }

    &:after{
      content: ' ';
      height: 28PX;
      width: 28PX;
      border-radius: 28PX;
      background: $light-base;
      position: absolute;
      z-index: 2;
      left: 1.5PX;
      top: 1.5PX;
      transform: translateX(0);
      transition: all 200ms;
      box-shadow: 2PX 2PX 4PX rgba(0, 0, 0, 0.21);
    }

    &.#{$switch-prefix-cls}-checkbox-disabled{
      z-index: 3;
    }
  }

  &-checked-small{
    & + .#{$switch-prefix-cls}-checkbox{
      background: $brand-color;

      &:before{
        transform: scale(0);
      }

      &:after{
        transform: translateX(16PX);
      }
    }
  }
  &-checkbox-small{
    width: 41PX;
    height: 25PX;
    border-radius: 25PX;
    &:before{
      content: ' ';
      position: absolute;
      left: 1.5PX;
      top: 1.5PX;
      width: 38PX;
      height: 22PX;
      border-radius: 22PX;
      box-sizing: border-box;
      background: $light-base;
      z-index: 1;
      transition: all 200ms;
      transform: scale(1);
    }

    &:after{
      content: ' ';
      height: 22PX;
      width: 22PX;
      border-radius: 22PX;
      background: $light-base;
      position: absolute;
      z-index: 2;
      left: 1.5PX;
      top: 1.5PX;
      transform: translateX(0);
      transition: all 200ms;
      box-shadow: 2PX 2PX 4PX rgba(0, 0, 0, 0.21);
    }
  }
}