/*
 * Gestaltung der Umfrage-Seite.
 *
 * Farben, Typografie, Radien und Abstände stammen aus dem Design-Handoff
 * (surveys/kundenzufriedenheit/design_handoff_nps_feedback/README.md, Abschnitt
 * "Design Tokens"). Als Custom Properties, damit ein Kanal sie später
 * überschreiben kann, ohne dass hier etwas geändert werden muss.
 *
 * Zwei bewusste Abweichungen vom Prototyp, weil die Seite im iframe auf der
 * Bestellbestätigung läuft und nicht als eigene Seite:
 *   - kein Seitenhintergrund und keine min-height:100vh-Zentrierung
 *   - keine feste Höhe; die tatsächliche wird per postMessage gemeldet
 */

:root {
  --kc-blau: #004a93;
  --kc-blau-tief: #002f5f;
  --kc-border: #d8dee5;
  --kc-border-fehler: #c94b4b;
  --kc-text: #0b1727;
  --kc-text-2: #3d4a5a;
  --kc-text-3: #5b6b7c;
  --kc-text-4: #8a97a6;
  --kc-gruen: #1a7a4c;
  --kc-rot: #c94b4b;
  --kc-disabled: #c3cdd8;
  --kc-track: #e2e8f0;
  --kc-flaeche: #fff;

  --kc-radius: 6px;
  --kc-radius-gross: 8px;
  --kc-schatten: 0 2px 12px rgba(0, 30, 70, 0.08);
  --kc-gap: 22px;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

/*
 * Muss vor allen Layout-Regeln stehen und !important tragen.
 *
 * Das hidden-Attribut wirkt nur über das Standard-Stylesheet des Browsers. Jede
 * eigene display-Regel (etwa .block { display: flex }) hat höhere Spezifität und
 * würde es überschreiben -- ausgeblendete Fragen wären dann trotzdem sichtbar.
 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  /* Transparent: die einbettende Seite bestimmt den Hintergrund. */
  background: transparent;
  color: var(--kc-text);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Verhindert, dass Scrollen im iframe die Seite darunter mitzieht. */
body {
  overscroll-behavior: contain;
}

.page {
  display: flex;
  justify-content: center;
  padding: 4px;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--kc-flaeche);
  border: 1px solid var(--kc-border);
  border-radius: var(--kc-radius-gross);
  box-shadow: var(--kc-schatten);
  overflow: hidden;
}

.card__header {
  display: flex;
  justify-content: center;
  padding: 24px 28px 0;
}

.card__logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
}

.status {
  padding: 32px 28px;
  color: var(--kc-text-3);
  text-align: center;
}

/* --- Formular --- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--kc-gap);
  padding: 20px 28px 28px;
}

.intro {
  margin: 0;
  color: var(--kc-text-2);
  line-height: 1.55;
  text-align: center;
}

.questions {
  display: flex;
  flex-direction: column;
  gap: var(--kc-gap);
}

/* fieldset zurückgesetzt: der Browser-Rahmen passt nicht zur Gestaltung, die
   Semantik für Screenreader bleibt erhalten. */
.block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Erst nach dem ersten Absendeversuch gesetzt, nicht beim Tippen. */
.block--missing {
  margin-left: -12px;
  padding-left: 12px;
  border-left: 3px solid var(--kc-rot);
}

.block__label {
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--kc-text);
}

/* Bei einer Checkbox steht die Frage im Label selbst; die legend würde sie
   doppeln, deshalb nur für Screenreader. */
.block--check .block__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.block__label abbr {
  margin-left: 4px;
  color: var(--kc-blau);
  text-decoration: none;
}

.block__help {
  margin: -6px 0 0;
  font-size: 11px;
  color: var(--kc-text-4);
  line-height: 1.5;
}

/* --- NPS als Schieberegler --- */

.nps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nps__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  /* Der Regler-Griff ist mit 26px deutlich höher als die 6px-Spur und steht
     zentriert 10px über sie hinaus. Ohne diesen Abstand ragt er in die Frage
     darüber und überdeckt sie. */
  margin: 10px 0 0;
  border-radius: 3px;
  outline: none;
  background: linear-gradient(
    to right,
    var(--kc-blau) 0%,
    var(--kc-blau) var(--fill, 0%),
    var(--kc-track) var(--fill, 0%),
    var(--kc-track) 100%
  );
}

.nps__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--kc-blau);
  box-shadow: 0 1px 4px rgba(0, 30, 70, 0.3);
  cursor: pointer;
}

