@mixin switch {
  $switch-size: 18px;
  $border-size: 2px;

  width: $switch-size*2;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;

  input {
    display: none;
  }

  label {
    display: block;
    height: $switch-size;
    cursor: pointer;
    border: 2px solid rgba($light-grey, 0.2);
    border-radius: 0;
    padding: 0;
    margin: 0;
    position: relative;

    .inner {
      display: block;
      width: 200%;
      margin-left: -100%;

      @include transition( margin 0.3s ease-in 0s);
    }

    .switch {
      display: block;
      width: $switch-size;
      margin: 0;
      background: lighten($grey, 20%);
      position: absolute;
      top: -$border-size;
      bottom: -$border-size;
      right: 18px;

      @include transition(all 0.3s ease-in 0s);
    }

    .text {
      position: absolute;
      top: 0;
      left: $switch-size*2.5;
      line-height: $switch-size - $border-size;
    }
  }

  input:checked {
    & + .label .inner {
      margin-left: 0;
    }

    & + .label .switch {
      right: -$border-size;
      background-color: $primary-colour;
    }
  }
}
