/* =============================================================
   Filing-app demo widget. Outcome-first design — no UI mimicry.
   A single textarea where the user's story types in, then a list
   of green-check outcomes reveals what Ezel does with it.
   Self-contained — no Tailwind, no theme deps.
   ============================================================= */

.fd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.fd-modal-overlay.fd-show {
  display: flex;
  opacity: 1;
}

.fd-modal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.5);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  color: #0f172a;
  position: relative;
}

/* Inline mode wrapper used by /forms/<form_id>. Same widget, no
   overlay — just sits in the page flow as a section. */
.fd-section {
  padding: 56px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.fd-section .fd-modal {
  margin: 0 auto;
  max-height: none;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.18);
}
.fd-section-header {
  max-width: 720px;
  margin: 0 auto 22px;
  text-align: center;
}
.fd-section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.fd-section-header p {
  font-size: 14px;
  color: #475569;
  margin: 0;
}

.fd-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.fd-close:hover { background: #f1f5f9; color: #0f172a; }

/* Topbar: form code + name on the left, jurisdiction on the right. */
.fd-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}
/* Reserve space for the absolutely-positioned close button (right:12px,
   width:32px) so .fd-topbar-jur isn't hidden behind it. Only applies in
   modal mode, where .fd-close is rendered as a preceding sibling. */
.fd-close ~ .fd-topbar { padding-right: 56px; }
.fd-topbar-tag {
  color: #475569;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.fd-topbar-form {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 12px;
}
.fd-topbar-form-name {
  color: #475569;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 380px;
}
.fd-topbar-spacer { flex: 1; }
.fd-topbar-jur {
  color: #64748b;
  font-size: 12px;
}

/* Stage: two columns side by side so the widget keeps a constant
   height as the animation runs. Story on the left, outcomes on the
   right — both rendered from the start; the rows just fade in one by
   one rather than reflowing the layout. */
.fd-stage {
  padding: 26px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  min-height: 320px;
  align-items: stretch;
}

/* Story prompt (left column) */
.fd-prompt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.fd-prompt-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fd-prompt-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  resize: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.fd-prompt-textarea.fd-typing {
  background: #ffffff;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.fd-prompt-textarea.fd-done {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
.fd-prompt-textarea::placeholder {
  color: #94a3b8;
}

/* Prompt status: kept in DOM flow always so its appearance doesn't
   reflow the column. Reserve the height with visibility:hidden when
   not active; toggle visibility + opacity together when it appears. */
.fd-prompt-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 8px 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #047857;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.fd-prompt-status.fd-visible { visibility: visible; opacity: 1; }

.fd-prompt-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(5, 150, 105, 0.3);
  border-top-color: #059669;
  border-radius: 50%;
  animation: fd-spin 700ms linear infinite;
}
@keyframes fd-spin { to { transform: rotate(360deg); } }

/* Outcomes block (right column). Always rendered so the layout doesn't
   resize as the animation runs — only the inner rows fade in one by
   one. The header sits above the list and the list grows downward, but
   total height is bounded by the four fixed rows. */
.fd-outcomes-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.fd-outcomes-head {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fd-outcomes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fd-outcome {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease;
}
.fd-outcome.fd-visible {
  opacity: 1;
  transform: translateX(0);
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.fd-outcome-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
  transition: background 0.3s ease;
}
.fd-outcome.fd-visible .fd-outcome-check {
  background: #059669;
}
.fd-outcome-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fd-outcome-label {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}
.fd-outcome.fd-visible .fd-outcome-label {
  color: #064e3b;
}
.fd-outcome-sub {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
}
.fd-outcome.fd-visible .fd-outcome-sub {
  color: #047857;
}

/* Bottom CTA strip */
.fd-cta-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  font-size: 13.5px;
  color: #334155;
}
.fd-cta-strip-text { flex: 1; line-height: 1.45; }
.fd-cta-strip-text strong { color: #047857; }
.fd-cta-strip-soft { color: #64748b; display: block; margin-top: 2px; font-size: 12.5px; }
/* `color: #ffffff !important` survives the page's global a:hover
   rule (base.html turns generic anchor text dark on hover). Without
   the !important, the button reads black-on-green on hover. */
.fd-cta-strip-btn,
.fd-cta-strip-btn:link,
.fd-cta-strip-btn:visited,
.fd-cta-strip-btn:hover,
.fd-cta-strip-btn:focus,
.fd-cta-strip-btn:active {
  color: #ffffff !important;
  text-decoration: none;
}
.fd-cta-strip-btn {
  background: #059669;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease;
  flex-shrink: 0;
  display: inline-block;
}
.fd-cta-strip-btn:hover { background: #047857; }

/* Mobile: single column. Outcomes drop below the story prompt. */
@media (max-width: 720px) {
  .fd-stage {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px 18px;
    min-height: auto;
  }
  .fd-cta-strip { flex-direction: column; align-items: stretch; gap: 10px; }
  .fd-cta-strip-btn { text-align: center; }
}

/* ======= Inline launcher card (catalog page only) ======= */
.fd-launcher {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  margin: 0 auto;
  max-width: 520px;
}
.fd-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  border-color: #a7f3d0;
}
.fd-launcher-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.fd-launcher-text { flex: 1; min-width: 0; }
/* Spans (not p tags) so /forms's `.forms-hero p { color: ... !important }`
   cascade can't reach them. display:block keeps the original two-line
   layout. */
.fd-launcher-title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 3px;
  line-height: 1.3;
}
.fd-launcher-sub {
  display: block;
  font-size: 12.5px;
  color: #475569;
  margin: 0;
  line-height: 1.4;
}
.fd-launcher-arrow { color: #059669; font-size: 18px; flex-shrink: 0; }
