/* =========================================================================
   forms.css — shared form & interaction components for FunnelRover LPs
   Theme-aware: inherits --brand / --ink / --paper / --muted / --line / --panel
   ========================================================================= */

/* ---- field ---- */
.fr-field { display: grid; gap: .4rem; text-align: left; }
.fr-field > label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.fr-field > label .req { color: var(--brand); }
.fr-hint { font-size: .78rem; color: var(--muted); }
.fr-input, .fr-select, .fr-textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--panel, #fff);
  border: 1px solid var(--line); border-radius: 12px;
  padding: .85rem 1rem; transition: border-color .18s, box-shadow .18s;
}
.fr-textarea { min-height: 96px; resize: vertical; }
.fr-input::placeholder, .fr-textarea::placeholder { color: color-mix(in oklab, var(--muted) 80%, transparent); }
.fr-input:focus, .fr-select:focus, .fr-textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 22%, transparent);
}
.fr-input.is-error, .fr-select.is-error, .fr-textarea.is-error {
  border-color: #e0524c; box-shadow: 0 0 0 3px rgba(224,82,76,.18);
}
.fr-err { font-size: .76rem; color: #d23b34; min-height: 0; }
.fr-err:empty { display: none; }
.fr-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 520px) { .fr-row { grid-template-columns: 1fr; } }

