/* TechLine Theme Switch – pill + theme transition */

.tlts-switch-wrap {
  display: flex;
  width: 100%;
  align-items: center;
}

.tlts-switch {
  /* Defaults – TechLine header switch */
  --tlts-w: 4rem;
  --tlts-h: 2rem;
  --tlts-pad: 0.25rem;
  --tlts-radius: 999px;
  --tlts-knob: 1.5rem;
  --tlts-knob-radius: 999px;
  --tlts-icon-size: 1rem;
  --tlts-border-w: 1px;
  --tlts-track-bg-light: #ffffff;
  --tlts-track-bg-dark: #1a1a1a;
  --tlts-border-light: #e4e4e7;
  --tlts-border-dark: rgba(255, 255, 255, 0.12);
  --tlts-knob-bg-light: #e5e7eb;
  --tlts-knob-bg-dark: #2a2a2a;
  --tlts-icon-on-light: #374151;
  --tlts-icon-on-dark: #ffffff;
  --tlts-icon-off-light: #0a0a0a;
  --tlts-icon-off-dark: #7a7a7a;
  --tlts-hover: #238f99;
  --tlts-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --tlts-dur: 0.35s;
  --tlts-travel: calc(var(--tlts-w) - var(--tlts-knob) - (var(--tlts-pad) * 2));

  /* Explicit reset (kein all:unset – bricht Elementor-Overrides) */
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative;
  width: var(--tlts-w) !important;
  height: var(--tlts-h) !important;
  min-width: var(--tlts-w) !important;
  min-height: var(--tlts-h) !important;
  max-width: none !important;
  max-height: none !important;
  padding: var(--tlts-pad) !important;
  margin: 0 !important;
  border-radius: var(--tlts-radius) !important;
  border-style: solid !important;
  border-width: var(--tlts-border-w) !important;
  border-color: var(--tlts-border-light) !important;
  background: var(--tlts-track-bg-light) !important;
  background-image: none !important;
  color: var(--tlts-icon-on-light) !important;
  box-shadow: none;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  line-height: 1 !important;
  font: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  text-decoration: none !important;
  text-shadow: none !important;
  text-align: center;
  vertical-align: middle;
  transition:
    background-color var(--tlts-dur) var(--tlts-ease),
    border-color var(--tlts-dur) var(--tlts-ease),
    box-shadow var(--tlts-dur) var(--tlts-ease),
    color var(--tlts-dur) var(--tlts-ease);
}

html[data-theme="dark"] .tlts-switch {
  background: var(--tlts-track-bg-dark) !important;
  border-color: var(--tlts-border-dark) !important;
  color: var(--tlts-icon-on-dark) !important;
}

html[data-theme="light"] .tlts-switch {
  background: var(--tlts-track-bg-light) !important;
  border-color: var(--tlts-border-light) !important;
  color: var(--tlts-icon-on-light) !important;
}

.tlts-switch:hover {
  border-color: var(--tlts-hover) !important;
  box-shadow: 0 0 0 3px rgba(35, 143, 153, 0.12);
}

.tlts-switch:focus {
  outline: none;
}

.tlts-switch:focus-visible {
  outline: 2px solid var(--tlts-hover);
  outline-offset: 2px;
}

.tlts-switch__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tlts-switch__knob,
.tlts-switch__ghost {
  display: grid;
  place-items: center;
  width: var(--tlts-knob);
  height: var(--tlts-knob);
  border-radius: var(--tlts-knob-radius);
  flex-shrink: 0;
  transition:
    transform var(--tlts-dur) var(--tlts-ease),
    background-color var(--tlts-dur) var(--tlts-ease);
}

.tlts-switch__knob {
  z-index: 1;
  background: var(--tlts-knob-bg-dark);
  transform: translateX(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

html[data-theme="light"] .tlts-switch__knob {
  background: var(--tlts-knob-bg-light);
  transform: translateX(var(--tlts-travel));
}

html[data-theme="dark"] .tlts-switch__ghost {
  transform: translateX(0);
  background: transparent;
}

html[data-theme="light"] .tlts-switch__ghost {
  transform: translateX(calc(-1 * var(--tlts-travel)));
  background: transparent;
}

.tlts-switch__glyph {
  grid-area: 1 / 1;
  width: var(--tlts-icon-size);
  height: var(--tlts-icon-size);
  display: block;
  line-height: 0;
  transition: opacity 0.2s var(--tlts-ease), color 0.2s var(--tlts-ease);
}

.tlts-switch__glyph svg,
.tlts-switch__glyph i,
.tlts-switch__glyph .e-font-icon-svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
  fill: currentColor;
}

/* Active icon in knob */
html[data-theme="dark"] .tlts-switch__knob .tlts-switch__glyph--moon {
  opacity: 1;
  color: var(--tlts-icon-on-dark);
}
html[data-theme="dark"] .tlts-switch__knob .tlts-switch__glyph--sun {
  opacity: 0;
}
html[data-theme="light"] .tlts-switch__knob .tlts-switch__glyph--sun {
  opacity: 1;
  color: var(--tlts-icon-on-light);
}
html[data-theme="light"] .tlts-switch__knob .tlts-switch__glyph--moon {
  opacity: 0;
}

/* Inactive icon in ghost slot */
html[data-theme="dark"] .tlts-switch__ghost .tlts-switch__glyph--sun {
  opacity: 1;
  color: var(--tlts-icon-off-dark);
}
html[data-theme="dark"] .tlts-switch__ghost .tlts-switch__glyph--moon {
  opacity: 0;
}
html[data-theme="light"] .tlts-switch__ghost .tlts-switch__glyph--moon {
  opacity: 1;
  color: var(--tlts-icon-off-light);
}
html[data-theme="light"] .tlts-switch__ghost .tlts-switch__glyph--sun {
  opacity: 0;
}

/* Icon-only button */
.tlts-switch--button {
  width: var(--tlts-h) !important;
  min-width: var(--tlts-h) !important;
  padding: 0 !important;
}

.tlts-switch__single {
  display: grid;
  place-items: center;
  width: var(--tlts-icon-size);
  height: var(--tlts-icon-size);
}

.tlts-switch__icon-dark,
.tlts-switch__icon-light {
  grid-area: 1 / 1;
  transition: opacity 0.2s var(--tlts-ease);
}

html[data-theme="dark"] .tlts-switch__icon-dark { opacity: 1; }
html[data-theme="dark"] .tlts-switch__icon-light { opacity: 0; }
html[data-theme="light"] .tlts-switch__icon-dark { opacity: 0; }
html[data-theme="light"] .tlts-switch__icon-light { opacity: 1; }

/* ---- Theme transition overlays ---- */
.tlts-theme-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
  opacity: 0;
  background: #141414;
  transition: opacity 0.32s var(--tlts-ease);
  will-change: opacity;
}
.tlts-theme-overlay.is-visible {
  opacity: 1;
}
.tlts-theme-overlay[data-target="light"] {
  background: #ffffff;
}

html.tlts-theme-fading {
  transition: none;
}
html.tlts-theme-fading body {
  transition: opacity 0.2s var(--tlts-ease);
  opacity: 0.3;
}

@supports (view-transition-name: none) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.45s;
    animation-timing-function: var(--tlts-ease);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tlts-switch,
  .tlts-switch__knob,
  .tlts-switch__ghost,
  .tlts-switch__glyph,
  .tlts-theme-overlay,
  html.tlts-theme-fading body {
    transition: none !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}
