/* Component: toggle — a big on/off switch (aria-pressed), from the trip cover toggle (lane UI-V).
   Used for guards, trip cover and the loan for this trip on the departure screen. */

.toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 64px;
  padding: var(--sp-3);
  border: 3px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: border-color var(--dur-1) var(--ease), background-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.toggle:hover:not(.is-disabled) {
  border-color: var(--sea-300);
}

.toggle:active:not(.is-disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--line);
}

.toggle.is-on {
  border-color: var(--sea-500);
  background: var(--sea-50);
  box-shadow: 0 3px 0 var(--sea-400);
}

.toggle.is-disabled {
  cursor: default;
  border-style: dashed;
  background: var(--loss-bg);
  box-shadow: none;
}

.toggle__icon {
  flex: none;
  font-size: 1.8rem;
  line-height: 1;
}

.toggle.is-disabled .toggle__icon {
  filter: grayscale(0.6);
  opacity: 0.7;
}

.toggle__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}

.toggle__title {
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.toggle__notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle__effect {
  font-size: var(--fs-sm);
  font-weight: 900;
  color: var(--sea-700);
  line-height: 1.3;
}

.toggle__sub {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.3;
}

.toggle__switch {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  width: 76px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--line);
  transition: background-color var(--dur-2) var(--ease);
}

.toggle__knob {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-2) var(--ease);
}

.toggle__state {
  width: 100%;
  padding: 0 12px 0 38px;
  font-weight: 900;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

.toggle.is-on .toggle__switch {
  background: var(--sea-500);
}

.toggle.is-on .toggle__knob {
  transform: translateX(40px);
}

.toggle.is-on .toggle__state {
  padding: 0 38px 0 12px;
  color: #ffffff;
}

.toggle.is-disabled .toggle__switch {
  opacity: 0.5;
}

@media (max-width: 37.5em) {
  .toggle {
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
  }

  .toggle__icon {
    font-size: 1.5rem;
  }

  .toggle__switch {
    width: 64px;
  }

  .toggle.is-on .toggle__knob {
    transform: translateX(28px);
  }

  .toggle__state {
    padding: 0 8px 0 34px;
    font-size: var(--fs-xs);
  }

  .toggle.is-on .toggle__state {
    padding: 0 34px 0 8px;
  }
}
