/* ============================================================
   form_eng.css — patient-facing form styles
   Mobile-first, single-column, large touch targets.
   ============================================================ */

/* ── Root / reset ─────────────────────────────────────────────────────────── */
:root {
    --fe-primary:    #1a6fb3;
    --fe-primary-dk: #155a94;
    --fe-danger:     #c0392b;
    --fe-success:    #27ae60;
    --fe-warn:       #e67e22;
    --fe-text:       #1a1a1a;
    --fe-muted:      #6b7280;
    --fe-border:     #d1d5db;
    --fe-bg:         #f8f9fa;
    --fe-card-bg:    #ffffff;
    --fe-radius:     12px;
    --fe-shadow:     0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Shell ────────────────────────────────────────────────────────────────── */
.fe-body {
    background: var(--fe-bg);
    font-family: "Open Sans", system-ui, sans-serif;
    color: var(--fe-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fe-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.fe-header {
    background: #fff;
    border-bottom: 1px solid var(--fe-border);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.fe-logo {
    font-family: "Blinker", "Lato", sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--fe-primary);
    letter-spacing: -0.02em;
}

.fe-header-subtitle {
    font-size: 0.8rem;
    color: var(--fe-muted);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.fe-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.fe-card {
    background: var(--fe-card-bg);
    border-radius: var(--fe-radius);
    box-shadow: var(--fe-shadow);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 560px;
}

.fe-card--terminal {
    text-align: center;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
.fe-form-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.fe-h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.fe-form-intro,
.fe-text {
    font-size: 0.95rem;
    color: var(--fe-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.fe-subtext {
    font-size: 0.9rem;
    color: var(--fe-muted);
    margin-bottom: 1.5rem;
}

.fe-text-small {
    font-size: 0.8rem;
    color: var(--fe-muted);
    margin-bottom: 0;
}

.fe-optional {
    font-size: 0.8rem;
    color: var(--fe-muted);
    font-weight: 400;
}

.fe-link {
    color: var(--fe-primary);
    text-decoration: underline;
}

.fe-code {
    font-size: 0.75rem;
    background: #f1f3f5;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    word-break: break-all;
}

.fe-divider {
    border: none;
    border-top: 1px solid var(--fe-border);
    margin: 1.5rem 0;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.fe-alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.fe-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--fe-danger);
}

/* ── Notice (informational, non-error) ────────────────────────────────────── */
.fe-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #92400e;
}

/* ── Form fields ──────────────────────────────────────────────────────────── */
.fe-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fe-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fe-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fe-text);
}

.fe-value-readonly {
    font-size: 0.95rem;
    color: var(--fe-muted);
    margin: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--fe-border);
}

.fe-input {
    border: 1.5px solid var(--fe-border);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.15s;
    background: #fff;
    color: var(--fe-text);
}

.fe-input:focus {
    outline: none;
    border-color: var(--fe-primary);
    box-shadow: 0 0 0 3px rgba(26, 111, 179, 0.12);
}

.fe-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.fe-input--number {
    max-width: 160px;
}

.fe-error {
    color: var(--fe-danger);
    font-size: 0.82rem;
    margin: 0;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.fe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.4rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.2;
    min-height: 52px;       /* large touch target */
}

.fe-btn--primary {
    background: var(--fe-primary);
    color: #fff;
    width: 100%;
}

.fe-btn--primary:hover {
    background: var(--fe-primary-dk);
}

.fe-btn--primary:active {
    transform: scale(0.98);
}

/* ── Yes / No buttons ─────────────────────────────────────────────────────── */
.fe-yn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.fe-btn--yn {
    background: #fff;
    color: var(--fe-primary);
    border: 2px solid var(--fe-primary);
    font-size: 1.1rem;
    padding: 1rem;
}

.fe-btn--yn:hover {
    background: var(--fe-primary);
    color: #fff;
}

.fe-btn--yn:active {
    transform: scale(0.97);
}

.fe-kbd-hint {
    font-size: 0.78rem;
    color: var(--fe-muted);
    text-align: center;
    margin-top: 0.25rem;
}

kbd {
    font-size: 0.75rem;
    background: #f1f3f5;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.1em 0.4em;
}

/* ── Choice cards ─────────────────────────────────────────────────────────── */
.fe-choices {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fe-btn--choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    background: #fff;
    color: var(--fe-text);
    border: 2px solid var(--fe-border);
    padding: 0.9rem 1rem;
    border-radius: 10px;
    width: 100%;
    min-height: unset;
}

.fe-btn--choice:hover {
    border-color: var(--fe-primary);
    background: #f0f7ff;
}

.fe-btn--choice:active {
    transform: scale(0.99);
}

.fe-choice-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.fe-choice-desc {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--fe-muted);
    margin-top: 0.2rem;
}

/* ── Multi-choice checkboxes ──────────────────────────────────────────────── */
.fe-choices--multi {
    gap: 0.5rem;
}

.fe-choice-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--fe-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.fe-choice-check:hover {
    border-color: var(--fe-primary);
    background: #f0f7ff;
}

.fe-choice-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--fe-primary);
}

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.fe-progress {
    margin-bottom: 1.75rem;
}

.fe-progress-text {
    font-size: 0.8rem;
    color: var(--fe-muted);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.fe-progress-track {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.fe-progress-fill {
    height: 100%;
    background: var(--fe-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 4px;
}

/* ── Question area ────────────────────────────────────────────────────────── */
.fe-question {
    margin-top: 0;
}

.fe-question-text {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.fe-question-subtext {
    font-size: 0.88rem;
    color: var(--fe-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.fe-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--fe-primary);
    border-radius: 50%;
    animation: fe-spin 0.6s linear infinite;
    margin: 0.5rem auto;
}

.htmx-request .fe-spinner {
    display: block;
}

@keyframes fe-spin {
    to { transform: rotate(360deg); }
}

/* ── Terminal screen icons ────────────────────────────────────────────────── */
.fe-terminal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.fe-terminal-icon--success {
    color: var(--fe-success);
}

.fe-terminal-icon--halt {
    color: var(--fe-warn);
}

/* ── Privacy note ─────────────────────────────────────────────────────────── */
.fe-privacy-note {
    font-size: 0.78rem;
    color: var(--fe-muted);
    margin-top: 1.5rem;
    line-height: 1.5;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.fe-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.78rem;
    color: var(--fe-muted);
    border-top: 1px solid var(--fe-border);
}

.fe-footer p {
    margin: 0;
}

/* ── Desktop refinements ──────────────────────────────────────────────────── */
@media (min-width: 640px) {
    .fe-main {
        padding: 3rem 1.5rem;
        align-items: center;
    }

    .fe-card {
        padding: 2.5rem 2.5rem;
    }

    .fe-form-title {
        font-size: 1.6rem;
    }

    .fe-h1 {
        font-size: 1.5rem;
    }
}
