/*
 * Toggle switch component — ToggleTagHelper renders <toggle> as just the switch (a <label> wrapping a hidden
 * input + the switch visual). No label text of its own; the caller lays out any title/price around it.
 * Sizes: .toggle--md (default, matches the legacy switch) and .toggle--sm (slightly smaller).
 */

.toggle {
	display: inline-flex;
	align-items: center;
	position: relative;
	cursor: pointer;
	vertical-align: middle;
	width: fit-content;
}

.toggle__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

/* The switch: a pill track with a sliding Font Awesome icon (red cross off, green check on). */
.toggle__switch {
	flex: 0 0 auto;
	position: relative;
	background-color: var(--bs-block-bg);
	border: solid 2px var(--bs-border-color-inputs);
	transition: all 0.2s ease-in-out;
}

.toggle:hover .toggle__input:not(:disabled) ~ .toggle__switch {
	border-color: var(--bs-primary);
}

.toggle__switch::before {
	content: "\f057"; /* circle-xmark (off) */
	font-family: "Font Awesome 6 Pro";
	font-weight: 600;
	line-height: 1;
	color: var(--bs-danger);
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	transition: all 0.2s ease-in-out;
}

.toggle__input:checked ~ .toggle__switch::before {
	content: "\f058"; /* circle-check (on) */
	color: var(--bs-success);
}

.toggle__input:disabled ~ .toggle__switch {
	opacity: 0.35;
}

/* Locked = compulsory (basis): disabled but not dimmed. */
.toggle--locked .toggle__input:disabled ~ .toggle__switch {
	opacity: 1;
}

/* ---- Medium (default): matches the legacy 64x32 switch ---- */
.toggle--md .toggle__switch {
	width: 64px;
	height: 32px;
	border-radius: 16px;
}

.toggle--md .toggle__switch::before {
	font-size: 1.5rem;
	right: 34px;
}

.toggle--md .toggle__input:checked ~ .toggle__switch::before {
	right: 2px;
}

/* ---- Small ---- */
.toggle--sm .toggle__switch {
	width: 48px;
	height: 24px;
	border-radius: 12px;
}

.toggle--sm .toggle__switch::before {
	font-size: 1.15rem;
	right: 24px;
}

.toggle--sm .toggle__input:checked ~ .toggle__switch::before {
	right: 2px;
}
