/* Primary colour:
--ANUWD-01-variables-primary-colour

Focus ring variables (for accessibility) off by default:
--ANUWD-01-variables-primary-focous-ring-thickness
--ANUWD-01-variables-primary-focous-ring-colour

Scale for components, default 1:
--ANUWD-01-variables-component-scale */

/* Root base variables */
:root {
    /* Default light theme variables */
    --track-background-color: #f5f5f5;
    --ANUWD-01-ui-selection-controls-checkbox-tick-pill-background-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --track-background-color: #666666;
        --ANUWD-01-ui-selection-controls-checkbox-tick-pill-background-color: #e7e7e7;
    }
}

/* Scoped override */
[data-ANUWD-01-theme="light"] {
    --track-background-color: #f5f5f5;
    --ANUWD-01-ui-selection-controls-checkbox-tick-pill-background-color: #ffffff;
}

[data-ANUWD-01-theme="dark"] {
    --track-background-color: #666666;
    --ANUWD-01-ui-selection-controls-checkbox-tick-pill-background-color: #e7e7e7;
}

/* Toggle container */
.ANUWD-01-ui-selection-controls-checkbox {
    position: relative;
    display: inline-block;
    width: calc(19px * var(--ANUWD-01-variables-component-scale, 1));
    min-width: calc(19px * var(--ANUWD-01-variables-component-scale, 1));
    height: calc(19px * var(--ANUWD-01-variables-component-scale, 1));
    min-height: calc(19px * var(--ANUWD-01-variables-component-scale, 1));

    /* Prevent odd text/button highlighting and selecting */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.ANUWD-01-ui-selection-controls-checkbox input[type="checkbox"] {
    overflow: visible;
}

/* Hide default checkbox */
.ANUWD-01-ui-selection-controls-checkbox input {
    position: absolute;
    /* hidden but keeps it focusable for keyboard users */
    opacity: 0;
    width: 0;
    height: 0;
}

/* Box (background) */
.ANUWD-01-ui-selection-controls-checkbox .ANUWD-01-ui-selection-controls-checkbox-tick {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
    border-radius: calc(6px * var(--ANUWD-01-variables-component-scale, 1));
    overflow: hidden;
    box-shadow: inset 0 calc(2px * var(--ANUWD-01-variables-component-scale, 1)) calc(8px * var(--ANUWD-01-variables-component-scale, 1)) rgba(0, 0, 0, 0.25);
    background-color: var(--track-background-color);
    transition: background-color 0.15s, filter 0.15s, transform 0.2s, box-shadow 0.2s, outline 0.2s;

}

/* Checkmark (tick) */
.ANUWD-01-ui-selection-controls-checkbox input:checked+.ANUWD-01-ui-selection-controls-checkbox-tick::after {
    content: "";
    position: absolute;
    left: calc(6px * var(--ANUWD-01-variables-component-scale, 1));
    top: calc(2px * var(--ANUWD-01-variables-component-scale, 1));
    width: calc(5px * var(--ANUWD-01-variables-component-scale, 1));
    height: calc(10px * var(--ANUWD-01-variables-component-scale, 1));
    border: solid white;
    border-width: 0 calc(2px * var(--ANUWD-01-variables-component-scale, 1)) calc(2px * var(--ANUWD-01-variables-component-scale, 1)) 0;
    transform: rotate(45deg);
    transition: transform 0.15s;
}

/* Focus state */
.ANUWD-01-ui-selection-controls-checkbox input:focus+.ANUWD-01-ui-selection-controls-checkbox-tick {
    outline: calc(var(--ANUWD-01-variables-primary-focous-ring-thickness, 0) * var(--ANUWD-01-variables-component-scale, 1)) solid var(--ANUWD-01-variables-primary-focous-ring-colour, #007bff);
    outline-offset: calc(4px * var(--ANUWD-01-variables-component-scale, 1));
}

/* Checked state */
.ANUWD-01-ui-selection-controls-checkbox input:checked+.ANUWD-01-ui-selection-controls-checkbox-tick {
    background-color: var(--ANUWD-01-variables-primary-colour, #007bff);
}

/* Disabled state */
.ANUWD-01-ui-selection-controls-checkbox input:disabled+.ANUWD-01-ui-selection-controls-checkbox-tick {
    cursor: not-allowed;
    opacity: 0.5;
}

.ANUWD-01-ui-selection-controls-checkbox input:checked:disabled+.ANUWD-01-ui-selection-controls-checkbox-tick {
    background-color: var(--ANUWD-01-variables-primary-colour, #007bff);
}