/*
 * <zf-radio> (RadioButtonTagHelper). Linked from every layout, beside checkbox.css.
 *
 * Checked state is read ONLY from the input (`.zf-radio__input:checked + .zf-radio__indicator`),
 * never from the server-rendered `.zf-radio--checked` class. That class is written once, at render
 * time, and nothing removes it on click — keyed on it, the first answer stayed painted beside the
 * new one, so two options looked chosen (measured in Chrome on Settings -> Payroll setup). The
 * input carries `checked` from the same render, so :checked covers first paint as well.
 *
 * Until 2026-09-23 no layout linked this file at all, and every <zf-radio> rendered as a bare
 * browser radio jammed against its label (found on Settings -> Payroll setup).
 */

/* Base radio button styles */
.zf-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.zf-radio--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zf-radio__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.zf-radio__label {
    font-size: 14px;
    color: inherit;
}

/* The input is visually hidden, so its keyboard focus has to be drawn on the indicator. */
.zf-radio__input:focus-visible + .zf-radio__indicator {
    outline: 2px solid var(--zf-primary);
    outline-offset: 2px;
}

/* Filled variant — an empty ring until chosen, then a filled disc with a dot. (It used to be a
   solid disc in BOTH states, which made an unchosen option look chosen.) */
.zf-radio--filled .zf-radio__indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--zf-primary);
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: background-color 0.2s ease, box-shadow 0.25s ease;
}

.zf-radio--filled .zf-radio__indicator::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--white, #fff);
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.zf-radio--filled .zf-radio__input:checked + .zf-radio__indicator {
    background-color: var(--zf-primary);
    animation: zf-radio-pulse 0.7s;
}

.zf-radio--filled .zf-radio__input:checked + .zf-radio__indicator::before {
    transform: scale(1);
}

/* Outlined variant */
.zf-radio--outlined .zf-radio__indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--zf-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.zf-radio--outlined .zf-radio__input:checked + .zf-radio__indicator {
    background-color: var(--zf-primary);
    border-color: transparent;
    transform: scale(0.8);
    box-shadow: 0 0 20px rgba(76, 139, 245, 0.5);
}

.zf-radio--outlined:not(.zf-radio--disabled):hover .zf-radio__indicator {
    transform: scale(1.2);
    border-color: #4c8bf5;
    box-shadow: 0 0 20px rgba(76, 139, 245, 0.5);
}

/* Gradient variant */
.zf-radio--gradient .zf-radio__indicator {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(to right bottom, #3fada7, var(--zf-primary));
    position: relative;
    flex-shrink: 0;
}

.zf-radio--gradient .zf-radio__indicator::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--light);
    transform: scale(1.1);
    transition: transform 0.25s ease;
}

.zf-radio--gradient .zf-radio__input:checked + .zf-radio__indicator::before {
    transform: scale(0);
}

@media (prefers-reduced-motion: reduce) {
    .zf-radio__indicator,
    .zf-radio__indicator::before {
        transition: none;
        animation: none !important;
    }
}

/* Pulse animation for filled variant */
@keyframes zf-radio-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 112, 209, 0.16);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(24, 112, 209, 0.16);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(24, 112, 209, 0.16);
    }
}
