/* ==========================================================================
   ASHBORN PARTNERS — UTILITY BILL ANALYZER: EMBEDDED LEAD FORM STYLES
   ==========================================================================
   Styles the homeowner lead form (imported from homeowners.html by
   assets/uba-lead-form.js) when it is shown on top of the Utility Bill
   Analyzer. Everything here is copied from styles.css — the same look the
   form has everywhere else on the site — and scoped under one wrapper
   class, .uba-funnel-scope, so none of it touches the analyzer's own
   design (which has its own colors, fonts and dark/light theme and must
   not be affected by this file).
   ========================================================================== */

.uba-funnel-scope {
  --bg: #F7F6F1;
  --bg-alt: #EFEDE5;
  --dark: #10241C;
  --dark-3: #1E3F33;
  --accent: #35D07F;
  --accent-dark: #23A863;
  --text: #12201A;
  --text-muted: #57665F;
  --text-on-dark: #F4F5F1;
  --border: #E2DFD4;
  --white: #FFFFFF;
  --error: #C5453A;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-card: 0 1px 2px rgba(16, 36, 28, 0.04), 0 12px 32px -16px rgba(16, 36, 28, 0.18);
  --shadow-float: 0 24px 60px -20px rgba(16, 36, 28, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* The form's base text settings — the same as <body> in styles.css.
     Without these the form inherits the analyzer's page text (a
     near-white color meant for its dark background), which made the
     heading, answer cards and other text invisible on the form's light
     card. Added 2026-09-29. */
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* The analyzer tells the browser its page is dark (color-scheme: dark),
     so the browser drew the form's buttons, checkboxes and autofilled
     fields in dark style (white text; gray autofilled address fields).
     The form is a light card, so it asks for light-style controls. */
  color-scheme: light;
}

.uba-funnel-scope h1, .uba-funnel-scope h2, .uba-funnel-scope h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  margin: 0 0 0.5em 0;
  letter-spacing: -0.01em;
  /* undo the analyzer's own heading color and balanced wrapping */
  color: inherit;
  text-wrap: wrap;
}
/* undo the analyzer's lighter bold (600) and button font rules, so the
   form matches homeowners.html exactly */
.uba-funnel-scope strong, .uba-funnel-scope b { font-weight: 700; }
.uba-funnel-scope button { font-family: revert; }
.uba-funnel-scope p { margin: 0 0 1em 0; color: var(--text-muted); }
.uba-funnel-scope a { color: inherit; }
.uba-funnel-scope :focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }

.uba-funnel-scope .sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- buttons (only the variants the form itself uses) ---- */
.uba-funnel-scope .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 15px 26px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.uba-funnel-scope .btn:active { transform: translateY(1px); }
.uba-funnel-scope .btn-primary { background: var(--dark); color: var(--text-on-dark); }
.uba-funnel-scope .btn-primary:hover { background: var(--dark-3); }
.uba-funnel-scope .btn-accent { background: var(--accent); color: var(--dark); }
.uba-funnel-scope .btn-accent:hover { background: var(--accent-dark); color: var(--text-on-dark); }
.uba-funnel-scope .btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.uba-funnel-scope .btn-outline:hover { border-color: var(--dark); }
.uba-funnel-scope .btn-block { width: 100%; }

/* ---- funnel modal ---- */
.uba-funnel-scope .funnel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 36, 28, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.uba-funnel-scope .funnel-overlay.open { display: flex; }

.uba-funnel-scope #fireworksCanvas {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.uba-funnel-scope .funnel-modal {
  background: var(--bg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.uba-funnel-scope .funnel-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 0 24px;
}

.uba-funnel-scope .funnel-progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.uba-funnel-scope .funnel-progress-fill {
  height: 100%;
  width: 16.66%;
  background: var(--accent-dark);
  border-radius: 4px;
  transition: width 0.35s var(--ease);
}

.uba-funnel-scope .funnel-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}
.uba-funnel-scope .funnel-close:hover { color: var(--text); }

.uba-funnel-scope .funnel-body {
  padding: 28px 32px 8px;
  overflow-y: auto;
}

.uba-funnel-scope .funnel-step h2 { font-size: 1.5rem; }
.uba-funnel-scope .funnel-sub { font-size: 0.98rem; margin-bottom: 24px; }

.uba-funnel-scope .funnel-step input[type="text"],
.uba-funnel-scope .funnel-step input[type="email"],
.uba-funnel-scope .funnel-step input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: 8px;
  background: var(--white);
  color: var(--text);
}
.uba-funnel-scope .funnel-step input:focus { outline: none; border-color: var(--dark); }
.uba-funnel-scope .funnel-step input.input-error { border-color: var(--error); }

.uba-funnel-scope .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.uba-funnel-scope .address-components {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: 4px 0 8px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}
.uba-funnel-scope .address-components-full { grid-column: 1 / -1; }
.uba-funnel-scope .address-components .field-group { margin-bottom: 0; }
.uba-funnel-scope .address-components input {
  margin-bottom: 0;
  background: var(--white);
}

