/*
 * kk-contact-form — bewusst zurückhaltend.
 *
 * Das Formular soll auf jeder Kundenseite so aussehen, als hätte es immer dazugehört.
 * Deshalb: keine eigenen Farben außer für Fehler und Erfolg, Schrift und Buttons erben
 * vom Theme. Gestylt wird nur, was das Theme nicht mitbringt — Zustände, Abstände,
 * Touch-Targets und Fokus.
 */

.kk-form__field {
  margin-bottom: 1.25rem;
}

.kk-form__field label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 600;
  line-height: 1.4;
}

.kk-form__field input[type="text"],
.kk-form__field input[type="email"],
.kk-form__field input[type="tel"],
.kk-form__field textarea,
.kk-form__field select,
.kk-form__field input[type="file"] {
  width: 100%;
  /* 44 px Mindesthöhe — auf dem Handy bedienbar, ohne zu zielen. */
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  border: 1px solid #c3c8ce;
  border-radius: 0.5rem;
  background: #fff;
  font: inherit;
  color: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.kk-form__field textarea {
  min-height: 8rem;
  resize: vertical;
}

.kk-form__field input:focus-visible,
.kk-form__field textarea:focus-visible,
.kk-form__field select:focus-visible,
.kk-form__submit:focus-visible {
  /* Sichtbarer Fokus ist Pflicht — nie wegstylen. */
  outline: 3px solid #2b6cb0;
  outline-offset: 2px;
  border-color: #2b6cb0;
}

/* Fehlerzustand: nicht nur rot, sondern auch mit Text daneben —
   Farbe allein reicht für Farbfehlsichtige nicht. */
.kk-form__field.has-error input,
.kk-form__field.has-error textarea,
.kk-form__field.has-error select {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.kk-form__error {
  margin: 0.375rem 0 0;
  color: #a5281b;
  font-size: 0.875rem;
  line-height: 1.4;
}

.kk-form__hint {
  margin: 0.375rem 0 0;
  color: #5a6470;
  font-size: 0.875rem;
  line-height: 1.4;
}

.kk-form__req {
  color: #c0392b;
  margin-left: 0.125rem;
}

.kk-form__notice {
  margin-bottom: 1.5rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  line-height: 1.5;
}

.kk-form__notice--ok {
  background: #eaf6ec;
  border-color: #b7dfc1;
  color: #1e5b2c;
}

.kk-form__notice--error {
  background: #fdecea;
  border-color: #f3c2bc;
  color: #a5281b;
}

/* Einwilligungs-Checkbox: Kästchen und Text nebeneinander, gemeinsam klickbar. */
.kk-form__field--check label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.625rem;
  align-items: start;
  font-weight: 400;
  cursor: pointer;
}

.kk-form__field--check input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.kk-form__submit {
  min-height: 44px;
  padding: 0.75rem 1.75rem;
  border: 0;
  border-radius: 0.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
}

.kk-form__submit:hover {
  opacity: 0.9;
}

.kk-form__submit[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Absende-Zustand. Der Spinner ist die Zugabe — die Aussage tragen der
   geänderte Beschriftungstext und aria-busy, beides auch ohne Bild verständlich. */
.kk-form__submit[aria-busy="true"]::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  vertical-align: -0.125em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: kk-form-spin 700ms linear infinite;
}

@keyframes kk-form-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kk-form__submit[aria-busy="true"]::before {
    animation: none;
  }
}

/* Manche Themes (u.a. Divi) setzen display-Regeln, die das hidden-Attribut
   überstimmen — das JS blendet Hinweise darüber aus. */
.kk-form [hidden] {
  display: none !important;
}

/* Honeypot: für Menschen unsichtbar, für Bots ein normales Feld.
   Kein display:none — manche Bots überspringen bewusst versteckte Felder. */
.kk-form__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Fällt das Theme aus, ist der Text für Screenreader trotzdem da. */
.kk-form .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
