@import '~styles/config';

.switch {
  &__checkbox {
    display: none;

    height: 0;
    width: 0;
    visibility: hidden;
  }

  &__checkbox:checked + &__label .button {
    left: calc(100% - 2px);
    transform: translateX(-100%);
  }

  &__label {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    position: relative;
    width: 48px;
    height: 24px;
    border-radius: 100px;
    cursor: pointer;
    background: $color-grey400;
    transition: background-color 250ms ease-in-out;

    &.isOn {
      @include colorify('background-color');
    }
  }

  &__label .button {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 25px;
    background: #fff;
    transition: 250ms ease-in-out;
    box-shadow: 0 0 2px 0 rgba(10, 10, 10, 0.29);

    &:active,
    &:hover,
    &:focus {
      width: 25px;
    }
  }
}
