@import "flive-vars";

.base {
  position: relative;
  margin-bottom: 0.2em;
  padding: 0 0 0 1.3em;
  > input {
    position: absolute;
    top: 0.25em;
    left: 0;
  }
  > label {
    cursor: pointer;
    user-select: none;
    display: inline-block;
  }
}

.toggle-switch {
  padding: 0;
  input {
    display: none;
  }
  label {
    position: relative;
    padding: .28em 0 0 4em;
    &:before {
      font-size: 0.9em;
      position: absolute;
      content: "";
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border: 1px solid $flive-dark-grey;
      background-color: $flive-dark-grey;
      -webkit-transition: .4s;
      transition: .4s;
      height: 2em;
      width: 3.5em;
      border-radius: 1em;
    }
    &:after {
      font-size: 0.9em;
      position: absolute;
      content: "";
      height: 1.6em;
      width: 1.6em;
      left: 0.2em;
      top: 0.2em;
      background-color: #fff;
      border: 1px solid #fff;
      -webkit-transition: .4s;
      transition: .4s;
      border-radius: 50%;
    }
  }

  input:checked + label {
    &:before {
      border: 1px solid $flive-blue;
      background-color: $flive-blue;
    }
    &:after {
      -webkit-transform: translateX(1.5em);
      -ms-transform: translateX(1.5em);
      transform: translateX(1.5em);
    }
  }

  input:focus + label:before {
    box-shadow: 0 0 1px $flive-blue;
  }

  input:disabled + label {
    cursor: not-allowed;
    &:before {
      border: 1px solid $flive-medium-grey;
      background-color: $flive-light-grey;
    }
    &:after {
      border: 1px solid $flive-medium-grey;
    }
  }
}
