/*
 * zg-checkbox.css (2026-11-29, the owner)
 *
 * Every checkbox on the site: a WHITE check on the brand blue when checked.
 * Chrome draws a black tick when accent-color is a light blue like #01aade,
 * which nobody can read, so the box is drawn here instead (appearance: none
 * plus a white SVG check as the background image).
 *
 * Loaded by every layout (public, client dashboard, shop, admin, auth) BEFORE
 * the page stacks, so a page that styles its own checkbox still wins.
 *
 * Left alone on purpose:
 *   - Bootstrap toggle switches (.form-switch, role="switch"): they keep
 *     their knob, only the "on" color becomes the brand blue.
 *   - Hidden inputs behind a custom chip or switch (opacity 0, display none):
 *     nothing here shows them again.
 *
 * Specificity is kept at one attribute (the input and the :where parts add
 * nothing), the same weight as one class, so any class based page rule that
 * comes later still decides its own size and colors. Bootstrap's own
 * .form-check-input loads earlier, so this sheet still wins over it.
 */

:root {
    --zgcb-on: #01aade;
    --zgcb-on-hover: #0085ae;
    --zgcb-ring: #0085ae;
    --zgcb-off-border: #94a3b8;
    --zgcb-off-bg: #ffffff;
    --zgcb-disabled: #cbd5e1;
    --zgcb-disabled-bg: #f1f5f9;
    --zgcb-check: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M5 10.4l3.3 3.3L15 7'/%3e%3c/svg%3e");
    --zgcb-dash: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' d='M5.5 10h9'/%3e%3c/svg%3e");
    --zgcb-dot: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23ffffff'/%3e%3c/svg%3e");
}

/* ---- The box ---- */
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    padding: 0;
    border: 2px solid var(--zgcb-off-border);
    border-radius: 5px;
    background-color: var(--zgcb-off-bg);
    background-image: none;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    vertical-align: middle;
    cursor: pointer;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}

/* Bootstrap floats its box beside the label: line the 20px box up with the
   text, and keep a gap before the label (the bigger box would touch it). */
:where(input)[type="checkbox"]:where(.form-check-input):where(:not(.form-switch *, [role="switch"])) {
    margin-top: .125em;
    margin-right: .5em;
}

/* Admin dark mode: a dark empty box (zero extra weight, so it sits on the base). */
:where(body.dark-mode) :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])) {
    background-color: #1f2937;
    border-color: #6b7280;
}

:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):hover:not(:disabled) {
    border-color: var(--zgcb-on);
}

/* ---- Checked: white check on blue ---- */
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):checked {
    background-color: var(--zgcb-on);
    border-color: var(--zgcb-on);
    background-image: var(--zgcb-check);
}

/* ---- Some, not all (a "select all" box): white dash on blue ---- */
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):indeterminate {
    background-color: var(--zgcb-on);
    border-color: var(--zgcb-on);
    background-image: var(--zgcb-dash);
}

:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):checked:hover:not(:disabled),
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):indeterminate:hover:not(:disabled) {
    background-color: var(--zgcb-on-hover);
    border-color: var(--zgcb-on-hover);
}

/* ---- Keyboard focus ---- */
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):focus-visible {
    outline: 2px solid var(--zgcb-ring);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(1, 170, 222, .18);
}

/* ---- Disabled: greyed, no pointer ---- */
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):disabled {
    cursor: default;
    background-color: var(--zgcb-disabled-bg);
    border-color: var(--zgcb-disabled);
    opacity: 1;
}
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):checked:disabled,
:where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):indeterminate:disabled {
    background-color: var(--zgcb-disabled);
    border-color: var(--zgcb-disabled);
}

/* Admin dark mode keeps the blue when checked (beats the dark mode sheets). */
body.dark-mode :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):checked,
body.dark-mode :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):indeterminate {
    background-color: var(--zgcb-on);
    border-color: var(--zgcb-on);
}
body.dark-mode :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):disabled {
    background-color: #374151;
    border-color: #4b5563;
}
body.dark-mode :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):checked:disabled,
body.dark-mode :where(input)[type="checkbox"]:where(:not(.form-switch *, [role="switch"])):indeterminate:disabled {
    background-color: #4b5563;
    border-color: #4b5563;
}

/* ---- Bootstrap: switches and radios turn brand blue when on ---- */
.form-check-input:checked {
    background-color: var(--zgcb-on);
    border-color: var(--zgcb-on);
}
.form-check-input:focus {
    border-color: var(--zgcb-on);
    box-shadow: 0 0 0 .25rem rgba(1, 170, 222, .25);
}
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2301aade'/%3e%3c/svg%3e");
}
/* A Bootstrap radio keeps its white dot even where a page paints the checked
   state with a gradient (that wiped the dot out). */
.form-check-input[type="radio"]:checked {
    background-image: var(--zgcb-dot);
}

/* Plain radios are left native on purpose: Chrome draws a dark ring around a
   light accent color, which looks worse than the browser default. */
