/**
 * Light Dark Toggle für Elementor – Umschalter-Styles.
 *
 * Alle Größen und Farben laufen über CSS-Variablen, damit das Elementor-Widget
 * sie über {{WRAPPER}} setzen kann.
 */

.ldt-toggle {
	--ldt-size: 24px;
	--ldt-gap: 0.55em;
	--ldt-track-bg: #d6dae0;
	--ldt-track-bg-dark: #3d434e;
	--ldt-thumb-bg: #ffffff;
	--ldt-thumb-bg-dark: #ffffff;
	--ldt-icon-color: #f5a524;
	--ldt-icon-color-dark: #4b5563;
	--ldt-label-color: inherit;
	--ldt-label-color-dark: inherit;
	--ldt-speed: 250ms;
}

/*
 * Themes stylen <button> oft global (Hintergrund, Polsterung, Mindesthöhe,
 * Versalien). Der Reset läuft deshalb über button.ldt-toggle inkl. der
 * Interaktionszustände, damit davon nichts durchschlägt.
 */
button.ldt-toggle.ldt-toggle,
button.ldt-toggle.ldt-toggle:hover,
button.ldt-toggle.ldt-toggle:focus,
button.ldt-toggle.ldt-toggle:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ldt-gap);
	padding: 0;
	border-radius: 0;
	color: inherit;
	font: inherit;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transform: none;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}

/*
 * Diese Eigenschaften setzen Themes besonders gern mit !important – und keine
 * Widget-Option des Plugins vergibt sie, deshalb dürfen sie hart gesetzt werden.
 * Polsterung und Eckenradius bleiben bewusst außen vor, damit die
 * Elementor-Controls des Widgets weiter greifen.
 */
button.ldt-toggle.ldt-toggle,
button.ldt-toggle.ldt-toggle:hover,
button.ldt-toggle.ldt-toggle:focus,
button.ldt-toggle.ldt-toggle:active {
	width: auto !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	margin: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	letter-spacing: inherit !important;
	text-align: inherit !important;
	text-decoration: none !important;
	text-transform: none !important;
	text-shadow: none !important;
}

/* Vom Theme ergänzte Pseudo-Elemente (Icons, Overlays) ausblenden. */
button.ldt-toggle.ldt-toggle::before,
button.ldt-toggle.ldt-toggle::after {
	display: none !important;
	content: none !important;
}

button.ldt-toggle.ldt-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 4px;
}

/* --- Schalter ---------------------------------------------------------- */

.ldt-toggle__track {
	position: relative;
	flex: 0 0 auto;
	display: block;
	width: calc(var(--ldt-size) * 1.85);
	height: var(--ldt-size);
	border-radius: 999px;
	background: var(--ldt-track-bg);
	transition: background-color var(--ldt-speed) ease;
}

html[data-ldt-theme="dark"] .ldt-toggle__track {
	background: var(--ldt-track-bg-dark);
}

.ldt-toggle__thumb {
	position: absolute;
	top: 10%;
	left: 5%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--ldt-size) * 0.8);
	height: calc(var(--ldt-size) * 0.8);
	border-radius: 50%;
	background: var(--ldt-thumb-bg);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform var(--ldt-speed) ease, background-color var(--ldt-speed) ease;
}

html[data-ldt-theme="dark"] .ldt-toggle__thumb {
	background: var(--ldt-thumb-bg-dark);
	transform: translateX(calc(var(--ldt-size) * 0.95));
}

/* --- Icon-Variante ----------------------------------------------------- */

.ldt-toggle__icons {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--ldt-size);
	height: var(--ldt-size);
}

/* Etwas größere Klickfläche, ohne sichtbar zu werden. */
button.ldt-toggle.ldt-toggle.ldt-toggle--icon {
	padding: 0.35em;
}

/* --- Icons ------------------------------------------------------------- */

