/**
 * Toboo global checkbox style (black check box).
 */

:root {
	--toboo-check-size: 1.25rem;
	--toboo-check-border: 2px solid var(--tw-cyan, #c4cbd6);
	--toboo-check-radius: var(--tw-radius-card, 2.5rem);
	--toboo-check-bg: #fff;
	--toboo-check-fg: var(--tw-secondary, #1e1e21);
	--toboo-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23ffffff' d='M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z'/%3E%3C/svg%3E");
}

input[type='checkbox'],
input[type='checkbox'].form-check-input,
input[type='checkbox'].woocommerce-form__input-checkbox,
input[type='checkbox'].input-checkbox,
input[type='checkbox'].toboo-check__input {
	-webkit-appearance: none;
	appearance: none;
	width: var(--toboo-check-size);
	height: var(--toboo-check-size);
	min-width: var(--toboo-check-size);
	min-height: var(--toboo-check-size);
	margin: 0.15em 0.5rem 0 0;
	padding: 0;
	border: var(--toboo-check-border);
	border-radius: var(--toboo-check-radius);
	corner-shape: squircle;
	background-color: var(--toboo-check-bg);
	background-image: none;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 0.75rem;
	box-sizing: border-box;
	vertical-align: top;
	cursor: pointer;
	flex: 0 0 auto;
	float: none;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input[type='checkbox']:hover {
	border-color: var(--toboo-check-fg);
}

input[type='checkbox']:focus-visible {
	outline: 2px solid rgba(30, 30, 33, 0.45);
	outline-offset: 2px;
	border-color: var(--toboo-check-fg);
	box-shadow: none;
}

input[type='checkbox']:checked {
	border-color: var(--toboo-check-fg);
	background-color: var(--toboo-check-fg);
	background-image: var(--toboo-check-icon);
}

input[type='checkbox']:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Label layouts that wrap a checkbox. */
.toboo-check,
label.woocommerce-form__label-for-checkbox,
label.checkbox,
.form-check {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	cursor: pointer;
}

.toboo-check > input[type='checkbox'],
label.woocommerce-form__label-for-checkbox > input[type='checkbox'],
label.checkbox > input[type='checkbox'],
.form-check > input[type='checkbox'] {
	margin: 0.15em 0 0;
}

.toboo-check__label,
.form-check-label {
	display: block;
	line-height: 1.35;
	font-size: 0.9375rem;
	cursor: pointer;
}

/* Custom box used by enhanced checkbox markup (e.g. shipping default). */
.toboo-field-check__box {
	flex: 0 0 auto;
	align-self: flex-start;
	margin-top: 0.15em;
	width: var(--toboo-check-size);
	height: var(--toboo-check-size);
	border: var(--toboo-check-border);
	border-radius: var(--toboo-check-radius);
	corner-shape: squircle;
	background-color: var(--toboo-check-bg);
	background-image: none;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 0.75rem;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.toboo-field-check:hover .toboo-field-check__box {
	border-color: var(--toboo-check-fg);
}

.toboo-field-check:has(.toboo-field-check__input:focus-visible) {
	border-color: var(--toboo-check-fg);
	box-shadow: 0 0 0 0.25rem rgba(30, 30, 33, 0.2);
}

.toboo-field-check__input:focus-visible + .toboo-field-check__box {
	border-color: var(--toboo-check-fg);
	box-shadow: none;
}

.toboo-field-check__input:checked + .toboo-field-check__box {
	border-color: var(--toboo-check-fg);
	background-color: var(--toboo-check-fg);
	background-image: var(--toboo-check-icon);
}

/* Hide native input when a sibling visual box/icon is used. */
.toboo-field-check .toboo-field-check__input[type='checkbox'],
.toboo-field-check .toboo-field-check__input[type='radio'] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 1px !important;
	height: 1px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	clip: rect(0, 0, 0, 0);
	overflow: hidden;
}
