/* ==========================================================================
   AC Schumacher — Anfrage-Assistent
   Nur auf anfrage.html geladen. Baut auf den Tokens aus style.css auf.
   ========================================================================== */

/* --- Intro (dunkelgruener Kopfbereich) ----------------------------------- */
.af-intro {
  background: linear-gradient(160deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-light);
  padding: calc(var(--header-height) + var(--space-2xl)) 0 var(--space-4xl);
  position: relative;
  overflow: hidden;
}

.af-intro::after {
  /* Dezenter Lichtschein oben rechts, damit die Flaeche nicht flach wirkt */
  content: '';
  position: absolute;
  top: -180px;
  right: -120px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(249, 168, 37, 0.18) 0%, transparent 68%);
  pointer-events: none;
}

/* Gleiche Geometrie wie .af-card, damit Intro-Text und Formular fluchten */
.af-intro__inner {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 768px) {
  .af-intro__inner {
    padding: 0 var(--space-2xl);
  }
}

.af-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(249, 168, 37, 0.16);
  border: 1px solid rgba(249, 168, 37, 0.45);
  color: var(--color-accent-light);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

.af-intro__title {
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

.af-intro__title-accent {
  color: var(--color-accent);
}

.af-intro__text {
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
  max-width: 62ch;
}

.af-intro__points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
  margin-top: var(--space-xl);
}

.af-intro__point {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.af-intro__point svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--color-accent);
}

/* --- Karte --------------------------------------------------------------- */
.af-wrap {
  background: var(--color-subtle);
  padding-bottom: var(--space-4xl);
}

.af-card {
  position: relative;
  z-index: 2;
  background: var(--color-light);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: 0 18px 48px rgba(13, 59, 18, 0.10);
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  margin-top: calc(var(--space-3xl) * -1);
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .af-card {
    padding: var(--space-2xl) var(--space-2xl) var(--space-2xl);
  }
}

/* --- Fortschritt --------------------------------------------------------- */
.af-progress {
  margin-bottom: var(--space-xl);
}

.af-progress__steps {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: var(--space-md);
}

.af-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.af-progress__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-subtle);
  border: 2px solid var(--color-border);
  color: var(--color-text-light);
  font-size: 0.85rem;
  font-weight: 700;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.af-progress__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.af-progress__step.is-active .af-progress__num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-light);
}

.af-progress__step.is-active .af-progress__label {
  color: var(--color-primary);
}

.af-progress__step.is-done .af-progress__num {
  background: rgba(27, 94, 32, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.af-progress__track {
  height: 5px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.af-progress__fill {
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  transition: width var(--transition-slow);
}

@media (max-width: 480px) {
  .af-progress__label {
    display: none;
  }
}

/* --- Schritte ------------------------------------------------------------ */
.af-form {
  border: none;
}

.af-step {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-2xl);
}

/* Nur mit aktivem JavaScript werden Schritte einzeln gezeigt.
   Ohne JS bleibt das Formular als eine lange, absendbare Seite stehen. */
.js-an .af-step {
  display: none;
}

.js-an .af-step.is-current {
  display: block;
  animation: af-einblenden 220ms ease;
}

@keyframes af-einblenden {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .js-an .af-step.is-current { animation: none; }
  .af-progress__fill { transition: none; }
}

.af-step__legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: var(--space-xl);
}

.af-step__count {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  margin-bottom: 6px;
}

.af-step__title {
  display: block;
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--color-dark);
  line-height: 1.2;
}

.af-step__hint {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* --- Felder -------------------------------------------------------------- */
.af-field {
  margin-bottom: var(--space-xl);
  border-radius: var(--border-radius);
  transition: box-shadow var(--transition);
}

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

.af-field--fehler {
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.14);
}

.af-label {
  display: block;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 8px;
  line-height: 1.35;
}

.af-label__optional {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.af-help {
  font-size: 0.9rem;
  color: var(--color-text-light);
  line-height: 1.55;
  margin-bottom: var(--space-md);
  max-width: 62ch;
}

.af-hint-list {
  background: var(--color-subtle);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--color-text);
}