.ldt-toggle__icon {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ldt-icon-color);
	transition: opacity var(--ldt-speed) ease, transform var(--ldt-speed) ease, color var(--ldt-speed) ease;
}

.ldt-toggle__track .ldt-toggle__icon {
	font-size: calc(var(--ldt-size) * 0.45);
}

.ldt-toggle__icons .ldt-toggle__icon {
	font-size: var(--ldt-size);
}

.ldt-toggle__icon svg {
	display: block;
	width: 1em;
	height: 1em;
}

.ldt-toggle__icon i,
.ldt-toggle__icon svg {
	font-size: inherit;
}

.ldt-toggle__icon--dark {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

html[data-ldt-theme="dark"] .ldt-toggle__icon {
	color: var(--ldt-icon-color-dark);
}

html[data-ldt-theme="dark"] .ldt-toggle__icon--light {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}

html[data-ldt-theme="dark"] .ldt-toggle__icon--dark {
	opacity: 1;
	transform: none;
}

/* --- Beschriftung ------------------------------------------------------ */

.ldt-toggle__label {
	position: relative;
	display: inline-block;
	color: var(--ldt-label-color);
}

html[data-ldt-theme="dark"] .ldt-toggle__label {
	color: var(--ldt-label-color-dark);
}

.ldt-toggle__label-text--dark {
	display: none;
}

html[data-ldt-theme="dark"] .ldt-toggle__label-text--light {
	display: none;
}

html[data-ldt-theme="dark"] .ldt-toggle__label-text--dark {
	display: inline;
}

/* --- Button-Variante --------------------------------------------------- */

.ldt-toggle--button {
	--ldt-button-bg: rgba(0, 0, 0, 0.06);
	--ldt-button-bg-dark: rgba(255, 255, 255, 0.12);
}

button.ldt-toggle.ldt-toggle.ldt-toggle--button,
button.ldt-toggle.ldt-toggle.ldt-toggle--button:hover,
button.ldt-toggle.ldt-toggle.ldt-toggle--button:focus {
	padding: 0.55em 0.95em;
	border-radius: 999px;
	background: var(--ldt-button-bg) !important;
	transition: background-color var(--ldt-speed) ease;
}

html[data-ldt-theme="dark"] button.ldt-toggle.ldt-toggle.ldt-toggle--button,
html[data-ldt-theme="dark"] button.ldt-toggle.ldt-toggle.ldt-toggle--button:hover,
html[data-ldt-theme="dark"] button.ldt-toggle.ldt-toggle.ldt-toggle--button:focus {
	background: var(--ldt-button-bg-dark) !important;
}

/* --- Schwebender Umschalter -------------------------------------------- */

.ldt-floating {
	position: fixed;
	z-index: 9999;
}

.ldt-floating button.ldt-toggle.ldt-toggle,
.ldt-floating button.ldt-toggle.ldt-toggle:hover,
.ldt-floating button.ldt-toggle.ldt-toggle:focus {
	padding: 0.6rem;
	border-radius: 999px;
	background: var(--ldt-floating-bg, #ffffff) !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18) !important;
}

html[data-ldt-theme="dark"] .ldt-floating button.ldt-toggle.ldt-toggle,
html[data-ldt-theme="dark"] .ldt-floating button.ldt-toggle.ldt-toggle:hover,
html[data-ldt-theme="dark"] .ldt-floating button.ldt-toggle.ldt-toggle:focus {
	background: var(--ldt-floating-bg-dark, #2b303a) !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) !important;
}

.ldt-floating--bottom-right {
	right: 1.25rem;
	bottom: 1.25rem;
}

.ldt-floating--bottom-left {
	left: 1.25rem;
	bottom: 1.25rem;
}

.ldt-floating--top-right {
	top: 1.25rem;
	right: 1.25rem;
}

.ldt-floating--top-left {
	top: 1.25rem;
	left: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
	.ldt-toggle,
	.ldt-toggle * {
		transition: none !important;
	}
}
