/* Sign-Up form — implements the spacing rules from
   signup-form-element-checklist.md:
   - single column, full-width fields, no side-by-side fields
   - 16-24px between fields within a group
   - 32-40px between groups
   - all inputs/buttons >= 44px tall; primary buttons >= 48px
   - adjacent interactive elements (trifold buttons) >= 8px gap
   - tightly-coupled output text sits close to its trigger field
   - conditional elements reserve their slot (no layout jump)

   2026-07-14: re-themed to match pulseraproject.org's look --
   cream/paper background, deep maroon primary accent (their nav-link
   color), a soft rainbow accent bar echoing the logo's multicolor
   lettering, and Quicksand/Nunito for a slightly warmer, rounder feel
   than the plain system font. Nothing fancy, just enough of a "splash
   of color" that this doesn't feel like a disconnected third-party form.
*/

:root {
  --color-text: #2c2422;
  --color-muted: #6b5d57;
  --color-border: #ded0c4;
  --color-primary: #7d1f3d;
  --color-primary-dark: #5c1730;
  --color-warning: #b91c1c;
  --color-bg-page: #faf5ec;
  --color-bg-card: #f7ece3;
  --color-bg-card-alt: #f3e6e6;
  --font-heading: 'Quicksand', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --rainbow: linear-gradient(90deg, #e0457b, #f2b134, #3f7cac, #5aa17f, #e0457b);
  --group-gap: 36px;
  --field-gap: 20px;
}

* { box-sizing: border-box; }

/* 2026-07-15 fix: this is why NONE of the form's conditional show/hide
   logic was visually working (returning-school fields, the referral
   follow-up fields, the Advisor/Co-Coordinator toggle) even though
   app.js was correctly setting .hidden = true/false the whole time.
   Several rules below (.field, .field-group, .conditional-box) set an
   explicit `display` value for layout. Per the CSS cascade, an AUTHOR
   stylesheet's `display` declaration beats the browser's built-in
   `[hidden] { display: none }` rule even at equal specificity, because
   origin (author vs. user-agent) is resolved before specificity/source
   order. So every element carrying one of those classes ignored
   `hidden` entirely and stayed visually visible/flex no matter what JS
   did to its `hidden` attribute. This single rule restores real
   hidden-attribute behavior everywhere, unconditionally. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg-page);
  line-height: 1.5;
}

.brand-accent-bar {
  height: 6px;
  width: 100%;
  background: var(--rainbow);
}

.form-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.brand-kicker {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.form-header h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.9rem;
  margin-bottom: 4px;
  color: var(--color-text);
}

.form-header p {
  color: var(--color-muted);
  margin-top: 0;
}

.form-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-of-type {
  border-bottom: none;
}

.section-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 var(--group-gap);
  padding-bottom: 10px;
  color: var(--color-primary);
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: var(--rainbow);
}

/* single-column field layout, no side-by-side fields at any breakpoint */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--field-gap);
  margin-bottom: var(--group-gap);
}

.field-group:last-child {
  margin-bottom: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 100%;
  background: #fff;
  color: var(--color-text);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.checkbox-field {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

.checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.checkbox-field label {
  font-weight: 400;
}

/* Two-option "first sale vs. been involved before" control, replacing
   the old single override checkbox with an explicit binary choice. */
.radio-field-group {
  gap: 10px;
}

.radio-group-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.radio-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-bg-card);
}

/* tightly-coupled live output text: sits close to its trigger, not a new group */
.output-text {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.output-text.tight {
  margin-top: 4px;
}

.output-text.warning {
  color: var(--color-warning);
  font-weight: 600;
}

.welcome-back {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 10px;
}

.history-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 110px;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
  /* A returning school's history can outgrow the visible width (this now
     renders every past semester, not just the last 3) -- scroll instead
     of squishing bars down to illegibility. */
  overflow-x: auto;
}

.history-chart .history-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  width: 48px;
}

/* Fixed-height track the bar grows inside of. Keeping this separate from
   the label below it means a 100%-tall bar can never crowd the semester
   label out of the layout (that was the earlier bug -- labels were
   present in the DOM but had zero room left to render in). */
.history-chart .history-bar-track {
  width: 100%;
  height: 78px;
  display: flex;
  align-items: flex-end;
}

.history-chart .history-bar {
  width: 100%;
  max-width: 36px;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  background: var(--rainbow);
  min-height: 4px;
}