.af-hint-list strong {
  color: var(--color-dark);
}

/* --- Auswahl-Kacheln ----------------------------------------------------- */
.af-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 520px) {
  .af-options--2,
  .af-options--3,
  .af-options--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .af-options--3 { grid-template-columns: repeat(3, 1fr); }
  .af-options--4 { grid-template-columns: repeat(4, 1fr); }
}

.af-option {
  display: block;
  position: relative;
  cursor: pointer;
}

.af-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.af-option__box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
  height: 100%;
  padding: 14px 44px 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-light);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.af-option__box::after {
  /* Auswahl-Kreis rechts, wird bei Auswahl zum Haekchen */
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-light);
  transition: border-color var(--transition), background var(--transition);
}

.af-option--check .af-option__box::after {
  border-radius: 6px;
}

.af-option__text {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.af-option__sub {
  font-size: 0.82rem;
  color: var(--color-text-light);
  line-height: 1.3;
}

.af-option:hover .af-option__box {
  border-color: var(--color-primary-light);
  background: rgba(27, 94, 32, 0.03);
}

.af-option input:checked + .af-option__box {
  border-color: var(--color-primary);
  background: rgba(27, 94, 32, 0.07);
}

.af-option input:checked + .af-option__box .af-option__text {
  color: var(--color-primary-dark);
}

.af-option input:checked + .af-option__box::after {
  border-color: var(--color-primary);
  background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat;
}

.af-option input:focus-visible + .af-option__box {
  outline: 3px solid rgba(27, 94, 32, 0.35);
  outline-offset: 2px;
}

/* --- Eingabefelder ------------------------------------------------------- */
.af-input {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-light);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.af-input::placeholder {
  color: #9a9a9a;
}

.af-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.13);
}

.af-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.55;
}

.af-input-unit {
  position: relative;
  max-width: 260px;
}

.af-input-unit .af-input {
  padding-right: 56px;
}

.af-input-unit__suffix {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-light);
  pointer-events: none;
}

/* Pfeilchen bei Zahlenfeldern ausblenden, sie stoeren auf dem Handy */
.af-input[type='number']::-webkit-outer-spin-button,
.af-input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.af-input[type='number'] {
  -moz-appearance: textfield;
}

.af-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.af-grid .af-field {
  margin-bottom: 0;
}

@media (min-width: 600px) {
  .af-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .af-field--plz { grid-column: span 1; }
}

/* --- Fotos --------------------------------------------------------------- */
.af-fotoliste {
  counter-reset: foto;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
  display: grid;
  gap: 10px;
}

.af-fotoliste li {
  position: relative;
  padding-left: 34px;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--color-text-light);
}

.af-fotoliste li::before {
  counter-increment: foto;
  content: counter(foto);
  position: absolute;
  left: 0;
  top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-light);
  font-size: 0.76rem;
  font-weight: 700;
}

.af-fotoliste strong {
  color: var(--color-dark);
  font-weight: 700;
}

.af-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.af-upload {
  position: relative;
}

.af-upload__flaeche {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 150px;
  padding: var(--space-lg) var(--space-md);
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-subtle);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
}

.af-upload__flaeche:hover {
  border-color: var(--color-primary);
  background: rgba(27, 94, 32, 0.05);
}

.af-upload__input:focus-visible + .af-upload__flaeche {
  outline: 3px solid rgba(27, 94, 32, 0.35);
  outline-offset: 2px;
}

.af-upload__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: rgba(27, 94, 32, 0.10);
  color: var(--color-primary);
}

.af-upload__icon svg { width: 24px; height: 24px; }

.af-upload__titel {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.af-upload__sub {
  font-size: 0.86rem;
  color: var(--color-text-light);
}

.af-upload__status {
  margin-top: var(--space-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-light);
}

.af-upload__status.is-laedt {
  color: var(--color-primary);
}

/* Vorschau der ausgewaehlten Bilder */
.af-vorschau {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0 0;
}

.af-vorschau:empty { display: none; }

.af-vorschau__karte {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 2px solid var(--color-border);
  background: var(--color-subtle);
}

.af-vorschau__karte img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.af-vorschau__weg {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: rgba(26, 26, 26, 0.72);
  color: var(--color-light);
  transition: background var(--transition);
}

.af-vorschau__weg:hover {
  background: var(--color-red);
}

.af-vorschau__weg svg { width: 15px; height: 15px; }

.af-vorschau__name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 7px 5px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.68), transparent);
  color: var(--color-light);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
}

