/* Project Forms wizard styles (production app).
 *
 * project-forms-alpha/ is a staging copy of this app, with its own copy of
 * this file: it carries the "Alpha Testing" banner and the forms-list modal
 * rules that production drops. Changes made here have to be mirrored there
 * (and vice versa) — see ../README.md, "Relationship to the alpha app".
 *
 * Note: this is the APP stylesheet, loaded as `css/wizard.css`. The
 * site-wide Webflow stylesheet is a different file, loaded as
 * `../css/style.css` from static-web/css/.
 */

/* ---- page shell ---- */
html, body { height: 100%; }
/* Light-only design: opt every element (incl. Google's popover-rendered
   Places dropdown) out of the browser's dark-mode adaptation. */
html { color-scheme: light; }
body { display: flex; flex-direction: column; min-height: 100vh; }
.page-content { flex: 1; }
.navbar-brand-image { filter: none !important; }
.navbar-brand { width: 180px !important; }

.wizard { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 2rem; width: 100%; }

/* ---- progress stepper (new) ---- */
.stepper { display: flex; align-items: flex-start; padding: 0 0.5rem; }
.stepper.hidden { display: none; }
.stepper .stage { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; position: relative; }
.stepper .stage.done { cursor: pointer; }
.stepper .stage .dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
  background: var(--subtle-grey); border: 2px solid var(--light-grey); color: var(--light-grey);
  transition: all 0.3s ease; z-index: 1;
}
.stepper .stage .label {
  font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--light-grey); transition: color 0.3s ease; text-align: center; white-space: nowrap;
}
.stepper .stage::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px;
  background: var(--light-grey); z-index: 0; transition: background 0.3s ease;
}
.stepper .stage:first-child::before { display: none; }
.stepper .stage.done .dot, .stepper .stage.current .dot {
  background: var(--_color---accent, #1f453f); border-color: var(--_color---accent, #1f453f); color: var(--white);
}
.stepper .stage.current .dot { box-shadow: 0 0 0 4px var(--_color---subtle-accent, #c6f0dc); }
.stepper .stage.done::before { background: var(--_color---accent, #1f453f); }
.stepper .stage.done .label { color: var(--grey); }
.stepper .stage.current .label { color: var(--_color---accent, #1f453f); font-weight: 600; }

.progress-compact { display: none; }
@media (max-width: 520px) {
  .stepper { display: none !important; }
  .progress-compact { display: block; }
  .progress-compact.hidden { display: none; }
  .progress-compact .meta { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.5rem; }
  .progress-compact .meta .stage-name { color: var(--_color---accent, #1f453f); font-weight: 600; }
  .progress-compact .bar { height: 6px; background: var(--subtle-grey); border-radius: 99px; overflow: hidden; }
  .progress-compact .bar > span { display: block; height: 100%; background: var(--_color---accent, #1f453f); transition: width 0.35s ease; }
}

/* ---- step + transitions (new) ---- */
.stage-viewport { position: relative; }
.step { display: flex; flex-direction: column; gap: 1.25rem; }
.step h2, .step h4 { margin: 0; }
.step .lead { margin: 0; }
.step .eyebrow {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--_color---light-accent, #39736a); font-weight: 600; margin: 0;
}
/* centered step header: "Step x of N" over the form name */
.step-head { display: flex; flex-direction: column; gap: 0.3rem; text-align: center; }
.step-head .form-name { color: var(--grey); }
@keyframes slideInR { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInL { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: translateX(0); } }
.step.enter-right { animation: slideInR 0.28s ease; }
.step.enter-left  { animation: slideInL 0.28s ease; }
@media (prefers-reduced-motion: reduce) { .step { animation: none !important; } }

/* ---- fields (labels/tooltip new; inputs reuse .text-field .w-input) ---- */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field .label-row { display: flex; align-items: center; gap: 0.4rem; }
.field label { font-size: 0.9rem; font-weight: 500; color: var(--black); }
.field .req { color: #ea384c; }
.field .help {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--light-grey);
  color: var(--light-grey); font-size: 0.68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: help; position: relative; line-height: 1;
}
.field .help:hover { border-color: var(--_color---accent, #1f453f); color: var(--_color---accent, #1f453f); }
.field .help .tip {
  position: absolute; bottom: 140%; left: 50%; transform: translateX(-50%);
  background: var(--black); color: var(--white); font-size: 0.75rem; font-weight: 400; line-height: 1.35;
  padding: 0.5rem 0.7rem; border-radius: 4px; width: 210px; text-align: left;
  opacity: 0; visibility: hidden; transition: opacity 0.18s ease; z-index: 5; pointer-events: none;
}
.field .help .tip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--black);
}
.field .help:hover .tip, .field .help:focus .tip { opacity: 1; visibility: visible; }
/* always-visible subtitle under a label (field.info); supports inline links */
.field .field-info { margin: -0.1rem 0 0; font-size: 0.8rem; font-weight: 400; line-height: 1.4; color: var(--grey); }
.field .field-info a { color: var(--_color---accent, #1f453f); text-decoration: underline; font-size: inherit; font-weight: inherit; line-height: inherit; }

/* repeat groups (fields that expand by a count) — new */
.repeat-group { display: flex; flex-direction: column; gap: 1.1rem; }
.array-item {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1rem 1.1rem; border: 1px solid var(--subtle-grey);
  border-radius: 6px; background: var(--white);
}
.array-item .array-title {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600; color: var(--_color---accent, #1f453f);
}
.repeat-hint { margin: 0; color: var(--grey); font-size: 0.85rem; font-style: italic; }

/* prefix/suffix affixes on text-ish inputs — new */
.input-group { display: flex; align-items: stretch; }
.input-group .text-field { flex: 1; }
.input-group .affix {
  display: flex; align-items: center; padding: 0 0.75rem; white-space: nowrap;
  background: var(--subtle-grey); border: 1px solid var(--light-grey);
  color: var(--grey); font-size: 0.95rem;
}
.input-group .affix.prefix { border-right: none; border-radius: 4px 0 0 4px; }
.input-group .affix.suffix { border-left: none; border-radius: 0 4px 4px 0; }
.input-group .text-field.has-prefix { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .text-field.has-suffix { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* Google Places autocomplete element — match wizard input width.
   Force the light theme so the predictions dropdown doesn't follow the
   browser's dark mode (dark bg + dark text is unreadable on this light form). */
gmp-place-autocomplete, .gmp-address { display: block; width: 100%; color-scheme: light; }

/* selected-address chip (persists across re-renders) */
.address-selected {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.8rem 1rem; border: 1px solid var(--_color---accent, #1f453f);
  border-radius: 4px; background: var(--white);
}
.address-selected .address-text { color: var(--black); font-size: 0.95rem; line-height: 1.4; }
.address-change {
  background: transparent; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--_color---accent, #1f453f); text-decoration: underline; white-space: nowrap;
}

/* choice cards (radio/checkbox/multi-select) — new */
.choices { display: flex; flex-direction: column; gap: 0.6rem; }
.choice {
  display: flex; align-items: center; gap: 0.7rem;
  border: 1px solid var(--light-grey); background: var(--subtle-grey);
  padding: 0.8rem 1rem; border-radius: 4px; cursor: pointer; transition: all 0.2s ease;
}
.choice:hover { background: var(--white); border-color: var(--_color---light-accent, #39736a); }
.choice.selected,
.choice:has(input:checked) { border-color: var(--_color---accent, #1f453f); background: var(--white); box-shadow: 0 0 0 2px var(--_color---subtle-accent, #c6f0dc); }
/* short-option choice sets (e.g. compass directions) in a responsive grid */
.choices.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.choice input { accent-color: var(--_color---accent, #1f453f); width: 18px; height: 18px; }
.choice span { color: var(--black); font-size: 0.95rem; }

/* selectable option buttons (state grid / form list) — new */
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.option-list { display: flex; flex-direction: column; gap: 0.75rem; }
.option-btn {
  font-family: inherit; font-size: 1rem; color: var(--black); text-align: left;
  border: 1px solid var(--light-grey); background: var(--subtle-grey);
  padding: 1rem 1.25rem; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; width: 100%;
}
.option-grid .option-btn { text-align: center; }
.general-row .option-btn { text-align: center; }
.option-btn:hover { background: var(--white); border-color: var(--_color---light-accent, #39736a); }
.option-btn.selected { border-color: var(--_color---accent, #1f453f); background: var(--white); box-shadow: 0 0 0 2px var(--_color---subtle-accent, #c6f0dc); }
.form-option { display: flex; align-items: stretch; gap: 0.6rem; }
.form-option .form-main {
  flex: 1; display: flex; align-items: center; gap: 0.7rem;
  background: var(--white); border-color: var(--_color---light-accent, #39736a);
}
.form-option .form-main .form-ic { flex: 0 0 auto; color: var(--_color---accent, #1f453f); }
.form-option .form-main .form-label { flex: 1; }
.form-option .form-main .form-arrow {
  flex: 0 0 auto; font-size: 1.4rem; line-height: 1; color: var(--_color---accent, #1f453f);
  transition: transform 0.15s ease;
}
.form-option .form-main:hover { background: var(--_color---subtle-accent, #c6f0dc); }
.form-option .form-main:hover .form-arrow { transform: translateX(3px); }
.form-option .preview-btn { white-space: nowrap; font-size: 0.85rem; padding: 0.6rem 1.1rem; display: inline-flex; align-items: center; }

@keyframes expand { from { opacity: 0; max-height: 0; transform: translateY(-6px); } to { opacity: 1; max-height: 220px; transform: translateY(0); } }
.conditional { animation: expand 0.3s ease; overflow: hidden; }

/* summary (new) */
.summary { border: 1px solid var(--subtle-grey); border-radius: 4px; overflow: hidden; }
.summary .grp-title {
  background: var(--subtle-grey); color: var(--black);
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; padding: 0.55rem 1rem;
}
.summary .row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 1rem; border-top: 1px solid var(--subtle-grey); }
.summary .row .k { color: var(--grey); font-size: 0.88rem; }
.summary .row .v { color: var(--black); font-size: 0.88rem; font-weight: 500; text-align: right; }

.result-banner { padding: 1.1rem 1.25rem; border-radius: 4px; display: flex; gap: 0.8rem; align-items: flex-start; font-size: 0.95rem; line-height: 1.5; }
.result-banner.ok { background: var(--_color---subtle-accent, #c6f0dc); color: var(--_color---accent, #1f453f); }
.result-banner.ok .ic { font-weight: 700; }
.result-banner.fail { background: #f8d7da; color: #721c24; }
.result-banner.warn { background: #fff3cd; color: #856404; }

.response-message { margin: 0; color: var(--black); font-size: 0.95rem; line-height: 1.6; }

/* eSign instructions (response page) */
.esign {
  border: 1px solid var(--subtle-grey); border-left: 3px solid var(--_color---accent, #1f453f);
  border-radius: 4px; padding: 1.1rem 1.25rem; background: var(--subtle-grey);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.esign h3 {
  margin: 0; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600; color: var(--_color---accent, #1f453f);
}
.esign p { margin: 0; color: var(--black); font-size: 0.9rem; line-height: 1.5; }
.esign ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.esign li { color: var(--black); font-size: 0.9rem; line-height: 1.5; }

.hero-center { text-align: center; display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
.hero-center .lead { max-width: 520px; margin: 0 auto; }
/* widen only the welcome hero on large screens (form steps stay narrow) */
@media (min-width: 900px) {
  .wizard:has(.hero-center) { max-width: 780px; }
  .wizard:has(.hero-center) .hero-center .lead { max-width: 640px; }
}

.nav-row { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; }
/* ghost variant of the existing .button */
.button.ghost { background: transparent !important; color: var(--black) !important; border: 1px solid var(--black); }

.support-note { text-align: center; color: var(--grey); font-size: 0.85rem; line-height: 1.5; max-width: 560px; margin: 2rem auto 0; padding: 0 1.5rem; }
.support-note a { color: var(--_color---accent, #1f453f); }

.start-over-row { display: flex; justify-content: center; }
.start-over-row.hidden { display: none; }

.spinner {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  margin: 0 auto;
}
.spinner .dot-pulse {
  display: inline-flex;
  gap: 6px;
}
.spinner .dot-pulse span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #333;
  animation: pulse 1.4s ease-in-out infinite;
}
.spinner .dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.spinner .dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
