/* ==========================================================================
   Bedarfs-Check der Expertenportale (pages/portal-bedarf.php, bedarf.js)
   Nutzt die Theme-Variablen (--portal, --portal-text, --portal-soft, --blue, --red-text …).
   Ohne JavaScript: alle Schritte untereinander. Mit JS: .is-stepped → ein Schritt sichtbar.
   ========================================================================== */

.bedarf [hidden], .bedarf .is-off { display: none !important; }
.bedarf { gap: 1.25rem; }
.bedarf__context { margin: 0; }
.bedarf__context .pill { border-color: var(--portal); color: var(--portal-text); }

/* Fortschritt */
.bedarf__progress { display: grid; gap: .5rem; }
.bedarf__progress-text { margin: 0; font-weight: 700; font-size: .95rem; color: var(--portal-text); }
.bedarf__bar { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--border); }
.bedarf__bar span { display: block; height: 100%; width: 0; background: var(--portal); border-radius: inherit; transition: width .35s ease; }

/* Fehlerübersicht je Schritt */
.bedarf__errors { background: #FDECEC; color: #8F0C12; border-left: 4px solid var(--red-text); border-radius: var(--radius-sm); padding: .9rem 1rem; font-weight: 600; }
.bedarf__errors p { margin: 0 0 .35rem; }
.bedarf__errors ul { margin: 0; padding-left: 1.2rem; font-weight: 400; }
.bedarf__errors a { color: inherit; text-decoration: underline; }

/* Schritte */
.bedarf__step { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 1.25rem; }
.bedarf:not(.is-stepped) .bedarf__step + .bedarf__step { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.bedarf__legend { padding: 0; margin: 0 0 .25rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.25; color: var(--blue); }
.bedarf__legend:focus { outline: none; }
.bedarf__legend:focus-visible { outline: var(--focus); outline-offset: 4px; }
.bedarf__count { display: block; font-family: var(--font-body); font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--portal-text); margin-bottom: .2rem; }
.bedarf.is-stepped .bedarf__count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.bedarf__intro { margin: -.5rem 0 0; color: var(--text-soft); font-size: .95rem; }
.bedarf__grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

/* Fragen */
.bq { border: 0; margin: 0; padding: 0; min-width: 0; }
.bq--choice { display: grid; gap: .6rem; }
.bq__q { padding: 0; margin: 0 0 .1rem; font-weight: 700; font-size: 1.02rem; color: var(--text); line-height: 1.35; }
.bq__help { margin: 0; font-size: .88rem; color: var(--text-soft); }
.bq--focus > .bq__q::after, .bq--focus > label::after { content: "passt zu Ihrem Thema"; display: inline-block; margin-left: .5rem; padding: .1rem .5rem; border-radius: 999px; background: var(--portal-soft); color: var(--portal-text); font-size: .72rem; font-weight: 700; vertical-align: middle; }
.bq .field__error { margin-top: .1rem; }

/* Antwortkacheln (radio/checkbox) */
.bq__opts { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
.bq__tile { position: relative; display: flex; gap: .75rem; align-items: flex-start; min-height: 56px; padding: .9rem 1rem; background: #fff; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: .97rem; line-height: 1.35; color: var(--text); transition: border-color .15s, background-color .15s, box-shadow .15s; }
.bq__tile:hover { border-color: var(--portal); }
.bq__tile input { flex-shrink: 0; width: 22px; height: 22px; min-height: 0; margin: .05rem 0 0; accent-color: var(--portal-text); cursor: pointer; }
.bq__tile-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; flex: 1; min-width: 0; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.bq__tile-desc { font-weight: 400; font-size: .88rem; color: var(--text-soft); }
.bq__tile:focus-within { outline: var(--focus); outline-offset: 2px; }
.bq__tile.is-checked, .bq__tile:has(input:checked) { border-color: var(--portal-text); background: var(--portal-soft); box-shadow: inset 0 0 0 1px var(--portal-text); }
.bq__tile--talk { border-style: dashed; font-weight: 400; color: var(--text-soft); }
.bq__tile--talk.is-checked, .bq__tile--talk:has(input:checked) { color: var(--text); }
.bq[aria-invalid="true"] .bq__tile, .bq.is-invalid .bq__tile { border-color: var(--red-text); }

/* Schieberegler / Zahl */
.bq__range { display: flex; align-items: center; gap: 1rem; }
.bq__range input[type="range"] { flex: 1; min-height: 44px; padding: 0; border: 0; background: none; accent-color: var(--portal-text); }
.bq__out { min-width: 5.5rem; text-align: right; font-weight: 700; color: var(--portal-text); }
.bq__num { display: flex; align-items: center; gap: .6rem; }
.bq__num input { max-width: 12rem; }
.bq__unit { color: var(--text-soft); font-weight: 600; }

/* Navigation */
.bedarf__nav { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; margin-top: .25rem; }
.bedarf__nav .bedarf__next, .bedarf__nav .bedarf__submit { margin-left: auto; }
.bedarf:not(.is-stepped) .bedarf__step:not(.bedarf__step--contact) .bedarf__nav { display: none; }
.bedarf:not(.is-stepped) .bedarf__submit { width: 100%; }
.bedarf.is-done .bedarf__step, .bedarf.is-done .bedarf__progress, .bedarf.is-done .form__note { display: none !important; }

/* Dunkle Variante (eingebettet im blauen Beratungsbereich) */
.bedarf--dark .bedarf__legend, .bedarf--dark .bq__q { color: #fff; }
.bedarf--dark .bedarf__count, .bedarf--dark .bedarf__progress-text { color: var(--on-dark-soft); }
.bedarf--dark .bedarf__intro, .bedarf--dark .bq__help, .bedarf--dark .bq__tile-desc, .bedarf--dark .bq__unit { color: var(--on-dark-mute); }
.bedarf--dark .bedarf__bar { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); }
.bedarf--dark .bedarf__bar span { background: #fff; }
.bedarf--dark .bedarf__context .pill { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .4); color: #fff; }
.bedarf--dark:not(.is-stepped) .bedarf__step + .bedarf__step { border-top-color: rgba(255, 255, 255, .2); }
.bedarf--dark .bq__tile { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .35); color: #fff; }
.bedarf--dark .bq__tile:hover { border-color: #fff; }
.bedarf--dark .bq__tile input { accent-color: var(--red); }
.bedarf--dark .bq__tile:focus-within { outline-color: #fff; box-shadow: 0 0 0 5px var(--red); }
.bedarf--dark .bq__tile.is-checked, .bedarf--dark .bq__tile:has(input:checked) { background: rgba(255, 255, 255, .16); border-color: #fff; box-shadow: inset 0 0 0 1px #fff; }
.bedarf--dark .bq__tile--talk { color: var(--on-dark-mute); }
.bedarf--dark .bq__tile--talk.is-checked, .bedarf--dark .bq__tile--talk:has(input:checked) { color: #fff; }
.bedarf--dark .bq.is-invalid .bq__tile { border-color: var(--red-light); }
.bedarf--dark .bq__out { color: #fff; }
.bedarf--dark .bq--focus > .bq__q::after, .bedarf--dark .bq--focus > label::after { background: rgba(255, 255, 255, .15); color: #fff; }
.bedarf--dark .btn--outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.bedarf--dark .btn--outline:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .1); }
.bedarf--dark .bedarf__errors { background: #FDECEC; }

/* Einbettung im Beratungsbereich: Formular breiter */
.contact--bedarf > :last-child { flex: 1.6 1 32rem; }
.contact--bedarf > :first-child { flex: 1 1 20rem; }
.portal-beratung__alt { margin-top: 1.5rem; font-size: .92rem; }
.portal-beratung__alt a { color: #fff; font-weight: 700; text-decoration: underline; }

/* Eigene Seite /bedarfscheck */
.bedarf-page__grid { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
.bedarf-page .form { box-shadow: var(--shadow); border: 1px solid var(--border); }
.bedarf-page .form::before { background: var(--portal); }
.bedarf-page__next { list-style: none; counter-reset: bn; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.bedarf-page__next li { counter-increment: bn; display: grid; grid-template-columns: 2rem 1fr; column-gap: .75rem; color: var(--on-dark-soft); font-size: .92rem; }
.bedarf-page__next li::before { content: counter(bn); grid-row: span 2; width: 2rem; height: 2rem; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700; display: grid; place-items: center; }
.bedarf-page__next strong { color: #fff; }
@media (max-width: 980px) { .bedarf-page__grid { grid-template-columns: 1fr; } }

/* Teaser-Link „In 2 Minuten Bedarf prüfen“ (Startseite, Produktseite) */
.bedarf-teaser { display: flex; align-items: center; gap: 1rem; margin-top: 1.25rem; max-width: 34rem; padding: .9rem 1.1rem; background: #fff; border: 2px solid var(--portal); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s; }
.bedarf-teaser:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--text); text-decoration: none; border-color: var(--portal-text); }
.bedarf-teaser__badge { flex-shrink: 0; display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--portal-soft); color: var(--portal-text); font-weight: 800; font-size: .85rem; line-height: 1.1; text-align: center; }
.bedarf-teaser__text { display: grid; gap: .15rem; flex: 1; }
.bedarf-teaser__text strong { color: var(--blue); font-size: 1.05rem; }
.bedarf-teaser__text span { color: var(--text-soft); font-size: .9rem; }
.bedarf-teaser .icon { flex-shrink: 0; color: var(--portal-text); transition: transform .2s; }
.bedarf-teaser:hover .icon { transform: translateX(3px); }
.bedarf-cta-box { margin-top: .6rem; }

/* Produktauswahl „Für welche Versicherung?“ (Links, ohne JavaScript bedienbar) */
.bedarf-choice { gap: 1rem; }
.bedarf-choice__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.bedarf-choice__tile { display: flex; align-items: center; gap: .8rem; min-height: 64px; height: 100%; padding: .9rem 1rem; background: #fff; border: 2px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, background-color .15s, transform .15s; }
.bedarf-choice__tile:hover { border-color: var(--portal-text); background: var(--portal-soft); color: var(--text); text-decoration: none; }
.bedarf-choice__tile:focus-visible { outline: var(--focus); outline-offset: 2px; }
.bedarf-choice__icon { flex-shrink: 0; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--portal-soft); color: var(--portal-text); }
.bedarf-choice__text { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; flex: 1; min-width: 0; }
.bedarf-choice__text strong { color: var(--blue); font-size: 1rem; line-height: 1.3; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.bedarf-choice__text span { color: var(--text-soft); font-size: .86rem; line-height: 1.35; }
.bedarf-choice__tile > .icon { flex-shrink: 0; color: var(--portal-text); }
.bedarf-choice__tile--more { border-style: dashed; }
.bedarf-choice--dark .bedarf-choice__tile { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .35); color: #fff; }
.bedarf-choice--dark .bedarf-choice__tile:hover { background: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }
.bedarf-choice--dark .bedarf-choice__tile:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--red); }
.bedarf-choice--dark .bedarf-choice__icon { background: rgba(255, 255, 255, .14); color: #fff; }
.bedarf-choice--dark .bedarf-choice__text strong { color: #fff; }
.bedarf-choice--dark .bedarf-choice__text span { color: var(--on-dark-mute); }
.bedarf-choice--dark .bedarf-choice__tile > .icon { color: #fff; }
.bedarf__switch { margin: -.25rem 0 0; font-size: .92rem; }
.bedarf__switch a { font-weight: 700; text-decoration: underline; }
.bedarf--dark .bedarf__switch a { color: #fff; }
@media (max-width: 560px) { .bedarf-choice__list { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .bedarf-choice__tile { transition: none; } }

/* Sensible Fragen (Gesundheitsangaben, Art. 9 DSGVO) und ausdrückliche Einwilligung */
.bq__sensitive { display: inline-block; margin-left: .5rem; padding: .1rem .55rem; border: 1px solid var(--border-strong); border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--text-soft); vertical-align: middle; white-space: nowrap; }
.bq--sensitive { padding-left: .9rem; border-left: 3px solid var(--border-strong); }
.bedarf__consent { background: var(--bg-soft); border-left: 4px solid var(--portal); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.bedarf__consent label { font-size: .9rem; }
.bedarf--dark .bq__sensitive { border-color: rgba(255, 255, 255, .5); color: var(--on-dark-mute); }
.bedarf--dark .bq--sensitive { border-left-color: rgba(255, 255, 255, .45); }
.bedarf--dark .bedarf__consent { background: rgba(255, 255, 255, .07); border-left-color: #fff; }
.bedarf--dark .bedarf__consent a { color: #fff; }

/* Mobil: Kacheln einspaltig */
@media (max-width: 560px) {
  .bq__opts { grid-template-columns: 1fr; }
  .bedarf__nav { flex-direction: column-reverse; align-items: stretch; }
  .bedarf__nav .btn { width: 100%; margin-left: 0; }
  .bedarf-teaser { gap: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bedarf__bar span, .bq__tile, .bedarf-teaser, .bedarf-teaser .icon { transition: none; }
  .bedarf-teaser:hover, .bedarf-teaser:hover .icon { transform: none; }
}
html.a11y-no-motion .bedarf-teaser:hover, html.a11y-no-motion .bedarf-teaser:hover .icon { transform: none; }

/* Unterlagen-Upload (Feldtyp „file“) */
.bq--file .bq__q { margin: 0 0 .35rem; font-weight: 700; }
.bq--file .bq__file-consent { margin: .75rem 0; }
.bq__file-pick { display: block; margin: .25rem 0 .4rem; font-weight: 600; }
.bq--file input[type="file"] { display: block; width: 100%; max-width: 32rem; padding: .7rem; border: 1px dashed currentColor; border-radius: 10px; background: transparent; font: inherit; }
.bq--file input[type="file"]:disabled { opacity: .55; cursor: not-allowed; }
.bq__file-status { margin: .5rem 0 0; font-size: .92rem; }
.bq__file-status.is-error { color: #D4121B; font-weight: 600; }
.bedarf--dark .bq__file-status.is-error { color: #FFB4B4; }