/* --- Einwilligung -------------------------------------------------------- */
.af-consent {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-subtle);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.af-consent:hover {
  border-color: var(--color-primary-light);
}

.af-consent input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.af-consent__box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-light);
  transition: background var(--transition), border-color var(--transition);
}

.af-consent__box svg {
  width: 15px;
  height: 15px;
  color: var(--color-light);
  opacity: 0;
  transition: opacity var(--transition);
}

.af-consent input:checked + .af-consent__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.af-consent input:checked + .af-consent__box svg {
  opacity: 1;
}

.af-consent input:focus-visible + .af-consent__box {
  outline: 3px solid rgba(27, 94, 32, 0.35);
  outline-offset: 2px;
}

.af-consent__text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--color-text);
}

.af-consent__text a {
  color: var(--color-primary);
  text-decoration: underline;
  font-weight: 600;
}

/* --- Honeypot (fuer Menschen unsichtbar) --------------------------------- */
.af-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Fehler und Navigation ----------------------------------------------- */
.af-error[hidden],
.af-nav .btn[hidden] {
  display: none;
}

.af-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  margin-bottom: var(--space-md);
  border-radius: var(--border-radius);
  background: rgba(198, 40, 40, 0.08);
  border: 1px solid rgba(198, 40, 40, 0.28);
  color: #9b1c1c;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.45;
}

.af-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.af-nav .btn {
  flex: 1 1 auto;
  min-width: 140px;
  min-height: 52px;
}

.af-nav__next,
.af-nav__send {
  flex: 2 1 200px;
}

.af-nav .btn.is-laedt {
  opacity: 0.7;
  cursor: progress;
}

.af-nav__phone {
  margin-top: var(--space-md);
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.af-nav__phone a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: underline;
}

/* Ohne JavaScript: Weiter/Zurueck ergeben keinen Sinn, Absenden muss sichtbar sein */
html:not(.js-an) .af-nav__next,
html:not(.js-an) .af-nav__back {
  display: none;
}

html:not(.js-an) .af-nav__send[hidden] {
  display: inline-flex;
}

html:not(.js-an) .af-progress {
  display: none;
}

/* --- Abschluss ----------------------------------------------------------- */
.af-done {
  text-align: center;
  padding: var(--space-lg) 0;
}

.af-done__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto var(--space-lg);
  border-radius: 50%;
  background: rgba(27, 94, 32, 0.10);
  color: var(--color-primary);
}

.af-done__icon svg {
  width: 34px;
  height: 34px;
}

.af-done__title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-dark);
  margin-bottom: var(--space-md);
  outline: none;
}

.af-done__text {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--color-text-light);
  max-width: 54ch;
  margin: 0 auto var(--space-xl);
}

.af-done__aktion {
  text-align: left;
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  border-radius: var(--border-radius-lg);
  background: linear-gradient(150deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-light);
}

.af-done__aktion-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  margin-bottom: var(--space-md);
  border-radius: 999px;
  background: rgba(249, 168, 37, 0.18);
  border: 1px solid rgba(249, 168, 37, 0.45);
  color: var(--color-accent-light);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.af-done__aktion-text {
  font-size: 0.98rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: var(--space-lg);
}

.af-done__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.af-done__actions .btn {
  min-height: 52px;
}

/* --- Fallback-Seite von anfrage-senden.php ------------------------------- */
.af-fallback {
  max-width: 620px;
  margin: 0 auto;
  padding: var(--space-4xl) var(--space-md);
  text-align: center;
}

.af-fallback h1 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  color: var(--color-dark);
  margin-bottom: var(--space-md);
}

.af-fallback p {
  margin-bottom: var(--space-lg);
  line-height: 1.6;
  color: var(--color-text-light);
}

.af-fallback__phone a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: underline;
}
