/*
 * Site-wide checkbox styling so ticked vs. unticked is obvious in both themes.
 *
 * Native/Tailwind-forms checkboxes here were tinted with text-primary-600, which in this theme
 * is slate grey - so a checked box was a grey square on a grey panel. This replaces them with a
 * clearly outlined empty box when unticked and a solid blue box with a white tick when ticked.
 *
 * Checkboxes that are visually hidden and drive a custom control (toggle switches built with
 * sr-only/peer, Bootstrap custom-control-input) are left alone.
 */
input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input) {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-block;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    border: 2px solid #6b7280 !important;
    border-radius: 0.25rem;
    background-color: #ffffff !important;
    background-image: none !important;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 80% 80%;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

/* Keep the explicit small sizes some forms use (h-3 / h-3.5) readable but not oversized. */
input[type="checkbox"].h-3:not(.sr-only):not(.peer),
input[type="checkbox"].h-3\.5:not(.sr-only):not(.peer) {
    width: 0.95rem;
    height: 0.95rem;
    min-width: 0.95rem;
}

input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):hover {
    border-color: #2563eb !important;
}

input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):checked {
    border-color: #2563eb !important;
    background-color: #2563eb !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3.5 8.5l3 3 6-7' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e") !important;
}

/* "Some but not all" (e.g. module rows in User Group permissions). */
input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):indeterminate {
    border-color: #2563eb !important;
    background-color: #2563eb !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4 8h8' stroke='white' stroke-width='2.4' stroke-linecap='round'/%3e%3c/svg%3e") !important;
}

input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45) !important;
}

input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Dark theme: light outline on the dark panel, brighter blue when ticked. */
.dark input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input) {
    border-color: #9ca3af !important;
    background-color: #1f2937 !important;
}

.dark input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):hover {
    border-color: #60a5fa !important;
}

.dark input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):checked,
.dark input[type="checkbox"]:not(.sr-only):not(.peer):not(.hidden):not(.opacity-0):not(.custom-control-input):not(.custom-switch-input):indeterminate {
    border-color: #3b82f6 !important;
    background-color: #3b82f6 !important;
}
