/* Lead funnel (Views/Funnel/Index.cshtml). Restyles the ADX FieldsRenderer output — a Bootstrap-style
   grid of .row / .form-group.col-md-N / .form-control — to this site's design. Scoped to .funnel-fields.
   Ported from theedudirectory.com's ted-fields.css. */

/* Search path as a stack of section cards. Without JS every card is open; funnel.js adds .is-stepped:
   one card open at a time, finished cards fold to a summary of the answers with an Edit link. */
.funnel-sections { display: flex; flex-direction: column; gap: .75rem; }
.funnel-section { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; scroll-margin-top: 96px; }
.section-head { display: flex; align-items: flex-start; gap: .9rem; padding: 1.1rem 1.25rem; }
/* Section marker: empty ring (upcoming), filled dot (current), green tick (done). No numbers. */
.section-num {
  flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-top: .3rem; border-radius: 50%;
  background: var(--white); border: 2px solid #b9c2cf; color: var(--white); font: 700 .8rem var(--sans);
}
.section-titles { flex: 1; min-width: 0; }
.section-titles h2 { font-size: 1.2rem; margin: .2rem 0 .15rem; }
.section-titles .step-intro { color: var(--slate); margin: 0; font-size: .92rem; }
.section-summary { margin: .3rem 0 0; color: var(--ink); font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; }
.section-edit { flex: none; align-self: center; background: none; border: 0; padding: .3rem .4rem; color: var(--accent); font: 600 .9rem var(--sans); text-decoration: underline; cursor: pointer; }
.section-body { padding: 0 1.25rem 1.35rem 4.15rem; }
.section-body .section-continue, .funnel-submit { margin-top: 1.25rem; }
@media (max-width: 560px) {
  .section-head { padding: 1rem; gap: .7rem; }
  .section-body { padding: 0 1rem 1.15rem; }
}

.is-stepped .funnel-section:not(.is-open) .section-body { display: none; }
.is-stepped .funnel-section:not(.is-open) .step-intro { display: none; }
.is-stepped .funnel-section.is-open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(12, 33, 64, .08); }
.is-stepped .funnel-section.is-open .section-num { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--white); }
.is-stepped .funnel-section.is-done:not(.is-open) .section-num { background: var(--ok); border-color: var(--ok); }
.is-stepped .funnel-section.is-done:not(.is-open) .section-num::after { content: "\2713"; font-size: .8rem; }
.is-stepped .funnel-section:not(.is-open):not(.is-done) { opacity: .7; }
.is-stepped .funnel-section:not(.is-open):not(.is-done) .section-titles h2 { color: var(--slate); }

/* Tracker: numbered stops joined by a line that fills in as sections are finished. */
.funnel-stepper { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; }
.funnel-stepper li { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 0; text-align: center; }
.funnel-stepper li + li::before { content: ""; position: absolute; top: .85rem; right: 50%; width: 100%; height: 2px; background: var(--rule); z-index: 0; }
.funnel-stepper li.is-done + li::before, .funnel-stepper li.is-done + li.is-current::before { background: var(--ok); }
.funnel-stepper .dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--white); border: 2px solid #b9c2cf; color: var(--white); font: 700 .8rem var(--sans);
}
.funnel-stepper .label { font-size: .78rem; color: var(--slate); line-height: 1.25; padding: 0 .25rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.funnel-stepper li.is-current .dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px var(--white); }
.funnel-stepper li.is-current .label { color: var(--navy-deep); font-weight: 700; }
.funnel-stepper li.is-done .dot { border-color: var(--ok); background: var(--ok); }
.funnel-stepper li.is-done .dot::after { content: "\2713"; font-size: .8rem; }
.funnel-stepper li.is-done[role=button] { cursor: pointer; }
.funnel-stepper li.is-done[role=button]:hover .label { color: var(--navy-deep); text-decoration: underline; }
@media (max-width: 560px) { .funnel-stepper li:not(.is-current) .label { display: none; } }

