* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.switchContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
:root {
  /* switch width */
  --switch-width: 200px;
  --switch-height: 100px;
}
label {
  position: relative;
  width: var(--switch-width);
  height: var(--switch-height);
  cursor: pointer;
  padding: 10px;
}
label input {
  position: relative;
  z-index: 1;
  appearance: none;
}
label input:checked ~ span {
  background-color: rgb(44, 255, 2);
  box-shadow: 0 10px 16px #15ff0070;
}
label span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(255, 0, 0);
  border-radius: 50px;
  display: flex;
  transition: 0.5s;
  align-items: center;
  box-shadow: 0 10px 16px #ff000070;
}
label span i {
  position: absolute;
  width: 70px;
  height: 70px;
  background-color: #fff;
  left: 10px;
  border-radius: 50%;
  transition: 0.5s;
}
label input:checked ~ span i {
  left: calc(var(--switch-width) - 80px);
}
