/* Doroob checkbox - opt-in via class="dr-checkbox" (layout/default.html is shared with employer
   pages, so this is class-scoped rather than a global input[type=checkbox] rule).
   Mirrored in individual-frontend/assets/css/main.css (.dr-checkbox) - keep both in sync.
   The input itself stays transparent: ::before draws the 40px hover/pressed halo and ::after draws
   the 24px box on top of it, so the halo never needs a negative z-index behind the page.
   Unchecked disabled wasn't in the Figma set - it reuses the checked-disabled #E5E7EB fill. */
input[type="checkbox"].dr-checkbox {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    vertical-align: middle;
    cursor: pointer;
}

input[type="checkbox"].dr-checkbox::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
}

input[type="checkbox"].dr-checkbox::after {
    content: "";
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: 1px solid #6C737F;
    border-radius: 2px;
    background: transparent no-repeat center / 24px 24px;
    background-origin: border-box;
    pointer-events: none;
}

input[type="checkbox"].dr-checkbox:checked::after {
    border-color: #1B8354;
    background-color: #1B8354;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' fill-rule='evenodd' clip-rule='evenodd' d='M17.5945 7.53543C18.1352 8.07616 18.1352 8.95286 17.5945 9.4936L11.2483 15.8398C10.9886 16.0995 10.6365 16.2454 10.2692 16.2454C9.90201 16.2454 9.54983 16.0995 9.29016 15.8398L6.40554 12.9552C5.86482 12.4144 5.86482 11.5377 6.40554 10.997C6.94627 10.4563 7.82296 10.4563 8.36369 10.997L10.2692 12.9026L15.6363 7.53543C16.177 6.9947 17.0537 6.9947 17.5945 7.53543Z'/%3E%3C/svg%3E");
}

/* Hover / pressed halo */
input[type="checkbox"].dr-checkbox:not(:disabled):not([readonly]):not([aria-readonly="true"]):hover::before,
input[type="checkbox"].dr-checkbox:not(:disabled):not([readonly]):not([aria-readonly="true"]):active::before {
    background: #F3F4F6;
}

input[type="checkbox"].dr-checkbox:not(:disabled):not([readonly]):not([aria-readonly="true"]):not(:checked):active::after {
    background-color: #D2D6DB;
}

input[type="checkbox"].dr-checkbox:not(:disabled):not([readonly]):not([aria-readonly="true"]):checked:hover::after {
    border-color: #14573A;
    background-color: #14573A;
}

input[type="checkbox"].dr-checkbox:not(:disabled):not([readonly]):not([aria-readonly="true"]):checked:active::after {
    border-color: #104631;
    background-color: #104631;
}

input[type="checkbox"].dr-checkbox:focus {
    outline: none;
}

/* !important: custom.css / home.css ship a global *:focus { outline: none !important } that would
   otherwise win; our higher specificity decides between the two !important rules. */
input[type="checkbox"].dr-checkbox:focus:not(:active) {
    outline: 2px solid #161616 !important;
    outline-offset: 2px;
}

/* Read only - outlined box, green check */
input[type="checkbox"].dr-checkbox[readonly],
input[type="checkbox"].dr-checkbox[aria-readonly="true"] {
    cursor: default;
}

input[type="checkbox"].dr-checkbox[readonly]::after,
input[type="checkbox"].dr-checkbox[aria-readonly="true"]::after {
    border-color: #9DA4AE;
    background-color: transparent;
}

input[type="checkbox"].dr-checkbox[readonly]:checked::after,
input[type="checkbox"].dr-checkbox[aria-readonly="true"]:checked::after {
    border-color: #9DA4AE;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231B8354' fill-rule='evenodd' clip-rule='evenodd' d='M17.5945 7.53543C18.1352 8.07616 18.1352 8.95286 17.5945 9.4936L11.2483 15.8398C10.9886 16.0995 10.6365 16.2454 10.2692 16.2454C9.90201 16.2454 9.54983 16.0995 9.29016 15.8398L6.40554 12.9552C5.86482 12.4144 5.86482 11.5377 6.40554 10.997C6.94627 10.4563 7.82296 10.4563 8.36369 10.997L10.2692 12.9026L15.6363 7.53543C16.177 6.9947 17.0537 6.9947 17.5945 7.53543Z'/%3E%3C/svg%3E");
}

/* Disabled - grey fill (white check stays from :checked) */
input[type="checkbox"].dr-checkbox:disabled {
    cursor: not-allowed;
}

input[type="checkbox"].dr-checkbox:disabled::after {
    border-color: #E5E7EB;
    background-color: #E5E7EB;
}

/* Radio - focus ring only (no Figma radio states yet, native look kept). Opt-in via
   class="dr-radio": RadioSelect widgets get it through attrs, since bootstrap3/layout/radioselect.html
   is shared with employer forms. Shows on mouse and keyboard focus, hidden while pressed. */
input[type="radio"].dr-radio:focus {
    outline: none;
}

input[type="radio"].dr-radio:focus:not(:active) {
    outline: 2px solid #161616 !important;
    outline-offset: 2px;
}