/* Field grid: honours the col-md-N widths the renderer derives from each field's order. */
.funnel-fields .row { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 1.25rem; }
.funnel-fields .form-group { grid-column: 1 / -1; margin-bottom: 1.25rem; }
.funnel-fields .row:last-child .form-group:last-child { margin-bottom: 0; }
.funnel-fields .form-group.col-md-1 { grid-column: span 1; }
.funnel-fields .form-group.col-md-2 { grid-column: span 2; }
.funnel-fields .form-group.col-md-3 { grid-column: span 3; }
.funnel-fields .form-group.col-md-4 { grid-column: span 4; }
.funnel-fields .form-group.col-md-5 { grid-column: span 5; }
.funnel-fields .form-group.col-md-6 { grid-column: span 6; }
.funnel-fields .form-group.col-md-7 { grid-column: span 7; }
.funnel-fields .form-group.col-md-8 { grid-column: span 8; }
.funnel-fields .form-group.col-md-9 { grid-column: span 9; }
.funnel-fields .form-group.col-md-10 { grid-column: span 10; }
.funnel-fields .form-group.col-md-11 { grid-column: span 11; }
.funnel-fields .form-group.col-md-12 { grid-column: span 12; }
@media (max-width: 767px) { .funnel-fields .form-group[class*="col-md-"] { grid-column: 1 / -1; } }

.funnel-fields .form-group > label:not(.group):not(.container_check) { display: block; font-weight: 600; font-size: .92rem; color: var(--ink); margin-bottom: .4rem; }
.funnel-fields sup { color: var(--err); }
.funnel-fields input.form-control:not([type="radio"]):not([type="checkbox"]),
.funnel-fields select.form-control {
  display: block; width: 100%; height: 2.85rem; padding: 0 .8rem;
  font: 400 1rem var(--sans); color: var(--ink); background: var(--white);
  border: 1px solid #b9c2cf; border-radius: 10px;
}
.funnel-fields select.form-control { cursor: pointer; }
.funnel-fields .form-control:focus { outline: 3px solid rgba(47, 111, 209, .3); border-color: var(--focus); }

/* Radio options as selectable cards; two per row on wider screens. */
.funnel-fields .form-group:has(label.group) { display: flex; flex-wrap: wrap; gap: .5rem; }
.funnel-fields .form-group:has(label.group) > label:not(.group):not(.container_check) { flex: 1 1 100%; margin-bottom: .2rem; }
.funnel-fields .form-group label.group {
  position: relative; display: flex; align-items: center; gap: .6rem; flex: 0 1 calc(50% - .25rem);
  padding: .7rem .9rem; background: var(--white); border: 1px solid var(--rule); border-radius: 10px;
  font-size: .95rem; cursor: pointer;
}
@media (max-width: 640px) { .funnel-fields .form-group label.group { flex-basis: 100%; } }
/* Two-option questions (e.g. Yes / No): compact cards side by side, even on phones.
   Labels in the group: the question's own label, then one per option. */
