.dark-mode-switch {
  display: inline;
  position: relative;
  float: right;
}

.dark-mode-switch-input {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
}

.dark-mode-switch-label {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  background-color: #2b2b2b;
  border: 5px solid #5b5b5b;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
  overflow: hidden;
}

.dark-mode-switch-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateX(-72%);
  display: block;
  width: 20px;
  height: 20px;
  background-color: #a9a9a9;
  border-radius: 9999px;
  box-shadow: 10px 0px 0 0 rgba(#000000, 0.2) inset;

  &::before,
  &::after {
    position: absolute;
    content: "";
    display: block;
    background-color: #2b2b2b;
    border-radius: 9999px;
    transition:
      opacity 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96),
      right 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96),
      bottom 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
  }

  &::after {
    bottom: 5px;
    right: -2px;
    width: 15px;
    height: 15px;
    background-color: #2b2b2b;
    opacity: 1;
  }
}

.dark-mode-switch-input:checked + .dark-mode-switch-label {
  background-color: #8fb5f5;
  border-color: #347cf8;

  .dark-mode-switch-indicator {
    background-color: #ecd21f;
    box-shadow: 0 0 12px #f5d63d;
    transform: translate(-50%, -50%) translateX(72%);

    &::before {
      opacity: 0;
    }
    &::after {
      opacity: 0;
      right: -10px;
    }
  }
}

.dark-mode-switch-indicator {
  &,
  &::before,
  &::after {
    transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
  }
}

.no-transition,
.no-transition * {
  transition: none !important;
}