.history-chart .history-bar-label {
  font-size: 0.7rem;
  color: var(--color-muted);
  text-align: center;
  white-space: nowrap;
}

/* 2026-07-15: the per-semester dollar amount used to be hover-only (a
   native `title` tooltip on the bar). C reported hover wasn't showing
   anything -- native title tooltips are slow, inconsistent across
   browsers, and don't work on touch at all, which also cuts against
   "quick and efficient." Showing the amount as always-visible text
   removes the dependency on hover working at all. */
.history-chart .history-bar-amount {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  white-space: nowrap;
}

/* typeahead suggestions box, directly under schoolNameInput */
.suggestions-box {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 20;
  /* extra clearance so a mobile keyboard doesn't cover the list */
  margin-bottom: 24px;
}

.suggestions-box li {
  padding: 12px;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.suggestions-box li:hover,
.suggestions-box li:focus {
  background: var(--color-bg-card);
}

/* conditional boxes reserve their slot -- container stays in flow,
   just empty/hidden, so nothing collapses/jumps */
.conditional-slot {
  min-height: 44px;
}

.conditional-box {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  gap: var(--field-gap);
}

.conditional-box h3 {
  font-family: var(--font-heading);
  margin: 0;
  font-size: 1rem;
  color: var(--color-primary);
}

/* sales history box gets the alternate pastel (dusty-rose) so it
   visually pairs with, but doesn't duplicate, the other conditional
   boxes on the page */
#salesHistoryBox {
  background: var(--color-bg-card-alt);
}

/* Impact stats -- "$80 covers a month of scholarships" style lines, shown
   under both the historical total-raised figure and the live-entered goal.
   Only rendered once at least 1 unit of a given impact type is reached
   (app.js filters these out client-side), so the container itself is only
   ever unhidden when there's at least one line to show. */
.impact-stats {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.impact-stat-line {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Add-to-calendar links under the sale date range text */
.calendar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.calendar-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
}

.calendar-link:hover {
  color: var(--color-primary-dark);
}

/* UPS address-validation suggestion/warning box under the shipping address
   fields. Two visual variants driven by a modifier class from app.js:
   .is-suggestion (calm, "we found a slightly different match") and
   .is-warning (UPS found nothing close -- softer amber, not red, since this
   never blocks submission and is often a false positive for new buildings,
   PO boxes, etc.). */
.address-check-box {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.address-check-box.is-suggestion {
  border-color: var(--color-primary);
  background: var(--color-bg-card-alt);
}

.address-check-box.is-warning {
  border-color: #d9a441;
  background: #fdf6e8;
}

.address-check-message {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.address-check-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.address-check-actions .btn {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* buttons */
.btn {
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--color-primary);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--color-primary);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  min-height: 48px;
}

.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border);
}

/* Selected trifold/choice button: a clear solid fill so the chosen option
   is unmistakable. Previously the "Yes" button was styled solid (btn-primary)
   by default, so it LOOKED already-selected before any click -- coordinators
   skipped clicking it and hit "Please choose a trifold option" on submit.
   Now every choice button starts neutral and only the clicked one fills in. */
.btn-selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* One-tap "Did you mean ..." suggestion under the school-name field */
.school-match-suggest {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary, #7a1f3d);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.school-match-suggest:hover { opacity: 0.8; }
/* state hint in the typeahead suggestions, e.g. "Bensalem HS — PA" */
.suggestion-state {
  color: var(--color-text-muted, #6b7280);
  font-weight: 400;
}

.btn-block {
  width: 100%;
}

/* adjacent interactive elements: min 8px gap even in a tight cluster */
.button-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.submit-group {
  margin-top: var(--group-gap);
}

.success-panel {
  text-align: center;
  padding: 48px 20px;
}

.success-panel h2 {
  font-family: var(--font-heading);
  color: var(--color-primary);
}

.success-panel p {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.success-panel a {
  color: var(--color-primary);
  font-weight: 700;
}

.success-benefits-list {
  max-width: 480px;
  margin: 12px auto 24px;
  padding-left: 20px;
  text-align: left;
  color: var(--color-text);
}

.success-benefits-list li {
  margin-bottom: 8px;
}

.dashboard-preview-figure {
  max-width: 480px;
  margin: 24px auto 0;
}

.dashboard-preview-image {
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.dashboard-preview-figure figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

@media (max-width: 480px) {
  .form-page { padding: 16px 16px 64px; }
}