.funnel-fields .form-group:has(> label.group:nth-of-type(3)):not(:has(> label.group:nth-of-type(4))) label.group { flex: 1 1 0; min-width: 0; max-width: 11rem; }
.funnel-fields .form-group label.group:hover { border-color: #9fb4d3; }
.funnel-fields .form-group label.group input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.funnel-fields .form-group label.group .checkmark {
  margin-left: auto; flex-shrink: 0; width: 1.2rem; height: 1.2rem; border: 2px solid #b9c2cf; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.funnel-fields .form-group label.group:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #f5f8fe; font-weight: 600; color: var(--navy-deep); }
.funnel-fields .form-group label.group:has(input:checked) .checkmark { border-color: var(--accent); background: var(--accent); }
.funnel-fields .form-group label.group:has(input:checked) .checkmark::after {
  content: ""; width: .32rem; height: .58rem; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.funnel-fields .form-group label.group:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Consent / TCPA lines. */
.funnel-fields label.container_check { display: flex; align-items: flex-start; gap: .5rem; font-size: .8rem; color: var(--slate); line-height: 1.45; }
/* The module renders consent text first and the checkbox after it; show the box on the left. */
.funnel-fields label.container_check input[type="checkbox"] { order: -1; flex: none; width: 1.15rem; height: 1.15rem; margin: .1rem 0 0; accent-color: var(--accent); cursor: pointer; }
.funnel-fields label.container_check .checkmark { display: none; }
.funnel-fields label.container_check { cursor: pointer; gap: .65rem; }
.funnel-fields .form-group:has(> input[type="checkbox"]) { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .6rem; }
.funnel-fields .form-group > input[type="checkbox"] { flex-shrink: 0; width: 1.1rem; height: 1.1rem; margin-top: .15rem; accent-color: var(--accent); }
.funnel-fields .form-group > input[type="checkbox"] + label:not(.group):not(.container_check) { flex: 1 1 0; min-width: 0; margin: 0; font-size: .8rem; font-weight: 400; line-height: 1.5; color: var(--slate); }
.funnel-fields .form-group:has(> input[type="checkbox"]) > label.error { flex-basis: 100%; }

/* jquery.validate marks the field and adds a label.error message. */
.funnel-fields label.error { display: block; flex-basis: 100%; margin: .35rem 0 0; color: var(--err) !important; font-size: .82rem !important; font-weight: 500 !important; }
.funnel-fields .form-control.error { border-color: var(--err); }

/* Matched offers. */
.offer-card { display: grid; gap: 1rem 1.5rem; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.35rem; }
.offer-card + .offer-card { margin-top: 1rem; }
@media (min-width: 720px) { .offer-card { grid-template-columns: 180px minmax(0, 1fr); } }
.offer-card .logo-box { display: grid; place-items: center; height: 96px; border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .6rem; background: var(--white); }
.offer-card .logo-box img { max-height: 76px; max-width: 100%; object-fit: contain; }
.offer-card h2 { font-size: 1.3rem; margin-bottom: .4rem; }
.offer-card .offer-desc { color: #3a4556; font-size: .95rem; }
.offer-card .funnel-fields { margin-top: 1rem; }
.offer-card.is-done { opacity: .85; }
.offer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; }
.offer-actions form { margin: 0; }
.link-skip { background: none; border: 0; padding: .3rem .4rem; color: var(--slate); font: 500 .85rem var(--sans); cursor: pointer; text-decoration: underline; }
.link-skip:hover { color: var(--ink); }
/* No matches: an explanation card with suggestions, then quick links to browse by field. */
.funnel-empty { display: grid; gap: 1.5rem; }
.empty-card { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; padding: 2rem; text-align: center; }
.empty-icon { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 1rem; }
.empty-icon svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.empty-card h2 { font-size: 1.4rem; margin: 0 0 .5rem; }
.empty-card > p { color: var(--slate); max-width: 46ch; margin: 0 auto .9rem; }
.empty-tips { list-style: none; margin: 0 auto 1.4rem; padding: 0; display: grid; gap: .4rem; max-width: 26rem; text-align: left; font-size: .92rem; color: var(--ink); }
.empty-tips li { position: relative; padding-left: 1.4rem; }
.empty-tips li::before { content: ""; position: absolute; left: .2rem; top: .55em; width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.empty-browse h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.empty-browse ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.empty-browse a { display: flex; height: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); color: var(--navy-deep); font-weight: 600; font-size: .9rem; text-decoration: none; }
.empty-browse a:hover { border-color: #9fb4d3; }
.empty-browse .icon-badge { width: 2rem; height: 2rem; border-radius: 8px; }
.empty-browse .icon-badge svg { width: 1.1rem; height: 1.1rem; }
@media (max-width: 560px) { .empty-card { padding: 1.5rem 1.1rem; } }

/* "Finding your matches" state while offers are composed. */
.search-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(246, 247, 249, .96); text-align: center; padding: 1.5rem; }
.search-overlay .overlay-title { font: 700 1.3rem var(--display); color: var(--navy-deep); margin: 1rem 0 .25rem; }
.spinner, .btn-spinner { display: inline-block; border-radius: 999px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner { width: 3rem; height: 3rem; }
.btn-spinner { width: 1em; height: 1em; border-width: 2px; border-color: currentColor; border-right-color: transparent; margin-right: .5rem; vertical-align: -.125em; }
@keyframes spin { to { transform: rotate(360deg); } }
.is-locked { pointer-events: none; opacity: .6; }

/* Small screens: let the form column shrink and stack fields. */
.with-aside > .funnel-form { min-width: 0; }
@media (max-width: 767px) {
  .funnel-fields .row { display: block; }
}
