@charset "utf-8";

.x-switch {
  display: block;
  width: 100px;
  height: 54px;
  background-color: #ddd;
  border-radius: 27px;
  transition: all 0.3s ease-out;
  position: relative;
  box-shadow: 0 0 0 0 rgba(0, 187, 68, 0) inset;
  > em {
    display: block;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    position: absolute;
    left: 4px;
    top: 4px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    transition: all 0.3s ease-out;
  }
  &--active {
    box-shadow: 0 0 0 30px rgba(0, 187, 68, 1) inset;
    background-color: #00bb55;
    em {
      transform: translate(46px, 0);
    }
  }
  &--icon {
    > em {
      background-image: url('./icon-no-check.png');
    }
    &.x-switch--active {
      > em {
        background-image: url('./icon-checked.png');
      }
    }
  }
  &--disabled {
    pointer-events: none;
    opacity: 0.5;
  }
  &--io {
    width: 120px;
    sub, sup {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      font-style: normal;
      color: #fff;
      padding: 0 20px;
      font-size: 24px;
      transition: opacity 0.2s ease-out;
      opacity: 0;
    }
    sub {
      justify-content: flex-end;
      opacity: 1;
    }
    &.x-switch--active {
      sub {
        opacity: 0;
      }
      sup {
        opacity: 1;
      }
      em {
        transform: translate(66px, 0);
      }
    }
  }
}
