/* Adapted for WebVisualizer layout */
.theme-toggle-row {
  --theme-toggle-scale: 0.8;
  --theme-toggle-width: 72px;
  --theme-toggle-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  width: fit-content;
}

.theme-toggle-label {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
}

.theme-toggleWrapper {
  display: inline-block;
  align-items: center;
  width: calc(var(--theme-toggle-width) * var(--theme-toggle-scale));
  height: calc(var(--theme-toggle-height) * var(--theme-toggle-scale));
  overflow: visible;
}

.theme-toggleWrapper .theme-toggle__input {
  position: absolute;
  left: -9999px;
}

.theme-toggle {
  cursor: pointer;
  display: inline-block;
  position: relative;
  width: var(--theme-toggle-width);
  height: var(--theme-toggle-height);
  background-color: #8bd8ff;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: background-color 200ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
  transform: scale(var(--theme-toggle-scale));
  transform-origin: top left;
}

.theme-toggle:before {
  content: "☀";
  position: absolute;
  left: 10px;
  top: 9px;
  font-size: 14px;
  color: #ffd66b;
  opacity: 1;
  transition: opacity 180ms ease;
}

.theme-toggle:after {
  content: "☾";
  position: absolute;
  right: 10px;
  top: 9px;
  font-size: 14px;
  color: #dbeafe;
  opacity: 0.4;
  transition: opacity 180ms ease;
}

.toggle__handler {
  display: inline-block;
  position: relative;
  z-index: 1;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  background-color: #ffcf96;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform: rotate(-45deg);
}

.toggle__handler .crater {
  position: absolute;
  background-color: #e8cda5;
  opacity: 0;
  transition: opacity 200ms ease-in-out;
  border-radius: 100%;
}

.toggle__handler .crater--1 {
  top: 12px;
  left: 7px;
  width: 4px;
  height: 4px;
}

.toggle__handler .crater--2 {
  top: 19px;
  left: 15px;
  width: 5px;
  height: 5px;
}

.toggle__handler .crater--3 {
  top: 6px;
  left: 18px;
  width: 7px;
  height: 7px;
}

.star {
  position: absolute;
  background-color: #fff;
  transition: all 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
  border-radius: 50%;
}

.star--1 {
  top: 8px;
  left: 32px;
  z-index: 0;
  width: 24px;
  height: 2px;
}

.star--2 {
  top: 14px;
  left: 26px;
  z-index: 1;
  width: 24px;
  height: 2px;
}

.star--3 {
  top: 21px;
  left: 34px;
  z-index: 0;
  width: 24px;
  height: 2px;
}

.star--4,
.star--5,
.star--6 {
  opacity: 0;
  transition: all 300ms 0 cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.star--4 {
  top: 12px;
  left: 11px;
  z-index: 0;
  width: 2px;
  height: 2px;
  transform: translate3d(3px, 0, 0);
}

.star--5 {
  top: 24px;
  left: 17px;
  z-index: 0;
  width: 3px;
  height: 3px;
  transform: translate3d(3px, 0, 0);
}

.star--6 {
  top: 27px;
  left: 28px;
  z-index: 0;
  width: 2px;
  height: 2px;
  transform: translate3d(3px, 0, 0);
}

.theme-toggle__input:checked + .theme-toggle {
  background-color: #334155;
  border-color: rgba(148, 163, 184, 0.45);
}

.theme-toggle__input:checked + .theme-toggle:before {
  opacity: 0.35;
}

.theme-toggle__input:checked + .theme-toggle:after {
  opacity: 1;
}

.theme-toggle__input:checked + .theme-toggle .toggle__handler {
  background-color: #ffe5b5;
  transform: translate3d(34px, 0, 0) rotate(0);
}

.theme-toggle__input:checked + .theme-toggle .toggle__handler .crater {
  opacity: 1;
}

.theme-toggle__input:checked + .theme-toggle .star--1 {
  width: 2px;
  height: 2px;
}

.theme-toggle__input:checked + .theme-toggle .star--2 {
  width: 4px;
  height: 4px;
  transform: translate3d(-5px, 0, 0);
}

.theme-toggle__input:checked + .theme-toggle .star--3 {
  width: 2px;
  height: 2px;
  transform: translate3d(-7px, 0, 0);
}

.theme-toggle__input:checked + .theme-toggle .star--4,
.theme-toggle__input:checked + .theme-toggle .star--5,
.theme-toggle__input:checked + .theme-toggle .star--6 {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.theme-toggle__input:checked + .theme-toggle .star--4 {
  transition: all 300ms 200ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.theme-toggle__input:checked + .theme-toggle .star--5 {
  transition: all 300ms 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.theme-toggle__input:checked + .theme-toggle .star--6 {
  transition: all 300ms 400ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

[data-theme="dark"] .theme-toggle-label {
  color: var(--text-primary);
}