.nps__range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--kc-blau);
  box-shadow: 0 1px 4px rgba(0, 30, 70, 0.3);
  cursor: pointer;
}

.nps__ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--kc-text-4);
}

.nps__badge {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--kc-radius-gross);
  background: var(--kc-blau);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

/* Solange nichts gewählt ist, kein gefüllter Badge -- sonst sähe der
   Ausgangszustand nach einer bereits getroffenen Wahl aus. */
.nps__badge[data-empty] {
  background: var(--kc-track);
  color: var(--kc-text-4);
}

/* --- Stufen (NPS als Buttons, Rating) --- */

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

.steps__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.steps__step {
  /* Mindestens 40px: kleiner ist auf Touchscreens nicht zuverlässig treffbar. */
  flex: 1 1 auto;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--kc-border);
  border-radius: var(--kc-radius);
  background: var(--kc-flaeche);
  color: var(--kc-text);
  font: inherit;
  cursor: pointer;
  transition: background 120ms ease-in-out;
}

.steps__step:hover {
  border-color: var(--kc-blau);
}

.steps__step[aria-checked='true'] {
  border-color: var(--kc-blau);
  background: var(--kc-blau);
  color: #fff;
}

.steps__star {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--kc-disabled);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.steps__star[aria-checked='true'],
.steps__star[data-on] {
  color: #e8a020;
}

.steps__ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--kc-text-4);
}

/* --- Auswahl --- */

.choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--kc-border);
  border-radius: var(--kc-radius);
  background: var(--kc-flaeche);
  color: var(--kc-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease-in-out;
}

.choice__option:hover:not(:disabled) {
  border-color: var(--kc-blau);
}

.choice__option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.choice__option[aria-checked='true'] {
  border-color: var(--kc-blau);
}

.choice__box {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid var(--kc-border);
  border-radius: 4px;
}

.choice__box--round {
  border-radius: 50%;
}

.choice__option[aria-checked='true'] .choice__box {
  border-color: var(--kc-blau);
  background: var(--kc-blau);
  /* Haken bzw. Punkt als Innenschatten -- kein zusätzliches Markup nötig. */
  box-shadow: inset 0 0 0 3px var(--kc-flaeche);
}

.choice__extra {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.choice__extra-label {
  font-size: 11px;
  color: var(--kc-text-4);
}

/* --- Freitext --- */

.text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.text__area,
.text__line,
.choice__extra input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--kc-border);
  border-radius: var(--kc-radius);
  background: var(--kc-flaeche);
  color: var(--kc-text);
  font: inherit;
  line-height: 1.5;
}

.text__area {
  resize: vertical;
}

.text__area::placeholder,
.text__line::placeholder {
  color: #9aa5b1;
}

/* Roter Rahmen nur bei begonnener, aber noch zu kurzer Eingabe -- ein leeres
   Feld ist noch kein Fehler. */
.text__area[data-invalid],
.text__line[data-invalid] {
  border-color: var(--kc-border-fehler);
}

.text__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
}

.text__counter {
  color: var(--kc-text-4);
}

.text__counter[data-state='kurz'] {
  color: var(--kc-rot);
}

.text__counter[data-state='ok'] {
  color: var(--kc-gruen);
}

.text__hint {
  color: var(--kc-text-4);
}

/* --- Checkbox --- */

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--kc-blau);
}

/* --- Absenden --- */

.submit {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: var(--kc-radius);
  background: var(--kc-blau);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease-in-out;
}

.submit:hover:not(:disabled) {
  background: var(--kc-blau-tief);
}

.submit:disabled {
  background: var(--kc-disabled);
  cursor: not-allowed;
}

.form__error {
  margin: 0;
  color: var(--kc-rot);
}

.privacy {
  margin: 0;
  font-size: 11px;
  text-align: center;
}

.privacy a {
  color: var(--kc-text-4);
}

.privacy a:hover {
  color: var(--kc-blau-tief);
}

/* --- Danke-Ansicht --- */

.thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 28px 44px;
  text-align: center;
}

.thanks__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--kc-blau);
}

.thanks__title {
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--kc-text);
}

.thanks__text {
  max-width: 320px;
  margin: 0;
  color: var(--kc-text-3);
  line-height: 1.6;
}

/* Sichtbarer Fokus für Tastaturbedienung: die Standardringe verschwinden durch
   die eigenen Hintergründe sonst. */
:focus-visible {
  outline: 2px solid var(--kc-blau);
  outline-offset: 2px;
}
