/**
 * Unified custom checkbox component (on/off toggle).
 * Single source of truth for all frontend checkboxes (checkout, my account, auth, filters).
 */

/* Wrapper: flex so label + toggle sit side by side */
.custom-checkbox,
.rinno-custom-checkbox {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	position: relative;
}

/* Native input: visually hidden but covers wrapper so click on toggle/label toggles it */
.custom-checkbox__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	opacity: 0;
	z-index: 1;
	cursor: pointer;
}
.custom-checkbox__input:focus-visible {
	outline: none;
}

/* Label: clickable, wraps content */
.custom-checkbox__label {
	order: 1;
	flex: 1 1 auto;
	min-width: 0;
	cursor: pointer;
	margin: 0;
	font-weight: inherit;
	line-height: inherit;
}
.custom-checkbox__label a {
	text-decoration: underline;
}

/* Toggle pill (ON/OFF visual) */
.custom-checkbox__toggle {
	order: 0;
	flex-shrink: 0;
	width: 2.75rem;
	height: 1.5rem;
	border-radius: 999px;
	background-color: #d1d5db;
	position: relative;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.custom-checkbox__toggle::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: calc(1.5rem - 4px);
	height: calc(1.5rem - 4px);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s ease;
}

/* Checked (ON) */
.custom-checkbox__input:checked ~ .custom-checkbox__toggle {
	background-color: #0d9488;
}
.custom-checkbox__input:checked ~ .custom-checkbox__toggle::after {
	transform: translateX(1.25rem);
}

/* Focus-visible: ring on wrapper (input is overlaid when focused) */
.custom-checkbox:has(.custom-checkbox__input:focus-visible) .custom-checkbox__toggle {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0d9488;
	outline: none;
}

/* Disabled */
.custom-checkbox__input:disabled {
	cursor: not-allowed;
}
.custom-checkbox__input:disabled ~ .custom-checkbox__toggle {
	opacity: 0.6;
	cursor: not-allowed;
}
.custom-checkbox__input:disabled ~ .custom-checkbox__label {
	cursor: not-allowed;
	opacity: 0.8;
}

/* Error state (JS may add .has-error or .is-invalid to wrapper) */
.custom-checkbox.is-invalid .custom-checkbox__toggle,
.custom-checkbox.has-error .custom-checkbox__toggle {
	box-shadow: 0 0 0 2px #dc2626;
}
.custom-checkbox__error {
	margin: 0.25rem 0 0;
	font-size: 0.875rem;
	color: #dc2626;
	width: 100%;
	order: 10;
}
