/* ==========================================================================
   Forms — Auth, CRUD, and shared form styles
   Extracted from main.css for modularity (v0.8.0)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Authentication Pages
   -------------------------------------------------------------------------- */
/*
 * ⛔ **THE AUTH CARD LIVED HERE AND IN `marketing-auth.css`, TWICE.** Nine rules
 * each, the same nine class names, 400px against 420px on two token families.
 * Moved to `components/auth-card.css`, which both base templates load — Design
 * 2.0, Batch 10. That file carries the full account.
 */
/* --------------------------------------------------------------------------
   Shared Form Controls
   -------------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ⛔ **A FIELD'S HINT IS TEXT, AND THE BROWSER'S OWN HINT IS A FIXED GREY.**
   Every field without a `::placeholder` rule got Chromium's #757575 — one
   value for both themes, on a ground that is not: 3.83:1 on the dark page,
   3.11:1 in a dark inset field, and 4.22:1 on the light page too. Named fields
   (`.capture__field`, `.jump__input`, …) keep their own, more specific rule.
   `opacity: 1` because Firefox fades the default. */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--background);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

/* ⛔ `--error-text`, never `--error`: an error's WORDS take the -text member,
   on its chip or, as here, on the plain ground. `--error` (#ef4444) is the
   status tone — 3.45:1 on the page ground, 3.76 on a card — for a rule, a dot,
   a fill. Measured 2026-10-06 by the sweep's "nameless person refused" state
   (tests/browser/test_every_word_reads_in_the_dark.py). */
.form-error {
    color: var(--error-text);
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Autosave status line — v0.80.0

   ⭐ TWO SCREENS SHOW THIS: the composer (`.composer__saved`) and focus mode
   (`.journal-footer-left .save-status`). The rules used to live only in
   journal-home.css, unscoped but loaded on exactly one page — so the composer
   could not see them, which is the same shape as the `.emotion-dot` and
   `.writing-prompt-context` bugs. tests/core/test_shared_css_is_actually_loaded.py
   is the register that catches the next one.

   ⛔ `.status-error` MUST stay louder than whatever the page mutes the line
   to. "Save failed" is the only signal that autosave stopped working, and both
   surfaces render the line quiet by default.
   -------------------------------------------------------------------------- */
.save-status {
    font-variant-numeric: tabular-nums;
}

.save-status.status-saving {
    color: var(--text-secondary);
}

/* ⚠️ The -text members, not the status tones: `--success` painted
   "Draft saved" at 2.09:1 on every autosave, and `--error` painted
   "Save failed" at 3.45:1 — the two lines the sweep could not reach, because
   each exists only after a save. Measured 2026-10-06,
   tests/browser/test_an_error_reads_when_it_happens.py. */
.save-status.status-saved {
    color: var(--success-text);
}

.save-status.status-error {
    color: var(--error-text);
}

/* ⭐ "Unsaved changes" — quieter than saved, louder than nothing. It is not a
   failure, so it must not read as one; it is also the only thing on screen
   saying the last 29 seconds are not written down yet.
   📐 docs/redesign/composer-flow-review.md, finding 5. */
.save-status.status-unsaved {
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Password visibility toggle — v0.31.0
   Eye-icon button rendered inside a relative-positioned wrapper around a
   password <input>. Paired with the password-toggle Stimulus controller
   at static/js/controllers/password_toggle_controller.js.
   QA closed-test feedback (Testers Community, 2026-05-22) flagged the
   missing show/hide affordance as a usability gap on the login form.
   -------------------------------------------------------------------------- */
/*
 * ⚠️ **THE PASSWORD EYE MOVED TO `components/auth-card.css`** (Batch 11). It
 * was defined here and in `marketing-auth.css`, and the only two templates that
 * carry its wrapper markup — `login.html` and `register.html` — are auth pages.
 * Two definitions for two templates, in files neither of them loaded together.
 */

.form-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Info Box (login, register)
   -------------------------------------------------------------------------- */
.info-box {
    background: var(--info-bg);
    border: 1px solid var(--info);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.info-box ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.info-box code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono, monospace);
}

.info-box--warning {
    background: rgba(232, 121, 121, 0.1);
    border-color: rgba(232, 121, 121, 0.3);
}

/* --------------------------------------------------------------------------
   CRUD Form Styles
   -------------------------------------------------------------------------- */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.crud-form {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-base);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--background);
    color: var(--text-color);
    resize: vertical;
}

.form-textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    min-height: 44px;
    background: var(--background);
    color: var(--text-color);
}

.form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 107, 89, 0.1);
}

.form-help {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-base);
    border-top: 1px solid var(--border-color);
}

/* ⛔ THE CONFIRM-DELETE RULES WERE HERE — `.confirm-delete-container`,
   `.confirm-delete-card` and its three children, and `.delete-form
   .form-actions`. Deleted 2026-08-25 with the centred card they styled; every
   confirmation in the product uses `components/confirm.css` now. See
   docs/features/confirmations.md. */

/* ── "or" between two ways of doing one thing ────────────────────────────
   A hairline, the word, a hairline. Used where a screen offers two equal
   starts (Quick Capture's *Capture* / *Say it*).
   ⚠️ The sign-in screens draw their own in `marketing-auth.css`
   (`.auth-divider`): that sheet is the marketing system, which the app CSS
   is kept apart from by design, so this is not a copy to merge into it. */
.or-divider {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.or-divider::before,
.or-divider::after {
    content: "";
    flex: 1;
    border-top: var(--border-width) solid var(--border-color);
}
