/* /self-assessment — the Node site's assessment-flow UI.
   Loaded after Bootstrap 5 + assets/css/main.css (same order as the Node page).
   Part 1 is the subset of the Node funnel-theme.css this page uses; part 2 is the Node
   assessment-flow.css; part 3 is what this page adds (focus tiles, panels, date picker). */

/* ═════════════ 1. Funnel theme (subset) ═════════════ */
:root {
  --primary-indigo: #0D3256;
  --spanish-green: #008944;
  --spanish-green-hover: #006432;
  --spanish-green-dim: rgba(0, 137, 68, 0.12);
  --bg-soft: #f9f9f9;
  --card-bg: #FFFFFF;
  --card-border: #e8e8e8;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.08);
  --success-dim: rgba(0, 137, 68, 0.12);
  --error: #F04444;
  --error-text: #D92D20;
  --error-dim: rgba(240, 68, 68, 0.12);
  --text-main: #2a2a2a;
  --text-secondary: #606060;
  --text-muted: #606060;
  --text-dim: #9a9a9a;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Outfit", system-ui, sans-serif;
}

.page-assessment-flow { font-family: var(--font); color: var(--text-main); }

.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: box-shadow .45s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 640px) { .glass-card { padding: 32px; } }
.glass-card:hover { box-shadow: var(--card-shadow-hover); }

.form-label { font-weight: 500; color: var(--text-main); margin-bottom: 6px; display: block; font-size: 15px; }
.field-wrap .form-label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 2px; }

.form-control,
.form-select,
textarea.form-control {
  background-color: #FFFFFF;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  -webkit-text-fill-color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 15px;
  transition: border-color .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s cubic-bezier(.2,.8,.2,1);
}
@media (max-width: 639px) {
  .form-control, .form-select, textarea.form-control { font-size: 16px; padding: 14px 16px; }
}
.form-control:not(:placeholder-shown) { border-color: #d8d8d8; }
.form-control:focus,
.form-select:focus {
  background-color: #FFFFFF;
  border-color: var(--spanish-green);
  box-shadow: 0 0 0 3px rgba(0, 137, 68, 0.12);
  outline: none;
}
.form-control::placeholder { color: #9a9a9a; -webkit-text-fill-color: #9a9a9a; opacity: 1; }
.form-control:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset;
  box-shadow: 0 0 0 1000px #FFFFFF inset;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23008944' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 16px 16px !important;
  padding-right: 44px !important;
}

/* Themed select: the native <select> stays as the value source, hidden behind a combobox. */
.custom-select { position: relative; width: 100%; }
.native-select-source {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; pointer-events: none;
}
.custom-select__trigger {
  width: 100%; min-height: 48px; padding: 12px 44px 12px 16px;
  display: flex; align-items: center; text-align: left; position: relative;
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  background: #FFFFFF; color: var(--text-main); font: 500 15px/1.4 var(--font);
  cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease;
}
@media (max-width: 767px) { .custom-select__trigger { font-size: 16px; min-height: 50px; } }
.custom-select__trigger:hover { border-color: rgba(0, 137, 68, 0.35); }
.custom-select__trigger:focus-visible,
.custom-select.is-open .custom-select__trigger {
  outline: none; border-color: var(--spanish-green); box-shadow: 0 0 0 3px rgba(0, 137, 68, 0.12);
}
.custom-select__trigger.is-placeholder { color: #606060; font-weight: 400; }
.custom-select__value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select__chevron {
  position: absolute; right: 17px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--spanish-green); border-bottom: 2px solid var(--spanish-green);
  transform: translateY(-70%) rotate(45deg); transition: transform .2s ease; pointer-events: none;
}
.custom-select.is-open .custom-select__chevron { transform: translateY(-20%) rotate(225deg); }
.custom-select:has(.native-select-source.is-invalid) .custom-select__trigger,
.custom-select__trigger[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-dim); }
.custom-select__panel {
  position: fixed; z-index: 100000; padding: 6px; overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; border: 1px solid var(--card-border); border-radius: 12px;
  background: #FFFFFF; box-shadow: var(--card-shadow-hover); font-family: var(--font); color: var(--text-main);
  scrollbar-width: thin; scrollbar-color: rgba(0, 137, 68, .35) transparent;
}
.custom-select__panel[hidden] { display: none; }
.custom-select__option {
  min-height: 44px; padding: 10px 36px 10px 12px; display: flex; align-items: center; position: relative;
  border-radius: 8px; color: var(--text-main); font-size: 15px; line-height: 1.4; cursor: pointer; user-select: none;
}
.custom-select__option:hover,
.custom-select__option.is-active { background: #daefe0; }
.custom-select__option.is-selected { color: var(--spanish-green); font-weight: 600; }
.custom-select__option.is-selected::after {
  content: "✓"; position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--spanish-green); font-size: 16px; font-weight: 700;
}

