/* RFM Forms, visual tokens come from the active child theme via CSS variables.
   Override --rfm-form-* in your theme's :root to brand it. */
.rfm-form { max-width: 720px; margin: 0 auto; }
.rfm-form *, .rfm-form *::before, .rfm-form *::after { box-sizing: border-box; }
.rfm-form-hp { position: absolute !important; left: -9999px !important; height: 0 !important; width: 0 !important; overflow: hidden !important; }

.rfm-form-field { margin-bottom: 18px; }
.rfm-form-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; color: var(--rfm-form-label, #111); }
.rfm-form-prompt {
    font-family: var(--rfm-form-display-font, inherit);
    font-size: clamp(1.4rem, 3vw, 2.1rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--rfm-form-text, #111);
    margin: 0 0 28px;
}
.rfm-form-req { color: var(--rfm-form-error, #d63638); margin-left: 4px; }

.rfm-form-field input,
.rfm-form-field textarea {
    width: 100%; padding: 14px 16px;
    border: 1.5px solid var(--rfm-form-border, #e0e0e0);
    border-radius: var(--rfm-form-radius, 10px);
    font: inherit; font-size: 1rem;
    background: var(--rfm-form-bg, #fff);
    color: var(--rfm-form-text, #111);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.rfm-form-field input:focus,
.rfm-form-field textarea:focus {
    outline: none;
    border-color: var(--rfm-form-accent, #2271b1);
    box-shadow: 0 0 0 3px var(--rfm-form-accent-faint, rgba(34,113,177,0.12));
}
.rfm-form-field textarea { resize: vertical; min-height: 130px; line-height: 1.5; }

/* ============================================================
   Radio (quiz options), big tappable cards
   ============================================================ */
.rfm-form-field-radio { margin: 0; }
.rfm-form-radio-group { display: flex; flex-direction: column; gap: 10px; }
.rfm-form-radio-option {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
    background: var(--rfm-form-bg, #fff);
    border: 2px solid var(--rfm-form-border, #e0e0e0);
    border-radius: var(--rfm-form-radius, 10px);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.02rem;
    color: var(--rfm-form-text, #111);
    font-weight: 500;
    line-height: 1.4;
    user-select: none;
    position: relative;
}
.rfm-form-radio-option:hover {
    border-color: var(--rfm-form-accent, #2271b1);
    background: var(--rfm-form-accent-faint, rgba(34,113,177,0.06));
    transform: translateY(-1px);
}
.rfm-form-radio-option input[type=radio] {
    appearance: none; -webkit-appearance: none;
    width: 22px; height: 22px;
    border: 2px solid var(--rfm-form-border, #e0e0e0);
    border-radius: 50%;
    margin: 0; padding: 0;
    flex-shrink: 0;
    transition: all 0.15s ease;
    cursor: pointer;
    background: transparent;
}
.rfm-form-radio-option input[type=radio]:checked {
    border-color: var(--rfm-form-accent, #2271b1);
    background: radial-gradient(circle, var(--rfm-form-accent, #2271b1) 50%, transparent 53%);
}
.rfm-form-radio-option:has(input:checked) {
    border-color: var(--rfm-form-accent, #2271b1);
    background: var(--rfm-form-accent-faint, rgba(34,113,177,0.08));
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}
.rfm-form-radio-label { flex: 1; }

.rfm-form-error { color: var(--rfm-form-error, #d63638); font-size: 0.88rem; margin-top: 6px; min-height: 1em; }

/* ============================================================
   Buttons / actions
   ============================================================ */
.rfm-form-actions { margin-top: 28px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rfm-form-actions-multistep { justify-content: space-between; }
.rfm-form-submit, .rfm-form-next, .rfm-form-prev {
    background: var(--rfm-form-accent, #2271b1);
    color: var(--rfm-form-on-accent, #fff);
    padding: 14px 32px;
    border: none;
    border-radius: var(--rfm-form-button-radius, 999px);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.05s, background 0.15s;
    min-height: 50px;
    display: inline-flex; align-items: center; justify-content: center;
}
.rfm-form-prev {
    background: transparent;
    color: var(--rfm-form-text, #111);
    border: 1.5px solid var(--rfm-form-border, #e0e0e0);
    padding: 14px 24px;
}
.rfm-form-prev:hover { border-color: var(--rfm-form-accent, #2271b1); color: var(--rfm-form-accent, #2271b1); }
.rfm-form-prev:disabled { opacity: 0.3; cursor: not-allowed; }
.rfm-form-submit:hover, .rfm-form-next:hover { opacity: 0.92; transform: translateY(-1px); }
.rfm-form-submit:active, .rfm-form-next:active { transform: translateY(0); }
.rfm-form-submit:disabled { opacity: 0.5; cursor: wait; }

.rfm-form-status { margin-top: 16px; padding: 12px 16px; border-radius: 10px; display: none; font-size: 0.95rem; line-height: 1.5; }
.rfm-form-status.is-success { display: block; background: #e7f5ec; color: #1a6c2b; border: 1px solid #b8dec6; }
.rfm-form-status.is-error   { display: block; background: #fde7e7; color: #842029; border: 1px solid #f5c2c7; }
.rfm-form-turnstile-wrap { margin: 16px 0; min-height: 65px; }
@media (max-width: 600px) { .rfm-form-submit, .rfm-form-next { width: 100%; } }

/* ============================================================
   Multi-step, progress bar + step transitions
   ============================================================ */
.rfm-form-progress {
    height: 6px;
    background: var(--rfm-form-border, #e0e0e0);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.rfm-form-progress-bar {
    height: 100%;
    background: var(--rfm-form-accent, #2271b1);
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.rfm-form-progress-label {
    font-size: 0.84rem;
    color: var(--rfm-form-label, #555);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 32px;
    text-align: right;
    text-transform: uppercase;
}

.rfm-form-steps-wrap {
    position: relative;
    min-height: 280px;
}
.rfm-form-step {
    border: 0; padding: 0; margin: 0;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.rfm-form-step.is-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.rfm-form-step.is-entering {
    opacity: 0;
    transform: translateY(20px);
}
.rfm-form-step-legend {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rfm-form-accent, #2271b1);
    margin-bottom: 16px;
    padding: 0;
}

/* ============================================================
   File field (v1.3), dropzone with preview + remove
   ============================================================ */
.rfm-form-field-file { margin-bottom: 18px; }
.rfm-form-file-drop {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 22px;
    background: var(--rfm-form-bg, #fff);
    border: 2px dashed var(--rfm-form-border, #d4d4d8);
    border-radius: var(--rfm-form-radius, 12px);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.rfm-form-file-drop:hover,
.rfm-form-file-drop.is-dragging {
    border-color: var(--rfm-form-accent, #2271b1);
    background: var(--rfm-form-accent-faint, rgba(34,113,177,0.06));
}
.rfm-form-file-drop input[type=file] {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
    border: 0; padding: 0; margin: -1px;
    white-space: nowrap;
}
.rfm-form-file-icon {
    flex-shrink: 0;
    font-size: 1.6rem;
    color: var(--rfm-form-accent, #2271b1);
    line-height: 1;
}
.rfm-form-file-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.rfm-form-file-cta {
    font-weight: 600;
    color: var(--rfm-form-text, #111);
}
.rfm-form-file-help {
    font-size: 0.85rem;
    color: var(--rfm-form-label, #6b7280);
}
.rfm-form-file-preview {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.rfm-form-file-thumb {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid var(--rfm-form-border, #e0e0e0);
    object-fit: contain;
    background: #fafafa;
    padding: 4px;
}
.rfm-form-file-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--rfm-form-accent-faint, rgba(34,113,177,0.08));
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.9rem;
    color: var(--rfm-form-text, #111);
}
.rfm-form-file-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.rfm-form-file-clear {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--rfm-form-label, #6b7280);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
}
.rfm-form-file-clear:hover { color: var(--rfm-form-error, #d63638); }

/* ============================================================
   Skip hint + short-answer nudge (v1.3.1)
   ============================================================ */
.rfm-form-skip-hint {
    margin-left: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--rfm-form-label, #6b7280);
    font-style: italic;
    letter-spacing: 0;
    text-transform: none;
}
.rfm-form-nudge {
    margin-top: 14px;
    padding: 16px 18px;
    background: var(--rfm-form-accent-faint, rgba(34,113,177,0.08));
    border-left: 3px solid var(--rfm-form-accent, #2271b1);
    border-radius: 8px;
    animation: rfmf-nudge-slide 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.rfm-form-nudge[hidden] { display: none; }
.rfm-form-nudge-text {
    margin: 0 0 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--rfm-form-text, #111);
}
.rfm-form-nudge-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.rfm-form-nudge-back,
.rfm-form-nudge-skip {
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    font: inherit;
    font-weight: 600;
}
.rfm-form-nudge-back {
    background: var(--rfm-form-accent, #2271b1);
    color: #fff;
}
.rfm-form-nudge-back:hover { opacity: 0.9; }
.rfm-form-nudge-skip {
    background: transparent;
    color: var(--rfm-form-label, #6b7280);
    text-decoration: underline;
    padding: 9px 6px;
}
.rfm-form-nudge-skip:hover { color: var(--rfm-form-text, #111); }
@keyframes rfmf-nudge-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
 * v1.9.1 — Audio recording field
 * ============================================================ */
.rfmf-form-audio {
	padding: 18px; background: #f9fafb; border: 1px solid #e5e7eb;
	border-radius: 8px; margin: 12px 0;
}
/* v1.11.1: compact companion — a slim "Record your answer instead" button
   that renders above its textarea. The v1.11.0 position:sticky recorder was
   removed: sticky silently fails inside host pages whose CSS clips the sticky
   context, which a plugin cannot control. The fixed red recording banner is
   the recording indicator instead. */
.rfmf-form-audio.rfmf-audio-compact {
	padding: 10px 12px;
	margin: 4px 0 10px;
}
.rfmf-audio-compact .rfmf-audio-empty { gap: 10px; }
.rfmf-audio-compact .rfmf-audio-record-btn { padding: 8px 14px; font-size: 13px; }
.rfmf-audio-compact .rfmf-audio-help { font-size: 12px; color: #6b7280; }
.rfmf-audio-empty { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rfmf-audio-record-btn {
	background: #dc2626; color: #fff; border: none;
	padding: 10px 18px; border-radius: 6px; font-weight: 700;
	cursor: pointer; font-size: 14px;
}
.rfmf-audio-record-btn:hover { background: #b91c1c; }
.rfmf-audio-hint { color: #6b7280; font-size: 13px; }
.rfmf-audio-recording { display: flex; align-items: center; gap: 14px; }
.rfmf-audio-indicator {
	color: #dc2626; font-weight: 700; font-size: 14px;
	animation: rfmf-pulse 1s ease-in-out infinite;
}
@keyframes rfmf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.rfmf-audio-timer {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 16px; color: #374151; font-weight: 600;
}
.rfmf-audio-stop-btn {
	background: #374151; color: #fff; border: none;
	padding: 10px 18px; border-radius: 6px; font-weight: 700;
	cursor: pointer; font-size: 14px;
}
.rfmf-audio-done { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.rfmf-audio-playback { width: 100%; max-width: 400px; }
.rfmf-audio-redo-btn {
	background: transparent; color: #4b5563; border: 1px solid #d1d5db;
	padding: 6px 14px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.rfmf-audio-uploaded { color: #16A34A; font-size: 13px; font-weight: 600; }
.rfmf-audio-error { color: #dc2626; font-size: 13px; margin: 8px 0 0; }


/* ============================================================
 * v1.9.9 — Fixed-position recording banner
 * Appears at top of viewport when audio recording is active.
 * Pulsing red dot + field label + live timer. Survives scroll.
 * ============================================================
 */
.rfmf-rec-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: #b91c1c;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    animation: rfmf-banner-slide-in 0.2s ease-out;
}
.rfmf-rec-banner-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: rfmf-rec-pulse 1.4s infinite;
    flex-shrink: 0;
}
.rfmf-rec-banner-label { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfmf-rec-banner-timer { font-variant-numeric: tabular-nums; opacity: 0.95; flex-shrink: 0; }
@keyframes rfmf-rec-pulse {
    0%   { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8); }
    70%  { transform: scale(1.0); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
@keyframes rfmf-banner-slide-in {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
/* Mobile: stack the label more tightly */
@media (max-width: 600px) {
    .rfmf-rec-banner { font-size: 13px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
    .rfmf-rec-banner-label { font-size: 12px; }
}
