.switch {
  display: inline-block;
  cursor: pointer;
  font-size: 20px;
  width: 2em;
  background: rgb(224, 222, 222);
  border-radius: 1em;

  input {
    position: absolute;
    opacity: 0;
  }

  div {
    height: 1em;
    width: 1em;
    border-radius: 1em;
    background: #fff;
    box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.5);
    -webkit-transition: all 300ms;
    -moz-transition: all 300ms;
    transition: all 300ms;
  }

  input:checked + div {
    -webkit-transform: translate3d(100%, 0, 0);
    -moz-transform: translate3d(100%, 0, 0);
    transform: translate3d(100%, 0, 0);
    background-color: $color-theme;
  }
}

.active__animation {
  animation: changeColor 1s infinite;
}

@keyframes changeColor {
  from {
    box-shadow: 0 0 20px 3px $color-active;
  }

  to {
    box-shadow: 0 0 5px 3px $color-active;
  }
}

.stop__animation {
  animation: changeColor 1s infinite;
}

@keyframes changeColor {
  from {
    box-shadow: 0 0 20px 3px $color-error;
  }

  to {
    box-shadow: 0 0 5px 3px $color-error;
  }
}

.radio {
  margin: 16px 0;

  &.radio-inline {
    display: inline-block;
  }

  input[type='radio'] {
    display: none;

    &:checked + label:before {
      border-color: $color-active;
      animation: ripple 0.2s linear forwards;
    }

    &:checked + label:after {
      transform: scale(1);
    }
  }

  label {
    display: inline-block;
    height: $radio-size;
    position: relative;
    padding: 0 ($radio-size + 10px);
    margin-bottom: 0;
    cursor: pointer;
    vertical-align: bottom;

    &:before,
    &:after {
      position: absolute;
      content: '';
      border-radius: 50%;
      transition: all 0.3s ease;
      transition-property: transform, border-color;
    }

    &:before {
      left: 0;
      top: 0;
      width: $radio-size;
      height: $radio-size;
      border: 2px solid $radio-border-color;
    }

    &:after {
      top: $radio-size / 2 - $radio-checked-size / 2;
      left: $radio-size / 2 - $radio-checked-size / 2;
      width: $radio-checked-size;
      height: $radio-checked-size;
      transform: scale(0);
      background: $color-active;
    }
  }

  @keyframes ripple {
    0% {
      box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0);
    }

    50% {
      box-shadow: 0px 0px 0px $radio-ripple-size rgba(78, 209, 84, 0.1);
    }

    100% {
      box-shadow: 0px 0px 0px $radio-ripple-size rgba(0, 0, 0, 0);
    }
  }
}

.checkbox {
  width: 300px;
  margin: 25px 0;
  display: flex;
  align-items: center;
  user-select: none;

  label {
    position: absolute;
    z-index: 10;
    padding-left: 30px;
    cursor: pointer;
  }

  input {
    opacity: 0;
    visibility: hidden;
    position: absolute;

    &:checked {
      ~ .check {
        border-color: $color-active;
        box-shadow: 0px 0px 0px 15px $color-active inset;

        &::after {
          opacity: 1;
          transform: scale(1);
        }
      }
    }
  }

  .check {
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-radius: 100px;
    background-color: $color-primary;
    border: 2px solid rgb(88, 88, 88);
    box-shadow: 0px 0px 0px 0px rgb(1, 255, 157) inset;
    transition: all 0.15s cubic-bezier(0, 1.05, 0.72, 1.07);

    &::after {
      content: '';
      width: 100%;
      height: 100%;
      opacity: 0;
      z-index: 10;
      position: absolute;
      transform: scale(0);
      background-size: 50%;
      background-image: url('http://moiza.ir/checkmark.svg');
      background-repeat: no-repeat;
      background-position: center;
      transition-delay: 0.2s !important;
      transition: all 0.25s cubic-bezier(0, 1.05, 0.72, 1.07);
    }
  }
}

.btn-hover {
  width: 200px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin: 20px;
  height: 50px;
  text-align: center;
  color: #fff;
  border: 0;
  outline: 0;
  padding: 10px 30px;
  border-radius: 3px;
}

.btn-hover:hover {
  opacity: 0.9;
}

.btn-hover:focus {
  outline: none;
}

.btn-hover.color {
  background-color: $color-theme;
}
