/* =============================================================================
 * components/form-field.css — labelled text-field primitive
 * =============================================================================
 *
 * Label-above-input pattern with a token-driven input surface: cream-400
 * border, --radius-lg, terracotta focus ring, peach error state (never
 * red — matches the learner dashboard's gravity-without-alarm rule).
 * Reusable across auth surfaces (login, password reset, invite accept,
 * 2FA verify), Profile field inputs in Phase 3 Commit 6+, and any later
 * tenant-admin form that needs a labelled text control.
 *
 * Applied via classnames on the widget's `attrs` in forms.py (see
 * apps/accounts/forms.py). The Django widget emits a standard <input>;
 * .form-field__input carries the visual contract.
 *
 * Structure:
 *   <div class="form-field [form-field--error]">
 *     <label class="form-field__label" for="…">Work email</label>
 *     <input class="form-field__input" id="…" …>
 *     <p class="form-field__error">…</p>    {# only when --error #}
 *   </div>
 *
 * Error signalling uses the peach scale (not --color-error). Red stays
 * reserved for destructive confirmations.
 * ============================================================================= */

.form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-field__label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--charcoal-700);
}

.form-field__input {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--cream-400);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    color: var(--color-text);
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base),
        background var(--transition-base);
}

.form-field__input::placeholder {
    color: var(--color-text-muted);
}

.form-field__input:hover {
    border-color: var(--charcoal-200);
}

.form-field__input:focus {
    outline: none;
    border-color: var(--charcoal-700);
}

/* Error state — peach tones. The field's own surface warms to peach-50
 * so the error is legible even at a glance; text stays charcoal-readable
 * via input color. Never --color-error (red) — red is reserved for
 * destructive confirmations per the learner dashboard's overdue rule. */
.form-field--error .form-field__input {
    border-color: var(--peach-500);
    background: var(--peach-50);
}

.form-field--error .form-field__input:focus {
    border-color: var(--peach-600);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--peach-500) 25%, transparent);
}

.form-field__error {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--peach-800);
}

.form-field__error svg {
    width: 0.9375rem;
    height: 0.9375rem;
    flex-shrink: 0;
}
