/* Chat versus Flow, ported from the phase 2 WhatsApp Flows product page (fp-cmp), which took it from the old-way
   module: the coral panel's replies fall into the chat like bricks; the green panel's Flow works and times the
   visitor. Its plan rows fill in 160ms like every other choice row (the old-way outline trace is left out). */
.fp-cmp-head { display: grid; gap: 22px; max-width: 900px; }
.fp-cmp-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 32px); margin-top: clamp(40px, 5vw, 64px); }
.fp-cmp-mode { min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: clamp(22px, 3vw, 40px); border-radius: var(--r-xl); corner-shape: var(--sq-shape, round); }
.fp-cmp-bad { background: var(--field-coral); }
.fp-cmp-good { background: var(--field-green); }
.fp-cmp-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.fp-cmp-top > div { min-width: 0; flex: 1 1 260px; }
.fp-cmp-sub { margin-top: 8px; font-size: 17px; line-height: 1.5; color: var(--ink-soft); text-wrap: pretty; }
.fp-cmp-name { flex: none; }
.fp-cmp-bad .fp-cmp-name { background: var(--coral); color: var(--on-bright); }
.fp-cmp-good .fp-cmp-name { background: var(--green); color: var(--on-bright); }
.fp-cmp-shot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; }
.fp-cmp-tally { max-width: 420px; text-align: center; font-weight: 700; font-size: 16px; line-height: 1.4; text-wrap: balance; }

/* Both mocks sit in WhatsApp's own chrome (styles/components.css: .wa-h, .wa-ava, .wa-comp, .wa-managed, .wa-wall). The
   chat fills its row beside the Flow and keeps its messages at the foot of the screen, as WhatsApp does */