.uba-funnel-scope .field-group { margin-bottom: 14px; }
.uba-funnel-scope .field-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.uba-funnel-scope .field-error {
  display: none;
  color: var(--error);
  font-size: 0.85rem;
  margin: 0 0 14px;
  /* utility-bill-analyzer.css has its own .field-error (a dark red box);
     these undo it so the form's error text looks like everywhere else. */
  background: none;
  border-radius: 0;
  padding: 0;
}
.uba-funnel-scope .field-error.show { display: block; }

.uba-funnel-scope .choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.uba-funnel-scope .choice-grid-list { grid-template-columns: 1fr; }

.uba-funnel-scope .choice-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.uba-funnel-scope .choice-card:hover { border-color: var(--dark-3); }
.uba-funnel-scope .choice-card.selected {
  border-color: var(--accent-dark);
  background: rgba(53, 208, 127, 0.1);
}

.uba-funnel-scope .funnel-step .btn { margin-top: 16px; }

.uba-funnel-scope .summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 22px;
  font-size: 0.95rem;
}
.uba-funnel-scope .summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.uba-funnel-scope .summary-row:last-child { border-bottom: none; }
.uba-funnel-scope .summary-row span:first-child { color: var(--text-muted); }
.uba-funnel-scope .summary-row span:last-child { font-weight: 600; text-align: right; }

.uba-funnel-scope .consent-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 6px;
  cursor: pointer;
}
.uba-funnel-scope .consent-row input { margin-top: 3px; flex-shrink: 0; }
.uba-funnel-scope .consent-row strong { color: var(--text); }

.uba-funnel-scope .consent-row span {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 6px;
}
.uba-funnel-scope .consent-row p { margin: 0 0 10px; }
.uba-funnel-scope .consent-row p:last-child { margin-bottom: 0; }
.uba-funnel-scope .consent-row a {
  color: var(--dark);
  text-decoration: underline;
  cursor: pointer;
}
.uba-funnel-scope .consent-row a:hover { color: var(--accent-dark); }

.uba-funnel-scope .funnel-note {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 18px;
}
.uba-funnel-scope .funnel-note a {
  color: var(--dark);
  text-decoration: underline;
}
.uba-funnel-scope .funnel-note a:hover { color: var(--accent-dark); }
.uba-funnel-scope .funnel-note-tight { margin: -8px 0 18px; }

.uba-funnel-scope .hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.uba-funnel-scope .funnel-success { text-align: center; padding-top: 12px; }
.uba-funnel-scope .success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--dark);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.uba-funnel-scope .funnel-success .btn { margin-top: 10px; }

.uba-funnel-scope .funnel-back-row {
  padding: 4px 32px 24px;
}
.uba-funnel-scope .funnel-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 0;
}
.uba-funnel-scope .funnel-back:hover { color: var(--text); }

.uba-funnel-scope .funnel-skip {
  display: block;
  margin: 14px auto 0;
  padding: 8px 12px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.uba-funnel-scope .funnel-skip:hover { color: var(--text); }
.uba-funnel-scope .funnel-skip:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- confirmation dialog (exit warning) ---- */
.uba-funnel-scope .confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 36, 28, 0.7);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}
.uba-funnel-scope .confirm-overlay.open { display: flex; }

.uba-funnel-scope .confirm-modal {
  background: var(--bg);
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  padding: 32px;
  text-align: center;
}
.uba-funnel-scope .confirm-modal h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.uba-funnel-scope .confirm-modal p {
  font-size: 0.95rem;
  margin-bottom: 24px;
}
.uba-funnel-scope .confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.uba-funnel-scope .confirm-actions .btn { width: 100%; }

@media (min-width: 480px) {
  .uba-funnel-scope .confirm-actions { flex-direction: row-reverse; }
}

/* ---- address autocomplete dropdown (OpenStreetMap-powered) ---- */
.uba-funnel-scope .address-field { position: relative; }

.uba-funnel-scope .address-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
}
.uba-funnel-scope .address-suggestions.open { display: block; }

.uba-funnel-scope .address-suggestion-item {
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.uba-funnel-scope .address-suggestion-item:first-child { border-top: none; }
.uba-funnel-scope .address-suggestion-item:hover,
.uba-funnel-scope .address-suggestion-item.active {
  background: var(--bg-alt);
}

.uba-funnel-scope .address-suggestions-footer {
  padding: 8px 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

/* ---- small screens ---- */
@media (max-width: 720px) {
  .uba-funnel-scope .field-row { grid-template-columns: 1fr; }
  .uba-funnel-scope .address-components { grid-template-columns: 1fr 1fr; padding: 14px; }
  .uba-funnel-scope .choice-grid { grid-template-columns: 1fr; }
  .uba-funnel-scope .funnel-body { padding: 24px 20px 8px; }
  .uba-funnel-scope .funnel-topbar { padding: 16px 16px 0 20px; }
  .uba-funnel-scope .funnel-back-row { padding: 4px 20px 20px; }
  .uba-funnel-scope .btn { padding: 15px 22px; font-size: 0.95rem; }
}
