.composer-toggle-switch {
  --toggle-switch-width: 52px;
  --toggle-switch-height: 26px;
  justify-content: center;
  display: flex;
  align-items: center;
  border: 0;
  padding: 0;
  margin-left: var(--space-2);
  background: transparent;

  &:focus-visible {
    outline: none;
  }

  &[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &__slider {
    display: inline-block;
    background: var(--primary-low);
    width: var(--toggle-switch-width);
    height: var(--toggle-switch-height);
    position: relative;
    vertical-align: middle;
    border-radius: var(--d-border-radius);

    :focus-visible & {
      outline: 2px solid var(--tertiary);
      outline-offset: 2px;
    }

    &:hover {
      background: var(--d-hover);
    }

    &:active {
      background-color: var(--primary-low);
    }

    &::before {
      content: "";
      display: block;
      position: absolute;
      background-color: var(--tertiary-low);
      width: calc(var(--toggle-switch-height) - var(--space-half));
      height: calc(var(--toggle-switch-height) - var(--space-1));
      top: var(--space-half);
      border-radius: var(--d-border-radius);
      box-shadow: 0 1px 2px 1px rgb(var(--tertiary-rgb), 0.2);

      .--markdown & {
        transform: translateX(0.125rem);
      }

      .--rte & {
        transform: translateX(
          calc(var(--toggle-switch-width) - var(--toggle-switch-height))
        );
      }
    }
  }

  &__left-icon,
  &__right-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    height: 100%;
    width: calc(var(--toggle-switch-height) - var(--space-half));
    color: var(--primary-high);

    .d-icon {
      vertical-align: text-bottom;
    }

    @media (prefers-reduced-motion: reduce) {
      transition-duration: 0ms;
    }
  }

  &__left-icon {
    left: var(--space-half);

    .--markdown & {
      color: var(--primary);
    }
  }

  &__right-icon {
    right: var(--space-half);

    .--rte & {
      color: var(--primary);
    }
  }
}