.fp-cmp-chat { width: 100%; max-width: 440px; display: flex; flex-direction: column; border-radius: calc(26px * var(--sq-scale, 1)); overflow: hidden; box-shadow: var(--shadow); corner-shape: var(--sq-shape, round); }
/* The "Sample data" tag takes a second row when the business's name would otherwise be cut short */
.fp-cmp-chat-head { z-index: 2; flex-wrap: wrap; row-gap: 6px; box-shadow: 0 1px 0 var(--wa-edge); }
.fp-cmp-chat-head .tag { margin-inline-start: auto; }
.fp-cmp-msgs { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 18px 16px 22px; }
.fp-cmp-msg {
  max-width: 84%; padding: 8px 12px 6px; border-radius: calc(16px * var(--sq-scale, 1));
  font-size: 15px; line-height: 1.4; overflow-wrap: anywhere;
  box-shadow: var(--shadow-xs);
  rotate: var(--tilt, 0deg);
  corner-shape: var(--sq-shape, round);
}
[dir="rtl"] .fp-cmp-msg { rotate: calc(var(--tilt, 0deg) * -1); }
.fp-cmp-msg.in { align-self: flex-start; background: var(--bubble-in); border-start-start-radius: 5px; }
.fp-cmp-msg.out { align-self: flex-end; background: var(--bubble-out); border-start-end-radius: 5px; }
.fp-cmp-msg time { display: block; margin-top: 3px; text-align: end; font: 500 12px/1 var(--mono); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
/* The replies drop in like bricks, bottom first; the opening message never moves, so the chat is never empty */
.fp-cmp-msgs.is-armed { overflow: hidden; }
.fp-cmp-msgs.is-armed .fp-cmp-msg { translate: 0 var(--drop, -480px); rotate: var(--spin, 0deg); }
.fp-cmp-msgs.is-falling .fp-cmp-msg { animation: fp-brick 820ms linear var(--d, 0ms) both; }
.fp-cmp-msgs.is-armed .fp-cmp-msg:first-child, .fp-cmp-msgs.is-falling .fp-cmp-msg:first-child { position: relative; z-index: 1; translate: none; rotate: var(--tilt, 0deg); animation: none; }
@keyframes fp-brick {
  0% { translate: 0 var(--drop, -480px); rotate: var(--spin, 0deg); animation-timing-function: cubic-bezier(0.4, 0.12, 0.9, 0.55); }
  56% { translate: 0 0; rotate: calc(var(--tilt, 0deg) + var(--kick, 4deg)); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  74% { translate: 0 -12px; rotate: calc(var(--tilt, 0deg) - var(--kick, 4deg) * 0.45); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  87% { translate: 0 0; rotate: calc(var(--tilt, 0deg) + var(--kick, 4deg) * 0.2); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  94% { translate: 0 -3px; }
  100% { translate: 0 0; rotate: var(--tilt, 0deg); }
}
.fp-cmp-chat.is-thud { animation: fp-thud 260ms var(--ease-out); }
@keyframes fp-thud { 0%, 100% { translate: 0 0; } 30% { translate: 0 3px; } }

/* The Flow is a sheet over the chat: the chat's header shows above it, dimmed, and the sheet's bar rounds over it */
.fp-cmp-sheet { width: 100%; max-width: 440px; display: flex; flex-direction: column; border-radius: calc(26px * var(--sq-scale, 1)); overflow: hidden; background: var(--wa-head); box-shadow: var(--shadow); corner-shape: var(--sq-shape, round); }
.fp-cmp-sheet > .wa-dim { padding-bottom: 26px; }
.fp-cmp-bar {
  position: relative; z-index: 1; margin-top: -16px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
  border-radius: calc(22px * var(--sq-scale, 1)) calc(22px * var(--sq-scale, 1)) 0 0; corner-shape: var(--sq-shape, round);
  background: var(--sheet-bg);
}
.fp-cmp-bar span { color: var(--ink-soft); }
.fp-cmp-bar b { font-weight: 800; text-align: center; }
.fp-cmp-bar .i { justify-self: end; color: var(--ink-soft); }
.fp-cmp-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 16px; background: var(--sheet-bg); }
.fp-cmp-hi { font-size: 16px; line-height: 1.45; text-wrap: pretty; }
.fp-cmp-facts { display: grid; gap: 8px; }
.fp-cmp-facts li { display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.35; color: var(--ink-soft); }
.fp-cmp-facts .i { width: 18px; height: 18px; color: var(--ink); }
.fp-cmp-q { padding: 0; margin-bottom: 8px; font-weight: 800; font-size: 16px; }
.fp-cmp-sheet fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fp-cmp-opts { display: grid; gap: 8px; }
.fp-cmp-opt {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 0 14px;
  border-radius: calc(14px * var(--sq-scale, 1)); border: 2px solid var(--line);
  background: var(--sheet-bg);
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
  corner-shape: var(--sq-shape, round);
}
.fp-cmp-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fp-cmp-opt:has(input:checked) { border-color: var(--green); background: var(--field-green); }
.fp-cmp-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.fp-cmp-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background-color 160ms ease, border-color 160ms ease; }
.fp-cmp-opt:has(input:checked) .fp-cmp-dot { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px var(--field-green); }
@media not all and (pointer: coarse) {
  .fp-cmp-opt:hover { border-color: var(--line-strong); }
  .fp-cmp-opt:has(input:checked):hover { border-color: var(--green); }
}
.fp-cmp-btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 50px; border: 0; border-radius: 999px;
  background: var(--green); color: var(--wa-ink);
  font: 800 16px/1 var(--text); cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.fp-cmp-btn:active { transform: scale(0.97); }
@media not all and (pointer: coarse) {
  .fp-cmp-btn:hover { background: var(--wa-bg-hover); }
}
/* The two previews start and end level (DESIGN.md, the Shared Rows Rule), as old-way's do: side by side, the panels
   share five rows (top, preview, caption, points, tags) and each preview stretches to the taller one */
@supports (grid-template-rows: subgrid) {
  .fp-cmp-mode { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 22px; }
  .fp-cmp-top { grid-row: 1; }
  .fp-cmp-shot { display: contents; }
  .fp-cmp-shot > .fp-cmp-chat, .fp-cmp-shot > .fp-cmp-sheet { grid-row: 2; justify-self: center; }
  .fp-cmp-shot > .fp-cmp-tally { grid-row: 3; justify-self: center; margin-top: -8px; }
  .fp-cmp-mode > .fp-cmp-points { grid-row: 4; }
  .fp-cmp-mode > .fp-cmp-tags { grid-row: 5; }
}

/* The button and WhatsApp's "Managed by" line (.wa-managed.fp-cmp-foot) keep to the foot of a stretched sheet */
[data-screen="ask"] > .fp-cmp-btn { margin-top: auto; }
.fp-cmp-done { justify-content: center; gap: 18px; }
.fp-cmp-done:focus { outline: none; }
.fp-cmp-done-head { display: flex; align-items: center; gap: 12px; font: 800 19px/1.25 var(--text); }
.fp-cmp-tick { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--on-bright); }
.fp-cmp-tick .i { width: 18px; height: 18px; }
.fp-cmp-receipt { display: grid; border: 1px solid var(--line); border-radius: calc(14px * var(--sq-scale, 1)); overflow: hidden; corner-shape: var(--sq-shape, round); }
.fp-cmp-receipt > div { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 10px; align-items: baseline; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fp-cmp-receipt > div:last-child { border-bottom: 0; }
.fp-cmp-receipt dt { font-size: 14px; color: var(--ink-soft); }
.fp-cmp-receipt dd { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.fp-cmp-again {
  align-self: center;
  min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent;
  color: var(--accent-ink); font: 700 15px/1 var(--text);
  text-decoration: underline; text-underline-offset: 0.25em; cursor: pointer;
}
.fp-cmp-done.is-in .fp-cmp-receipt > div { animation: fp-rise 320ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 90ms + 140ms); }
@keyframes fp-rise { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.fp-cmp-points { display: grid; gap: 10px; }
.fp-cmp-points li { display: flex; align-items: flex-start; gap: 12px; font-weight: 700; font-size: 17px; line-height: 1.4; }
.fp-cmp-points .i { width: 26px; height: 26px; padding: 5px; border-radius: 50%; }
.fp-cmp-bad .fp-cmp-points .i { background: var(--coral); color: var(--on-bright); }
.fp-cmp-good .fp-cmp-points .i { background: var(--green); color: var(--on-bright); }
.fp-cmp-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-cmp-bad .fp-cmp-tags .tag { background: transparent; border: 2px solid var(--coral); }
.fp-cmp-good .fp-cmp-tags .tag { background: var(--green); color: var(--on-bright); }
@media (max-width: 959px) {
  .fp-cmp-modes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 479px) {
  .fp-cmp-mode { padding: 18px; }
  .fp-cmp-msg { max-width: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-cmp-btn:active { transform: none; }
  .fp-cmp-done.is-in .fp-cmp-receipt > div { animation: fade-in 200ms ease both; }
}