/* Buttons (funnel-theme's green outline, on top of main.css .btn) */
.btn-outline {
  background: transparent; color: var(--spanish-green) !important;
  border: 1.5px solid rgba(0, 137, 68, 0.35); border-radius: 16px; font-weight: 600;
}
.btn-outline:hover { border-color: var(--spanish-green); background: var(--spanish-green-dim); transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid rgba(0, 137, 68, .35); outline-offset: 2px; }

/* Info tooltips */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--spanish-green-dim); color: var(--spanish-green);
  border: 1px solid rgba(0, 137, 68, 0.28);
  font-size: 12px; font-weight: 600; font-style: italic; cursor: pointer;
  margin-left: 6px; vertical-align: middle; transition: transform .2s ease; flex-shrink: 0;
}
.info-icon:hover { transform: scale(1.1); }
@media (max-width: 639px) { .info-icon { width: 22px; height: 22px; font-size: 13px; } }
.info-icon-wrap { position: relative; display: inline-flex; align-items: center; }
.info-icon-wrap .info-tooltip {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  padding: 12px 16px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px;
  box-shadow: var(--card-shadow-hover); font-size: 13px; font-weight: 400; font-style: normal; line-height: 1.5;
  color: var(--text-main); min-width: 200px; max-width: 340px; z-index: 100;
  opacity: 0; visibility: hidden; pointer-events: none; white-space: normal;
}
.info-icon-wrap .info-tooltip::before {
  content: ""; position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 6px solid var(--card-bg);
}
@media (max-width: 639px) {
  .info-icon-wrap .info-tooltip { position: fixed; left: 16px; right: 16px; top: auto; bottom: 20px; transform: none; max-width: none; }
  .info-icon-wrap .info-tooltip::before { display: none; }
}
.info-icon-wrap.info-tooltip-open .info-tooltip { opacity: 1; visibility: visible; }

/* Validation */
input.form-control.is-invalid, textarea.form-control.is-invalid { background-image: none; padding-right: 16px; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-dim); }
.field-wrap.is-invalid { animation: field-shake 0.5s ease; }
@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); } 30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); } 60% { transform: translateX(4px); } 75% { transform: translateX(-2px); }
}
.field-error { display: block; font-size: 12px; font-weight: 500; color: var(--error-text); margin-top: 6px; min-height: 18px; }
.field-error:empty { margin-top: 0; min-height: 0; }
@media (max-width: 639px) { .field-error { font-size: 13px; } }

