/**
 * Nelson Forms — Frontend CSS
 *
 * Standalone form styles for the [nelson_form] shortcode.
 * Uses --nd-* variables with literal fallbacks so forms look great
 * even without Nelson Dashboard active on the page.
 *
 * Never use hardcoded colors — always pair a variable with a fallback.
 */

/* ------------------------------------------------------------------ */
/* Form wrapper                                                         */
/* ------------------------------------------------------------------ */

.nf-form-wrap {
  /* Phase 8 — Form Styler CSS variable layer.
     Inline <style> from form settings overrides these per-form-wrap ID.
     Each falls back to the Nelson Dashboard --nd-* token, then a literal. */
  --nf-primary:      var(--nd-primary, #2d7ef7);
  --nf-primary-hover:var(--nd-primary-hover, #1b64d0);
  --nf-btn-text:     var(--nd-white, #fff);
  --nf-label-color:  var(--nd-dark, #343434);
  --nf-bg:           transparent;
  --nf-input-radius: var(--nd-radius-md, 6px);
  --nf-font-size:    inherit;

  font-family: var(--nd-font-family, system-ui, -apple-system, sans-serif);
  font-size: var(--nf-font-size);
  background: var(--nf-bg);
  max-width: 680px;
}

.nf-form-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--nd-dark, #343434);
  margin: 0 0 1.5rem 0;
}

/* ------------------------------------------------------------------ */
/* Fields                                                               */
/* ------------------------------------------------------------------ */

.nf-fields { display: flex; flex-direction: column; gap: 1.25rem; }

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

.nf-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nf-label-color);
}

.nf-required {
  color: var(--nd-danger, #dc3545);
  margin-left: 0.2rem;
}

/* Inputs */
.nf-input,
.nf-textarea,
.nf-select {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  color: var(--nd-dark, #343434);
  background: var(--nd-white, #fff);
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nf-input-radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
  line-height: var(--nd-line-height, 1.6);
}

.nf-input:focus,
.nf-textarea:focus,
.nf-select:focus {
  /* Visible focus indicator — WCAG 2.4.7. outline replaces box-shadow for reliable AT rendering. */
  outline: 2px solid var(--nf-primary);
  outline-offset: 2px;
  border-color: var(--nf-primary);
  box-shadow: none;
}

.nf-textarea { resize: vertical; min-height: 100px; }

.nf-file-zone {
  position: relative;
  border: 2px dashed var(--nd-gray-lighter, #ddd);
  border-radius: var(--nd-radius-sm, 4px);
  padding: 0.75rem 1rem;
  background: var(--nd-gray-50, #fafafa);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.nf-file-zone--dragover {
  border-color: var(--nd-primary, #2d7ef7);
  background: var(--nd-primary-light, #e8f2ff);
}

.nf-file-zone__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--nd-gray-600, #757575);
  pointer-events: none;
}

.nf-file-input {
  display: block;
  font-size: 0.875rem;
  color: var(--nd-dark, #343434);
  width: 100%;
}

/* Error state */
.nf-field--error .nf-input,
.nf-field--error .nf-textarea,
.nf-field--error .nf-select {
  border-color: var(--nd-danger, #dc3545);
}

.nf-field-error {
  display: block;
  font-size: 0.8rem;
  color: var(--nd-danger, #dc3545);
  margin-top: 0.2rem;
}

.nf-field-help {
  font-size: 0.78rem;
  color: var(--nd-gray, #666);
  margin: 0.25rem 0 0;
}

/* ------------------------------------------------------------------ */
/* Selection fields                                                     */
/* ------------------------------------------------------------------ */

.nf-radio-group,
.nf-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nf-radio-group--horizontal,
.nf-checkbox-group--horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nf-radio-label,
.nf-checkbox-label,
.nf-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--nd-dark, #343434);
  line-height: 1.4;
}

.nf-radio-label input,
.nf-checkbox-label input,
.nf-consent-label input {
  flex-shrink: 0;
  margin-top: 0.15rem;
  accent-color: var(--nd-primary, #2d7ef7);
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------ */
/* Name field                                                           */
/* ------------------------------------------------------------------ */

.nf-name-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.nf-name-part { display: flex; flex-direction: column; gap: 0.25rem; }
.nf-name-part label { font-size: 0.78rem; color: var(--nd-gray, #666); font-weight: 500; }

/* ------------------------------------------------------------------ */
/* Layout fields                                                        */
/* ------------------------------------------------------------------ */

.nf-section-heading { margin: 0.5rem 0; }

.nf-section-heading__title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--nd-dark, #343434);
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--nd-primary-light, #e8f2ff);
}

.nf-section-heading__desc {
  font-size: 0.875rem;
  color: var(--nd-gray, #666);
  margin: 0;
}

.nf-html-block { font-size: 0.9rem; color: var(--nd-dark, #343434); line-height: 1.6; }

/* ------------------------------------------------------------------ */
/* Submit button                                                        */
/* ------------------------------------------------------------------ */

.nf-submit-wrap { padding-top: 0.5rem; }

.nf-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  background: var(--nf-primary);
  color: var(--nf-btn-text);
  border: none;
  border-radius: var(--nf-input-radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.nf-submit-btn:hover { background: var(--nf-primary-hover); }
.nf-submit-btn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Confirmation / error messages                                        */
/* ------------------------------------------------------------------ */

.nf-form-message {
  padding: 0.85rem 1rem;
  border-radius: var(--nd-radius-md, 6px);
  font-size: 0.9rem;
  margin-top: 1rem;
  display: none;
}
.nf-form-message:not(:empty) { display: block; }

.nf-form-message--success {
  background: var(--nd-success-bg, #d4edda);
  color: var(--nd-success-text, #155724);
  border: 1px solid var(--nd-success-border, #c3e6cb);
}

.nf-form-message--error {
  background: var(--nd-danger-bg, #f8d7da);
  color: var(--nd-danger-text, #721c24);
  border: 1px solid var(--nd-danger-border, #f5c6cb);
}

/* ---- Multi-step wizard ---- */

/* Hidden steps */
.nf-step { display: none; }
.nf-step.nf-step--active { display: block; }

/* Step indicator */
.nf-step-indicator {
  margin-bottom: 1.5rem;
}

.nf-step-bar {
  height: 6px;
  background: var(--nd-gray-lighter, #e2e8f0);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.nf-step-bar-fill {
  height: 100%;
  background: var(--nd-primary, #2271b1);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.nf-step-dots {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.nf-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--nd-gray-lighter, #e2e8f0);
  transition: background 0.2s ease, transform 0.2s ease;
}
.nf-step-dot.is-active {
  background: var(--nd-primary, #2271b1);
  transform: scale(1.25);
}
.nf-step-dot.is-complete { background: var(--nd-primary-light, #72aee6); }

.nf-step-label {
  font-size: var(--nd-font-size-sm, 0.875rem);
  color: var(--nd-gray-600, #757575);
  margin: 0;
}

/* Step navigation buttons */
.nf-step-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.nf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  border-radius: var(--nd-radius-md, 6px);
  font-size: var(--nd-font-size-base, 1rem);
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nf-btn--primary {
  background: var(--nd-primary, #2271b1);
  color: #fff;
  border-color: var(--nd-primary, #2271b1);
}
.nf-btn--primary:hover {
  background: var(--nd-primary-dark, #135e96);
  border-color: var(--nd-primary-dark, #135e96);
}

.nf-btn--secondary {
  background: transparent;
  color: var(--nd-primary, #2271b1);
  border-color: var(--nd-primary, #2271b1);
}
.nf-btn--secondary:hover {
  background: var(--nd-primary, #2271b1);
  color: #fff;
}

/* ------------------------------------------------------------------ */
/* Conditional logic                                                    */
/* ------------------------------------------------------------------ */

.nf-field--hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Form closed / restricted                                             */
/* ------------------------------------------------------------------ */

.nf-form-closed {
  padding: 1.25rem 1.5rem;
  background: var(--nd-gray-100, #f6f7f7);
  border: 1px solid var(--nd-gray-200, #e2e8f0);
  border-radius: var(--nd-radius-md, 6px);
}

.nf-form-closed__msg {
  margin: 0;
  color: var(--nd-gray-700, #3c434a);
  font-size: var(--nd-font-size-base, 1rem);
}

/* ------------------------------------------------------------------ */
/* Password gate                                                         */
/* ------------------------------------------------------------------ */

.nf-password-gate {
  padding: 1.5rem;
  background: var(--nd-gray-100, #f6f7f7);
  border: 1px solid var(--nd-gray-200, #e2e8f0);
  border-radius: var(--nd-radius-md, 6px);
  margin-bottom: 1rem;
}

.nf-password-gate__msg {
  margin: 0 0 1rem;
  font-weight: 500;
  color: var(--nd-dark, #343434);
}

.nf-password-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nf-password-row .nf-password-input {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--nd-gray-300, #d0d5dd);
  border-radius: var(--nd-radius-md, 6px);
  font-size: var(--nd-font-size-base, 1rem);
  background: #fff;
}
.nf-password-row .nf-password-input:focus {
  outline: 2px solid var(--nd-primary, #2271b1);
  border-color: transparent;
}

.nf-password-error {
  margin: 0.5rem 0 0;
  color: var(--nd-red, #d63638);
  font-size: var(--nd-font-size-sm, 0.875rem);
}

/* ------------------------------------------------------------------ */
/* File input preview list                                              */
/* ------------------------------------------------------------------ */

.nf-file-preview {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.nf-fp-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--nd-font-size-sm, 0.875rem);
  color: var(--nd-gray-700, #3c434a);
  background: var(--nd-gray-100, #f6f7f7);
  border: 1px solid var(--nd-gray-200, #e2e8f0);
  border-radius: var(--nd-radius-sm, 4px);
  padding: 0.3rem 0.6rem;
}

.nf-fp-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid var(--nd-gray-200, #e2e8f0);
}

.nf-fp-type {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--nd-gray-300, #c3c4c7);
  color: var(--nd-dark, #343434);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  flex-shrink: 0;
}

.nf-fp-type--pdf  { background: #ffe5e5; color: #c00; }
.nf-fp-type--doc  { background: #e0eeff; color: #1a5ec2; }
.nf-fp-type--xls  { background: #e0ffe0; color: #1a8a1a; }
.nf-fp-type--img  { background: #fff3cc; color: #7a5400; }
.nf-fp-type--zip  { background: #f0e0ff; color: #6a0aad; }

.nf-fp-name {
  font-weight: 500;
  color: var(--nd-dark, #343434);
  word-break: break-all;
  flex: 1;
}

.nf-fp-size {
  white-space: nowrap;
  color: var(--nd-gray-600, #757575);
  font-size: 0.8em;
}

.nf-fp-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--nd-gray-600, #757575);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  flex-shrink: 0;
}
.nf-fp-clear:hover { color: var(--nd-danger, #dc3545); }

/* ------------------------------------------------------------------ */
/* Partial submission resume banner                                     */
/* ------------------------------------------------------------------ */

.nf-resume-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--nd-primary-light, #e8f2ff);
  border: 1px solid var(--nd-primary, #2d7ef7);
  border-radius: var(--nd-radius-md, 6px);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  color: var(--nd-dark, #343434);
}

.nf-resume-msg { flex: 1; min-width: 0; }

.nf-resume-yes,
.nf-resume-no {
  padding: 0.3rem 0.85rem;
  border-radius: var(--nd-radius-md, 6px);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}

.nf-resume-yes {
  background: var(--nd-primary, #2d7ef7);
  color: var(--nd-white, #fff);
  border-color: var(--nd-primary, #2d7ef7);
}
.nf-resume-yes:hover { background: var(--nd-primary-hover, #1b64d0); border-color: var(--nd-primary-hover, #1b64d0); }

.nf-resume-no {
  background: transparent;
  color: var(--nd-gray, #666);
  border-color: var(--nd-gray-lighter, #ddd);
}
.nf-resume-no:hover { background: var(--nd-gray-lighter, #ddd); color: var(--nd-dark, #343434); }

/* ------------------------------------------------------------------ */
/* Payment UI                                                           */
/* ------------------------------------------------------------------ */

.nf-payment-ui {
  margin: 1rem 0;
  padding: 1.25rem;
  border: 1px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nd-radius, 6px);
  background: var(--nd-white, #fff);
}
.nf-payment-amount {
  font-size: var(--nd-font-size-sm, 0.95rem);
  margin: 0 0 0.75rem;
  color: var(--nd-dark, #1d2327);
}
.nf-stripe-element {
  margin-bottom: 1rem;
}
.nf-pay-btn {
  background: var(--nd-primary, #2271b1);
  color: var(--nd-white, #fff);
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--nd-radius, 4px);
  font-size: var(--nd-font-size-sm, 0.9rem);
  cursor: pointer;
}
.nf-pay-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.nf-pay-cancel-btn {
  background: none;
  border: 1px solid var(--nd-gray-lighter, #ddd);
  padding: 0.55rem 0.9rem;
  border-radius: var(--nd-radius, 4px);
  cursor: pointer;
  font-size: var(--nd-font-size-sm, 0.9rem);
}

/* Product field */
.nf-product-field { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nf-product-price { font-weight: 600; color: var(--nd-dark, #1d2327); }
.nf-product-qty { display: flex; align-items: center; gap: 0.4rem; }
.nf-product-qty-input { width: 70px; }

/* Payment summary field */
.nf-payment-summary { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--nd-gray-lightest, #f6f7f7); border-radius: var(--nd-radius, 4px); }
.nf-payment-summary-label { font-weight: 600; }
.nf-payment-summary-total { font-size: 1.1rem; font-weight: 700; color: var(--nd-primary, #2271b1); }

/* Logs page */
.nf-logs-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.nf-logs-table { margin-bottom: 0.5rem; }
.nf-logs-table .column-date { width: 160px; }
.nf-logs-table .column-type { width: 80px; }
.nf-logs-table .column-status { width: 90px; }
.nf-logs-table .column-entry { width: 70px; }
.nf-log-ok { color: var(--nd-green, #00a32a); font-weight: 600; }
.nf-log-fail { color: var(--nd-red, #d63638); font-weight: 600; }
.nf-logs-pagination { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }

/* ------------------------------------------------------------------ */
/* Auto-save indicator                                                  */
/* ------------------------------------------------------------------ */

.nf-autosave-indicator {
  font-size: 0.75rem;
  color: var(--nd-gray-600, #757575);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  height: 1rem;
  transition: opacity 0.4s;
  margin-bottom: 0.5rem;
}

@keyframes nf-autosave-fade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.nf-autosave-indicator--flash {
  animation: nf-autosave-fade 2.5s ease forwards;
}

/* ------------------------------------------------------------------ */
/* Subscription / recurring product label                               */
/* ------------------------------------------------------------------ */

.nf-product-interval {
  font-size: 0.8rem;
  color: var(--nd-gray-600, #757575);
  font-weight: 400;
}

/* =========================================================================
   Phase 9+10 — Extended Field Types
   ========================================================================= */

/* Utility ---------------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Address ---------------------------------------------------------------- */
.nf-address-grid { display: flex; flex-direction: column; gap: 6px; }
.nf-address-row  { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; }
@media (max-width: 480px) { .nf-address-row { grid-template-columns: 1fr; } }
.nf-address-country { width: 100%; }

/* Star Rating ------------------------------------------------------------ */
.nf-rating-group {
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  width: fit-content;
}
.nf-rating-star {
  font-size: 1.8rem;
  color: var(--nd-gray-lighter, #ddd);
  cursor: pointer;
  transition: color 0.1s;
  line-height: 1;
  user-select: none;
}
/* Forward-fill when hovering and when checked */
.nf-rating-group:hover .nf-rating-star { color: var(--nd-primary, #2d7ef7); }
.nf-rating-group .nf-rating-star:hover ~ .nf-rating-star { color: var(--nd-gray-lighter, #ddd); }
.nf-rating-input:checked ~ .nf-rating-star { color: var(--nd-primary, #2d7ef7); }

/* Slider ----------------------------------------------------------------- */
.nf-slider-wrap { display: flex; align-items: center; gap: 12px; }
.nf-slider-input { flex: 1; accent-color: var(--nf-primary); cursor: pointer; }
.nf-slider-value { min-width: 3rem; text-align: right; font-size: 0.9rem; color: var(--nd-dark, #343434); font-weight: 600; white-space: nowrap; }

/* Image Choice ----------------------------------------------------------- */
.nf-image-choice-group { display: flex; flex-wrap: wrap; gap: 10px; }
.nf-image-choice-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 2px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nf-input-radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  max-width: 130px;
  text-align: center;
  font-size: 0.85rem;
}
.nf-image-choice-item:hover { border-color: var(--nf-primary); }
.nf-image-choice-item.is-selected { border-color: var(--nf-primary); background: color-mix(in srgb, var(--nf-primary) 8%, transparent); }
.nf-image-choice-img { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; }
.nf-image-choice-label { font-weight: 500; }

/* Calculated ------------------------------------------------------------- */
.nf-calculated-wrap { display: flex; align-items: center; gap: 4px; }
.nf-calculated-display { background: var(--nd-gray-50, #f9f9f9); font-weight: 600; flex: 1; }
.nf-calc-prefix, .nf-calc-suffix { font-size: 0.9rem; color: var(--nd-gray-600, #757575); }

/* Password --------------------------------------------------------------- */
.nf-password-confirm-label { margin-top: 8px; }
.nf-password-match-msg { font-size: 0.8rem; margin-top: 4px; }
.nf-password-match-msg.is-ok     { color: var(--nd-success, #00a32a); }
.nf-password-match-msg.is-error  { color: var(--nd-danger,  #dc3545); }

/* Signature -------------------------------------------------------------- */
.nf-signature-wrap { display: flex; flex-direction: column; gap: 8px; }
.nf-signature-canvas {
  width: 100%;
  height: 160px;
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nf-input-radius);
  cursor: crosshair;
  background: #fff;
  touch-action: none;
}
.nf-signature-toolbar { display: flex; align-items: center; gap: 10px; }
.nf-signature-preview { height: 40px; border: 1px solid var(--nd-gray-lighter, #ddd); border-radius: 4px; }

/* NPS -------------------------------------------------------------------- */
.nf-nps-wrap { display: flex; flex-direction: column; gap: 6px; }
.nf-nps-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.nf-nps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  user-select: none;
}
.nf-nps-item--detractor .nf-nps-btn { border-color: #f87171; color: #b91c1c; }
.nf-nps-item--passive   .nf-nps-btn { border-color: #fbbf24; color: #92400e; }
.nf-nps-item--promoter  .nf-nps-btn { border-color: #34d399; color: #065f46; }
.nf-nps-item input:checked + .nf-nps-btn { color: #fff; }
.nf-nps-item--detractor input:checked + .nf-nps-btn { background: #ef4444; border-color: #ef4444; }
.nf-nps-item--passive   input:checked + .nf-nps-btn { background: #f59e0b; border-color: #f59e0b; }
.nf-nps-item--promoter  input:checked + .nf-nps-btn { background: #10b981; border-color: #10b981; }
.nf-nps-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--nd-gray, #666); }

/* Chain Select ----------------------------------------------------------- */
.nf-chain-wrap { display: flex; flex-direction: column; gap: 8px; }
.nf-chain-level select { width: 100%; }

/* Rich Text -------------------------------------------------------------- */
.nf-rich-text-wrap { display: flex; flex-direction: column; gap: 0; }
.nf-rich-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  background: var(--nd-gray-50, #f6f7f7);
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-bottom: none;
  border-radius: var(--nf-input-radius) var(--nf-input-radius) 0 0;
}
.nf-rich-btn {
  padding: 2px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--nd-dark, #343434);
}
.nf-rich-btn:hover { background: var(--nd-gray-100, #e8e8e8); }
.nf-rich-editor {
  min-height: 100px;
  padding: 10px 12px;
  border-radius: 0 0 var(--nf-input-radius) var(--nf-input-radius);
  line-height: 1.6;
  outline: none; /* Suppressed here — replaced by explicit focus rule below */
}
.nf-rich-editor:focus {
  outline: 2px solid var(--nf-primary);
  outline-offset: 2px;
  border-color: var(--nf-primary);
}

/* Repeater --------------------------------------------------------------- */
.nf-repeater-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.nf-repeater-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nf-input-radius);
  background: var(--nd-gray-50, #f9f9f9);
}
.nf-repeater-row-fields { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.nf-repeater-cell { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 4px; }
.nf-repeater-cell-label { font-size: 0.78rem; }
.nf-repeater-remove-btn { color: var(--nd-danger, #dc3545); padding: 4px; flex-shrink: 0; margin-top: 24px; }

/* Post Select ------------------------------------------------------------ */
.nf-post-select { width: 100%; }

/* Phase 14 — Donation field */
.nf-donation-wrap { display: flex; flex-direction: column; gap: 10px; }
.nf-donation-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.nf-donation-preset-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-radius: var(--nf-input-radius);
  background: var(--nd-white, #fff);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.12s, background 0.12s;
}
.nf-donation-preset-btn:hover { border-color: var(--nf-primary); }
.nf-donation-preset-btn.is-active { background: var(--nf-primary); color: var(--nf-btn-text); border-color: var(--nf-primary); }
.nf-donation-custom-wrap { display: flex; align-items: center; gap: 4px; }
.nf-donation-symbol { font-size: 1rem; font-weight: 600; color: var(--nd-gray-600, #757575); }
.nf-donation-amount { flex: 1; }

/* Phase 14 — Coupon field */
.nf-coupon-wrap { display: flex; flex-direction: column; gap: 6px; }
.nf-coupon-input-row { display: flex; gap: 8px; }
.nf-coupon-input { flex: 1; text-transform: uppercase; letter-spacing: 0.06em; }
.nf-coupon-status { font-size: 0.82rem; }

/* Phase 15 — CAPTCHA widgets */
.nf-captcha-wrap { margin-bottom: 8px; }

/* =========================================================================
   Phase 8c — Column Layout
   ========================================================================= */

.nf-col-layout {
  display: grid;
  gap: 1.25rem;
}
.nf-col-layout--2 { grid-template-columns: 1fr 1fr; }
.nf-col-layout--3 { grid-template-columns: 1fr 1fr 1fr; }
.nf-col-layout--4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.nf-col { display: flex; flex-direction: column; gap: 1.25rem; }

/* Collapse to single column on narrow screens */
@media (max-width: 600px) {
  .nf-col-layout--2,
  .nf-col-layout--3,
  .nf-col-layout--4 {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Phase 16 — Conversational Mode
   ========================================================================= */

.nf-form--conversational .nf-fields { display: none; }

/* Progress bar */
.nf-conv-progress {
  height: 4px;
  background: var(--nd-gray-lighter, #ddd);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}
.nf-conv-progress-bar {
  height: 100%;
  background: var(--nf-primary);
  border-radius: 2px;
  transition: width 0.35s ease;
  width: 0%;
}

/* Counter */
.nf-conv-counter {
  font-size: 0.78rem;
  color: var(--nd-gray-600, #757575);
  margin-bottom: 24px;
  text-align: right;
  font-weight: 500;
}

/* Slides */
.nf-conv-slides { position: relative; overflow: hidden; }

.nf-conv-slide {
  display: none;
  animation: nf-conv-slide-in 0.28s ease both;
}

.nf-conv-slide--active {
  display: block;
}

.nf-conv-slide--done {
  display: none;
}

@keyframes nf-conv-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Question area — larger label */
.nf-conv-question .nf-label {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  line-height: 1.4;
  color: var(--nf-label-color);
}

.nf-conv-question .nf-input,
.nf-conv-question .nf-textarea,
.nf-conv-question .nf-select {
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
}

/* Actions row */
.nf-conv-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.nf-conv-enter-hint {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 6px;
}

.nf-btn--ghost {
  background: transparent;
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  color: var(--nd-gray-600, #757575);
  padding: 0.45rem 0.85rem;
  border-radius: var(--nf-input-radius);
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s;
}
.nf-btn--ghost:hover { border-color: var(--nf-primary); color: var(--nf-primary); }

/* Submit wrap in conversational mode */
.nf-conv-submit-wrap { margin-top: 18px; }

/* =========================================================================
   Phase 16 — Calculator Mode
   ========================================================================= */

.nf-calc-result-panel {
  background: var(--nd-gray-50, #fafafa);
  border: 1.5px solid var(--nd-gray-lighter, #ddd);
  border-left: 4px solid var(--nf-primary);
  border-radius: var(--nf-input-radius);
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nf-calc-result-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nd-gray-600, #757575);
}

.nf-calc-result-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--nf-primary);
  line-height: 1.2;
}

.nf-calc-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.nf-calc-share-msg {
  font-size: 0.82rem;
  color: var(--nd-success, #00a32a);
}

/* =========================================================================
   Phase 16 — Quiz Result Panel
   ========================================================================= */

.nf-quiz-result {
  --nf-quiz-color: var(--nf-primary);
  display: none;
  border: 2px solid var(--nf-quiz-color);
  border-radius: var(--nf-input-radius);
  padding: 1.25rem;
  margin-top: 1rem;
  text-align: center;
  background: var(--nd-white, #fff);
}

.nf-quiz-result__score-wrap {
  margin-bottom: 10px;
}

.nf-quiz-result__score {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--nf-quiz-color);
  line-height: 1;
}

.nf-quiz-result__possible {
  font-size: 0.85rem;
  color: var(--nd-gray-600, #757575);
  margin-top: 4px;
}

.nf-quiz-result__grade {
  display: inline-block;
  background: var(--nf-quiz-color);
  color: var(--nd-white, #fff);
  font-weight: 700;
  font-size: 1rem;
  padding: 4px 18px;
  border-radius: 100px;
  margin: 8px 0;
}

.nf-quiz-result__message {
  font-size: 0.95rem;
  color: var(--nd-dark, #343434);
  line-height: 1.5;
}
.nf-math-captcha-wrap { display: flex; flex-direction: column; gap: 6px; }
.nf-math-label { font-weight: 500; }
.nf-math-question { color: var(--nd-dark, #343434); font-weight: 600; }
.nf-math-answer { max-width: 120px; }
