/*
 * AppKit form fields: ONE shared rule set, linked by layouts/user.blade.php (after rm-unify.css) and layouts/auth.blade.php (after appkit.css).
 *
 * Why: the template's .form-control is #ced4da on white (1.5:1) and transparent in dark, so inputs, selects, textareas and code boxes almost vanished.
 * Now every text-type field has
 *   - a border of at least 3:1 against every surface it sits on and against its own fill (WCAG 1.4.11): --rm-field-border,
 *   - a fill that differs from the card and the page surface: --rm-field-bg,
 *   - placeholder text of at least 4.5:1 on that fill: --rm-field-ph,
 *   - a 2px ring in the theme accent while focused: --rm-field-ring (accent in light, accent-dark in dark; both are tested for all 8 colours),
 *   - the same rules in dark mode (.theme-dark).
 * tests/Unit/Appkit/FieldContrastTest.php computes the ratios from THIS file and the boot table.
 *
 * Left alone on purpose: checkboxes, radios, switches, file, range and button inputs; a search input that lives inside its own bordered wrapper
 * (.rm-hub__search, the wrapper is restyled below instead); the country picker's search line; fields marked invalid keep their own error border.
 * Nothing here moves: no animation, no transition, no image, no address.
 */

:root {
    --rm-field-bg: #E2E7F0;
    --rm-field-border: #6B7280;
    --rm-field-ph: #5B6472;
    --rm-field-ring: var(--rm-accent, var(--brand-primary));
}
.theme-dark {
    --rm-field-bg: #2B3243;
    --rm-field-border: #8B93A3;
    --rm-field-ph: #A0A8B5;
    --rm-field-ring: var(--rm-accent-dark, var(--brand-primary));
}

/* ---------- The fill (every text-type field; a read-only field keeps its own muted fill) ---------- */
body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="color"], [type="reset"]), select, textarea):not([readonly], .rm-hub__search > input, .auth-picker-search) {
    background-color: var(--rm-field-bg) !important;
}

/* ---------- The border (an invalid field keeps the error border its page gives it) ---------- */
body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="color"], [type="reset"]), select, textarea):not([aria-invalid="true"], .is-invalid, .is-invalid input, .rm-hub__search > input, .auth-picker-search) {
    border-color: var(--rm-field-border) !important;
}

/* ---------- Placeholder text ---------- */
body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="color"], [type="reset"]), select, textarea):not(.rm-hub__search > input)::placeholder {
    color: var(--rm-field-ph) !important;
    opacity: 1;
}

/* ---------- Focus: a clear ring in the theme accent ---------- */
body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="color"], [type="reset"]), select, textarea):not(.rm-hub__search > input):focus {
    outline: 2px solid var(--rm-field-ring) !important;
    outline-offset: 1px;
    border-color: var(--rm-field-ring) !important;
}

/* ---------- The search box on Services: the wrapper is the field ---------- */
.rm-hub__search { background: var(--rm-field-bg) !important; box-shadow: inset 0 0 0 1.5px var(--rm-field-border) !important; }
.rm-hub__search input::placeholder { color: var(--rm-field-ph) !important; opacity: 1; }
.rm-hub__search:focus-within { box-shadow: inset 0 0 0 2px var(--rm-field-ring) !important; }