/* input with prefix (e.g. phone country / code) */
.fr-prefixed { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel,#fff); }
.fr-prefixed:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 22%, transparent); }
.fr-prefixed .pfx { display: grid; place-items: center; padding: 0 .9rem; background: color-mix(in oklab, var(--ink) 5%, var(--panel,#fff)); border-right: 1px solid var(--line); font-size: .9rem; color: var(--muted); white-space: nowrap; }
.fr-prefixed .fr-input { border: none; border-radius: 0; }
.fr-prefixed .fr-input:focus { box-shadow: none; }

/* ---- consent + opt-in ---- */
.fr-consent { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in oklab, var(--ink) 3%, var(--panel,#fff)); cursor: pointer; }
.fr-consent input { margin-top: .15rem; width: 18px; height: 18px; accent-color: var(--brand); flex: none; cursor: pointer; }
.fr-consent .txt { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.fr-consent .txt a { color: var(--ink); text-decoration: underline; }

.fr-optins { display: grid; gap: .6rem; }
.fr-optin { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .18s, background .18s; }
.fr-optin:hover { border-color: color-mix(in oklab, var(--brand) 40%, var(--line)); }
.fr-optin input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.fr-optin .ch { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 1rem; }
.fr-optin .ch.mail { background: color-mix(in oklab, var(--brand) 14%, var(--panel,#fff)); color: var(--brand); }
.fr-optin .ch.wa { background: rgba(37,211,102,.16); color: #1aa84e; }
.fr-optin .l { font-size: .88rem; font-weight: 500; }
.fr-optin .l small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }

/* ---- steps / wizard ---- */
.fr-flow { position: relative; }
.fr-step { display: none; }
.fr-step.active { display: block; animation: fr-fade .35s ease; }
@keyframes fr-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fr-dots { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-bottom: 1.4rem; }
.fr-dots .d { height: 6px; width: 26px; border-radius: 999px; background: color-mix(in oklab, var(--ink) 14%, transparent); transition: background .25s, width .25s; }
.fr-dots .d.on { background: var(--brand); }
.fr-dots .d.done { background: color-mix(in oklab, var(--brand) 55%, transparent); }
.fr-actions { display: flex; gap: .7rem; margin-top: 1.3rem; }
.fr-actions .btn { flex: 1; }
.fr-actions .btn.back { flex: 0 0 auto; }

/* ---- success panel ---- */
.fr-result { display: none; text-align: center; }
.fr-result.show { display: block; animation: fr-pop .4s cubic-bezier(.2,.8,.2,1); }
@keyframes fr-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.fr-check { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 1.2rem; background: var(--brand); color: var(--on-brand, #fff); display: grid; place-items: center; }
.fr-check svg { width: 38px; height: 38px; }
.fr-check.ok { background: #1aa84e; color: #fff; }
.fr-check-path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: fr-draw .5s .15s ease forwards; }
@keyframes fr-draw { to { stroke-dashoffset: 0; } }

/* ---- NPS rating scale ---- */
.fr-nps { display: grid; grid-template-columns: repeat(11, 1fr); gap: .4rem; }
.fr-nps button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--panel,#fff); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; transition: all .15s; }
.fr-nps button:hover { border-color: var(--brand); transform: translateY(-2px); }
.fr-nps button.sel { background: var(--brand); color: var(--on-brand,#fff); border-color: var(--brand); }
.fr-nps-labels { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: .5rem; }
@media (max-width: 520px) { .fr-nps { grid-template-columns: repeat(6, 1fr); } }

/* ---- star rating ---- */
.fr-stars { display: flex; gap: .3rem; justify-content: center; }
.fr-stars button { background: none; border: none; font-size: 2rem; cursor: pointer; color: color-mix(in oklab, var(--ink) 20%, transparent); transition: transform .12s, color .12s; line-height: 1; }
.fr-stars button:hover { transform: scale(1.15); }
.fr-stars button.on { color: var(--brand); }

/* ---- code input (segmented) ---- */
.fr-code { display: flex; gap: .5rem; justify-content: center; }
.fr-code input { width: 48px; height: 58px; text-align: center; font-size: 1.5rem; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; background: var(--panel,#fff); color: var(--ink); text-transform: uppercase; }
.fr-code input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 22%, transparent); }
@media (max-width: 420px) { .fr-code input { width: 40px; height: 50px; font-size: 1.2rem; } }

/* ---- countdown ---- */
.fr-countdown { display: flex; gap: .7rem; justify-content: center; }
.fr-cd-unit { min-width: 64px; text-align: center; background: var(--panel,#fff); border: 1px solid var(--line); border-radius: 14px; padding: .8rem .6rem; }
.fr-cd-unit .v { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.fr-cd-unit .u { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .35rem; }

/* ---- QR placeholder ---- */
.fr-qr { width: 150px; height: 150px; border-radius: 16px; padding: 12px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; }
.fr-qr .grid { width: 100%; height: 100%; border-radius: 6px;
  background-image:
    linear-gradient(90deg, #111 25%, transparent 0, transparent 50%, #111 0, #111 75%, transparent 0),
    linear-gradient(#111 25%, transparent 0, transparent 50%, #111 0, #111 75%, transparent 0);
  background-size: 16px 16px; opacity: .9;
}

/* ---- generic card / panel used by these LPs ---- */
.fr-card { background: var(--panel,#fff); border: 1px solid var(--line); border-radius: 22px; padding: clamp(1.5rem, 4vw, 2.4rem); box-shadow: 0 30px 60px -45px rgba(0,0,0,.4); }

/* progress / ticket / chip helpers */
.fr-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .9rem; border-radius: 999px; font-size: .82rem; border: 1px solid var(--line); background: var(--panel,#fff); }
.fr-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.fr-spin { display: inline-block; width: 16px; height: 16px; border: 2px solid color-mix(in oklab, var(--on-brand,#fff) 40%, transparent); border-top-color: var(--on-brand,#fff); border-radius: 50%; animation: fr-rot .7s linear infinite; }
@keyframes fr-rot { to { transform: rotate(360deg); } }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---- social share bar ---- */
.fr-share { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.fr-share .sbtn { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--line); background: var(--panel,#fff); color: var(--ink); border-radius: 999px; padding: .6rem 1.1rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.fr-share .sbtn:hover { transform: translateY(-2px); border-color: var(--brand); }
.fr-share .sbtn.wa { background: #25d366; color: #0b2b16; border-color: transparent; }
.fr-share .sbtn.wa:hover { filter: brightness(1.05); }

/* ---- FAQ accordion ---- */
.fr-faq { display: grid; gap: .7rem; max-width: 760px; margin: 0 auto; }
.fr-faq .item { border: 1px solid var(--line); border-radius: 14px; background: var(--panel,#fff); overflow: hidden; }
.fr-faq .q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; font: inherit; font-weight: 600; text-align: left; background: none; border: none; cursor: pointer; color: var(--ink); }
.fr-faq .q .ic { transition: transform .25s; flex: none; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.fr-faq .item.open .q .ic { transform: rotate(45deg); }
.fr-faq .a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.fr-faq .item.open .a { max-height: 340px; }
.fr-faq .a p { padding: 0 1.3rem 1.2rem; margin: 0; font-size: .95rem; color: var(--muted); }