/* Sliders */
.form-range.slider-premium::-webkit-slider-thumb { background: var(--spanish-green); border: none; box-shadow: 0 2px 12px rgba(0, 137, 68, 0.3); width: 24px; height: 24px; margin-top: -9px; }
.form-range.slider-premium::-moz-range-thumb { background: var(--spanish-green); border: none; box-shadow: 0 2px 12px rgba(0, 137, 68, 0.3); width: 24px; height: 24px; }
.form-range.slider-premium::-webkit-slider-runnable-track { background: #e8e8e8; height: 6px; border-radius: 999px; }
.form-range.slider-premium::-moz-range-track { background: #e8e8e8; height: 6px; border-radius: 999px; }
.form-range.slider-premium:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(0, 137, 68, .2); }
.range-display { margin-top: 8px; color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* ═════════════ 2. Assessment-flow layout (Node assessment-flow.css) ═════════════ */
.page-assessment-flow { background: #fff; overflow-x: hidden; }
.page-assessment-flow .wrap { padding: 0 16px; }
.asmf-shell { padding: 12px 0 20px; }
.asmf-grid { max-width: 760px; margin: 0 auto; }

.asmf-hero { max-width: 1100px; margin: 0 auto 32px; }
.asmf-hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0; }
.asmf-hero-copy { flex: 1; min-width: 0; max-width: 520px; }
.asmf-headline {
  font-size: clamp(26px, 4vw, 34px); font-weight: 700; line-height: 1.15;
  color: var(--ink, #2a2a2a); margin: 0 0 14px; text-wrap: balance;
}
.asmf-headline em { font-style: normal; color: var(--spanish-green); display: block; }
.asmf-sub { color: var(--muted-ink, #606060); font-size: 15px; line-height: 1.6; margin: 0 0 20px; max-width: 42ch; }
.asmf-benefits { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.asmf-benefits li { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 13px; font-weight: 700; color: var(--ink, #2a2a2a); line-height: 1.2; }
.asmf-benefit-icon {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--spanish-green-dim); color: var(--spanish-green);
  display: flex; align-items: center; justify-content: center;
}
.asmf-benefit-icon svg { width: 19px; height: 19px; }
@media (max-width: 420px) {
  .asmf-benefits { gap: 6px; }
  .asmf-benefits li { font-size: 11.5px; gap: 6px; }
  .asmf-benefit-icon { width: 32px; height: 32px; }
  .asmf-benefit-icon svg { width: 15px; height: 15px; }
}
.asmf-side-media { flex-shrink: 0; width: min(260px, 40vw); }
.asmf-side-media img { display: block; width: 100%; height: auto; }

/* Stepper */
.asmf-stepper {
  display: flex; align-items: flex-start; justify-content: space-between; list-style: none;
  margin: 0 0 18px; padding: 18px 20px; background: #fff;
  border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow);
}
.asmf-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; }
.asmf-step:not(:last-child)::after {
  content: ''; position: absolute; top: 15px; left: calc(50% + 22px); width: calc(100% - 22px); height: 2px;
  background: var(--card-border); transition: background .3s ease;
}
.asmf-step--done:not(:last-child)::after { background: var(--spanish-green); }
.asmf-step-dot {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; background: var(--bg-soft); color: #9a9a9a;
  border: 2px solid var(--card-border); position: relative; z-index: 1; transition: background .3s ease, border-color .3s ease, color .3s ease;
}
.asmf-step--active .asmf-step-dot,
.asmf-step--done .asmf-step-dot { background: var(--spanish-green); border-color: var(--spanish-green); color: #fff; }
.asmf-step-label { font-size: 11.5px; font-weight: 600; color: #9a9a9a; }
.asmf-step--active .asmf-step-label { color: var(--ink, #2a2a2a); }
@media (max-width: 560px) {
  .asmf-step-label { display: none; }
  .asmf-stepper { padding: 8px; }
}

/* Card */
.asmf-card { display: flex; flex-direction: column; gap: 12px; }
.asmf-card-head { display: flex; align-items: center; gap: 16px; }
.asmf-card-title { font-size: 21px; font-weight: 700; color: var(--ink, #2a2a2a); margin: 0; }
.asmf-card-title:focus { outline: none; }
.asmf-card-body { display: flex; flex-direction: column; gap: 18px; }
.asmf-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.asmf-field-row > * { min-width: 0; }
.asmf-field-row--wrap { display: flex; flex-wrap: wrap; gap: 10px 20px; }
@media (max-width: 600px) { .asmf-field-row { grid-template-columns: 1fr; } }
.asmf-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink, #2a2a2a); cursor: pointer; min-height: 32px; }
.asmf-check input { width: 18px; height: 18px; accent-color: var(--spanish-green); flex: none; }

.asmf-card-footer { border-top: 1px solid var(--card-border); padding-top: 18px; }
.asmf-actions { display: flex; flex-direction: row; justify-content: flex-end; gap: 12px; }
.asmf-actions .btn { flex: 1; }
.asmf-actions .btn[hidden] { display: none; }

.asmf-page-footer { margin-top: 40px; padding: 20px 0 32px; border-top: 1px solid var(--card-border); }
.asmf-safety { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12.5px; color: var(--muted-ink, #606060); text-align: left; }
.asmf-safety-icon { color: var(--spanish-green); flex: none; }
.asmf-safety-icon svg { width: 22px; height: 22px; }

.asmf-condition-extra, .asmf-other-conditions {
  border: 1px solid var(--card-border); border-radius: var(--radius-sm); background: var(--bg-soft);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.asmf-condition-extra[hidden], .asmf-other-input[hidden] { display: none; }
.asmf-condition-extra-title { font-size: 13px; font-weight: 700; color: var(--ink, #2a2a2a); margin: 0; }
.asmf-other-input { margin-top: 4px; }
.asmf-optional-tag {
  font-size: 11px; font-weight: 700; color: #9a9a9a; text-transform: uppercase; letter-spacing: .03em;
  background: var(--bg-soft); padding: 2px 8px; border-radius: 999px; margin-left: 6px;
}

/* BMI panel */
.asmf-bmi-panel { margin-top: 4px; padding: 18px 16px; border-radius: 16px; border: 1px solid rgba(0, 137, 68, .18); background: linear-gradient(135deg, rgba(0, 137, 68, .06), rgba(255,255,255,.95)); }
.asmf-bmi-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
@media (max-width: 520px) { .asmf-bmi-grid { grid-template-columns: 1fr; } .asmf-bmi-arrow { display: none !important; } }
.asmf-bmi-card { background: #fff; border: 1px solid var(--card-border); border-radius: 14px; padding: 14px 12px; text-align: center; }
.asmf-bmi-card--target { border-color: rgba(0,137,68,.28); background: var(--spanish-green-dim); }
.asmf-bmi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #606060; margin-bottom: 6px; }
.asmf-bmi-value { font-size: clamp(24px, 5vw, 32px); font-weight: 800; letter-spacing: -.03em; color: var(--ink, #2a2a2a); line-height: 1; }
.asmf-bmi-card--target .asmf-bmi-value { color: var(--spanish-green); }
.asmf-bmi-tag { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg-soft); color: #606060; }
.asmf-bmi-tag.is-good { background: var(--spanish-green-dim); color: var(--spanish-green); }
.asmf-bmi-tag.is-warn { background: rgba(255,195,5,.15); color: #8a6200; }
.asmf-bmi-tag.is-alert { background: rgba(217,45,32,.1); color: #b42318; }
.asmf-bmi-arrow { display: flex; align-items: center; font-size: 20px; font-weight: 700; color: var(--spanish-green); opacity: .55; }

/* Loading overlay */
.asmf-loading {
  position: fixed; inset: 0; z-index: 9999; background: rgba(255,255,255,.98);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; backdrop-filter: blur(10px);
}
.asmf-loading[hidden] { display: none; }
.asmf-loading p { color: var(--spanish-green); font-weight: 600; margin: 0; }
.asmf-loading-spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid var(--spanish-green-dim); border-top-color: var(--spanish-green);
  animation: asmf-spin 0.8s linear infinite;
}
@keyframes asmf-spin { to { transform: rotate(360deg); } }

/* ═════════════ 3. This page ═════════════ */
.asmf-panel { display: flex; flex-direction: column; gap: 18px; animation: asmf-panel-in .35s cubic-bezier(.16,1,.3,1) both; }
.asmf-panel[hidden] { display: none; }
@keyframes asmf-panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Focus tiles (the Node markup's .asmf-option-* classes, which Node itself never styled) */
.asmf-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .asmf-option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.asmf-option-tile {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px;
  padding: 12px 14px; border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink, #2a2a2a); line-height: 1.25;
  transition: border-color .2s, background .2s, color .2s, transform .2s;
}
.asmf-option-tile:hover { border-color: rgba(0, 137, 68, .45); }
.asmf-option-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.asmf-option-check {
  width: 20px; height: 20px; flex: none; border-radius: 6px; border: 2px solid #cfcfcf; background: #fff;
  display: flex; align-items: center; justify-content: center; transition: background .2s, border-color .2s;
}
.asmf-option-check::after {
  content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px); opacity: 0; transition: opacity .15s;
}
.asmf-option-label { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 420px) {
  .asmf-option-grid { gap: 8px; }
  .asmf-option-tile { padding: 10px 10px; gap: 8px; font-size: 13.5px; }
  .asmf-option-check { width: 18px; height: 18px; }
}
.asmf-option-tile:has(input:checked) { border-color: var(--spanish-green); background: var(--spanish-green-dim); color: var(--spanish-green); }
.asmf-option-tile:has(input:checked) .asmf-option-check { background: var(--spanish-green); border-color: var(--spanish-green); }
.asmf-option-tile:has(input:checked) .asmf-option-check::after { opacity: 1; }
.asmf-option-tile:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(0, 137, 68, .25); }
.asmf-option-tile--none { border-style: dashed; grid-column: 1 / -1; }

/* Date of birth picker — light, brand green */
.flatpickr-calendar { font-family: var(--font); border-radius: 14px; box-shadow: var(--card-shadow-hover); border: 1px solid var(--card-border); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus { background: var(--spanish-green); border-color: var(--spanish-green); }
.flatpickr-day:hover, .flatpickr-day:focus { background: #daefe0; border-color: #daefe0; }
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .asmf-panel, .field-wrap.is-invalid { animation: none; }
  .asmf-loading-spinner { animation-duration: 2s; }
}
