/*
 * Beltchecker Brackets: one look for on/off settings and for picking items (Christian, 27 Nov 2026).
 *
 * Switch (iOS style): every setting. Applies to input.bk-switch and to any checkbox in a label.chk,
 *   unless the label is label.chk.pick. The native checkbox stays (appearance: none), so name/value,
 *   form posting, the label, the keyboard and the existing scripts all keep working.
 * Check (rounded box): picking items from a list (bulk select, category picks, screens to cycle,
 *   consent). input.bk-check, label.chk.pick and the select columns of the tables.
 *
 * Colours follow currentColor, so they work in the dark and the light theme without extra rules.
 * Loaded after the page's own stylesheet (brackets.php, bk_signup.php, bk_matcontrol.php, bk_follow.php).
 */

/* ---------------------------------------------------------------- switch */
input.bk-switch,
.chk:not(.pick) > input[type=checkbox] {
	-webkit-appearance: none; appearance: none;
	position: relative; flex: none; display: inline-block; vertical-align: middle;
	width: 42px; min-width: 42px; height: 26px; min-height: 26px; margin: 0; padding: 0;
	border: 0; border-radius: 999px; outline: none; cursor: pointer;
	background: color-mix(in srgb, currentColor 22%, transparent);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 10%, transparent);
	transition: background-color 150ms ease, box-shadow 150ms ease;
}
input.bk-switch::before,
.chk:not(.pick) > input[type=checkbox]::before {
	content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
	background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
	transition: transform 150ms ease;
}
input.bk-switch:checked,
.chk:not(.pick) > input[type=checkbox]:checked { background: #22a95a; box-shadow: none; }
input.bk-switch:checked::before,
.chk:not(.pick) > input[type=checkbox]:checked::before { transform: translateX(16px); }
input.bk-switch:active::before,
.chk:not(.pick) > input[type=checkbox]:active::before { width: 23px; }
input.bk-switch:checked:active::before,
.chk:not(.pick) > input[type=checkbox]:checked:active::before { transform: translateX(13px); }

/* ---------------------------------------------------------------- check */
input.bk-check,
.chk.pick > input[type=checkbox],
td.selcol input[type=checkbox], th.selcol input[type=checkbox],
.ppl input.poolsel,
.rr input[type=checkbox], .all input[type=checkbox],
.su-form .cat input[type=checkbox] {
	-webkit-appearance: none; appearance: none;
	position: relative; flex: none; display: inline-block; vertical-align: middle;
	width: 20px; min-width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0;
	border: 1.5px solid color-mix(in srgb, currentColor 42%, transparent); border-radius: 6px; outline: none; cursor: pointer;
	background: transparent no-repeat center / 14px 14px; box-shadow: none;
	transition: background-color 150ms ease, border-color 150ms ease;
}
input.bk-check:checked, input.bk-check:indeterminate,
.chk.pick > input[type=checkbox]:checked, .chk.pick > input[type=checkbox]:indeterminate,
td.selcol input[type=checkbox]:checked, th.selcol input[type=checkbox]:checked, th.selcol input[type=checkbox]:indeterminate,
.ppl input.poolsel:checked,
.rr input[type=checkbox]:checked, .all input[type=checkbox]:checked, .all input[type=checkbox]:indeterminate,
.su-form .cat input[type=checkbox]:checked {
	border-color: #5b8cff; background-color: #5b8cff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
input.bk-check:indeterminate, .chk.pick > input[type=checkbox]:indeterminate, th.selcol input[type=checkbox]:indeterminate, .all input[type=checkbox]:indeterminate {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- both */
input.bk-switch:focus-visible, .chk:not(.pick) > input[type=checkbox]:focus-visible,
input.bk-check:focus-visible, .chk.pick > input[type=checkbox]:focus-visible,
td.selcol input[type=checkbox]:focus-visible, th.selcol input[type=checkbox]:focus-visible,
.ppl input.poolsel:focus-visible, .rr input[type=checkbox]:focus-visible, .all input[type=checkbox]:focus-visible,
.su-form .cat input[type=checkbox]:focus-visible { outline: 2px solid #5b8cff; outline-offset: 2px; }
input.bk-switch:disabled, .chk:not(.pick) > input[type=checkbox]:disabled,
input.bk-check:disabled, .chk.pick > input[type=checkbox]:disabled,
.rr input[type=checkbox]:disabled, .all input[type=checkbox]:disabled { opacity: 0.45; cursor: not-allowed; }
.chk:has(> input[type=checkbox]:disabled) { cursor: not-allowed; }
.chk:has(> input[type=checkbox]) { cursor: pointer; }

/* A look-only switch (a row that opens something, e.g. Notifications in the app's This app panel) */
.bk-switch-look { position: relative; display: inline-block; flex: none; width: 42px; height: 26px; border-radius: 999px; background: color-mix(in srgb, currentColor 22%, transparent); transition: background-color 150ms ease; }
.bk-switch-look::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 150ms ease; }
.bk-switch-look.is-on { background: #22a95a; }
.bk-switch-look.is-on::before { transform: translateX(16px); }

@media (prefers-reduced-motion: reduce) {
	input.bk-switch, input.bk-switch::before, .chk > input[type=checkbox], .chk > input[type=checkbox]::before,
	input.bk-check, td.selcol input, th.selcol input, .ppl input.poolsel, .rr input, .all input, .su-form .cat input,
	.bk-switch-look, .bk-switch-look::before { transition: none !important; }
}
