/*
 * Martens Kaufvertrag-Formular – Styles
 * Farben/Fonts orientieren sich an den Astra-Globalfarben von martens-kanzlei.de.
 * Alle Selektoren sind mit .mkf- geprefixt, um Konflikte mit dem Theme zu vermeiden.
 */

.mkf-root {
  --mkf-primary: #2235DD;
  --mkf-primary-hover: #1a2bc6;
  --mkf-text: #131739;
  --mkf-text-soft: #4b4f6b;
  --mkf-bg-soft: #f0f1fd;
  --mkf-border: #E4E7FD;
  --mkf-border-strong: #c9cdf3;
  --mkf-error: #c62828;
  --mkf-error-bg: #fdeeee;
  --mkf-success: #1b7f3b;
  --mkf-success-bg: #eaf7ee;
  --mkf-radius: 4px;
  color: var(--mkf-text);
  font-family: inherit;
  line-height: 1.55;
  max-width: 860px;
}

.mkf-root *,
.mkf-root *::before,
.mkf-root *::after { box-sizing: border-box; }

.mkf-root [hidden] { display: none !important; }

.mkf-intro {
  font-size: 0.95em;
  color: var(--mkf-text-soft);
  margin: 0 0 1.5em;
}

/* --- Abschnitte ---------------------------------------------------- */

.mkf-section {
  border: 1px solid var(--mkf-border);
  border-radius: var(--mkf-radius);
  background: #fff;
  margin: 0 0 1.75em;
  overflow: hidden;
}

.mkf-section__title {
  margin: 0;
  padding: 0.85em 1.25em;
  background: var(--mkf-bg-soft);
  border-bottom: 1px solid var(--mkf-border);
  font-size: 1.15em;
  font-weight: 700;
  color: var(--mkf-text);
}

/* Abschnitt ohne Überschrift (z. B. Kontaktformular): keine Karte, Felder direkt auf der Seite */
.mkf-section--plain { border: 0; background: transparent; }
.mkf-section--plain .mkf-section__body { padding: 0; }

.mkf-section__intro { margin: 0; padding: 0.75em 1.25em 0; color: var(--mkf-text-soft); }

.mkf-section__body { padding: 1.25em; }

.mkf-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1em 1.25em;
}

@media (min-width: 640px) {
  .mkf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkf-field { grid-column: 1 / -1; }
  .mkf-field--half { grid-column: auto; }
  .mkf-group, .mkf-person { grid-column: 1 / -1; }
}

/* --- Gruppen & Personenblöcke ------------------------------------- */

.mkf-group--titled,
.mkf-person {
  border: 1px solid var(--mkf-border);
  border-left: 3px solid var(--mkf-primary);
  border-radius: var(--mkf-radius);
  padding: 1em 1.1em 1.1em;
  background: #fbfbfe;
}

.mkf-person { margin-top: 0.25em; }

.mkf-group__title,
.mkf-person__title {
  margin: 0 0 0.9em;
  font-size: 1em;
  font-weight: 700;
  color: var(--mkf-primary);
}

.mkf-group .mkf-hint { margin-top: -0.5em; margin-bottom: 0.9em; }

/* --- Felder -------------------------------------------------------- */

.mkf-field { margin: 0; min-width: 0; }

.mkf-label {
  display: block;
  font-weight: 600;
  font-size: 0.95em;
  margin: 0 0 0.35em;
  color: var(--mkf-text);
}

.mkf-req { color: var(--mkf-primary); }

.mkf-root input[type="text"],
.mkf-root input[type="email"],
.mkf-root input[type="tel"],
.mkf-root input[type="number"],
.mkf-root input[type="date"],
.mkf-root select,
.mkf-root textarea {
  width: 100%;
  margin: 0;
  padding: 0.6em 0.75em;
  font: inherit;
  font-size: 1em;
  line-height: 1.4;
  color: var(--mkf-text);
  background: #fff;
  border: 1px solid var(--mkf-border-strong);
  border-radius: var(--mkf-radius);
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mkf-root input[type="date"] { background: var(--mkf-bg-soft); }

.mkf-root select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25em;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23131739' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85em center;
}

.mkf-root textarea { resize: vertical; min-height: 4em; }

.mkf-root input:focus,
.mkf-root select:focus,
.mkf-root textarea:focus {
  outline: none;
  border-color: var(--mkf-primary);
  box-shadow: 0 0 0 3px rgba(34, 53, 221, 0.18);
}

.mkf-input-suffix { position: relative; }
.mkf-input-suffix input { padding-right: 2.5em; }
.mkf-suffix {
  position: absolute;
  right: 0.85em;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mkf-text-soft);
  pointer-events: none;
}

.mkf-hint {
  margin: 0.35em 0 0;
  font-size: 0.85em;
  color: var(--mkf-text-soft);
}

.mkf-error {
  margin: 0.35em 0 0;
  font-size: 0.85em;
  color: var(--mkf-error);
  font-weight: 600;
}

.mkf-field--invalid input,
.mkf-field--invalid select,
.mkf-field--invalid textarea,
.mkf-field--invalid .mkf-choice {
  border-color: var(--mkf-error) !important;
}

/* --- Radio / Checkbox als Pills ----------------------------------- */

.mkf-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.mkf-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin: 0;
  padding: 0.5em 0.9em;
  border: 1px solid var(--mkf-border-strong);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.95em;
  /* Auswahl-Pills sind Bedienelemente, keine markierbaren Textinhalte. */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}

.mkf-choice:hover { border-color: var(--mkf-primary); }

.mkf-choice input {
  margin: 0;
  width: 1em;
  height: 1em;
  accent-color: var(--mkf-primary);
  cursor: pointer;
}

.mkf-choice:has(input:checked) {
  background: var(--mkf-bg-soft);
  border-color: var(--mkf-primary);
  color: var(--mkf-primary);
  font-weight: 600;
}

/* Fokus-Ring nur bei Tastaturbedienung (Klasse wird per JS bei Tab gesetzt), nicht nach Mausklick */
.mkf-root input[type="radio"]:focus,
.mkf-root input[type="checkbox"]:focus { outline: none; box-shadow: none; }
.mkf-form--kb .mkf-choice:has(input:focus),
.mkf-form--kb .mkf-acceptance:has(input:focus) {
  box-shadow: 0 0 0 3px rgba(34, 53, 221, 0.25);
}

.mkf-acceptance {
  display: flex;
  align-items: flex-start;
  gap: 0.7em;
  margin: 0;
  font-weight: 400;
  font-size: 0.95em;
  cursor: pointer;
}

.mkf-acceptance input {
  margin: 0.25em 0 0;
  flex: 0 0 auto;
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--mkf-primary);
}

.mkf-acceptance a { color: var(--mkf-primary); text-decoration: underline; }

/* --- Honeypot ------------------------------------------------------ */

.mkf-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Meldungen ----------------------------------------------------- */

.mkf-message {
  padding: 0.85em 1.1em;
  border-radius: var(--mkf-radius);
  margin: 0 0 1.5em;
  font-weight: 600;
}

.mkf-message--error { background: var(--mkf-error-bg); color: var(--mkf-error); border: 1px solid #f3c2c2; }
.mkf-message--success { background: var(--mkf-success-bg); color: var(--mkf-success); border: 1px solid #bfe3ca; }

.mkf-success {
  padding: 1.5em;
  border: 1px solid #bfe3ca;
  background: var(--mkf-success-bg);
  border-radius: var(--mkf-radius);
}

.mkf-success h3 { margin: 0 0 0.5em; color: var(--mkf-success); }
.mkf-success p { margin: 0; }

/* --- Button (wie .ast-button des Themes) -------------------------- */

.mkf-actions { margin-top: 0.5em; }

.mkf-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.75em;
  font: inherit;
  font-size: 1em;
  font-weight: 500;
  color: #fff;
  background: var(--mkf-primary);
  border: 1px solid var(--mkf-primary);
  border-radius: var(--mkf-radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.mkf-submit:hover,
.mkf-submit:focus-visible { background: var(--mkf-primary-hover); border-color: var(--mkf-primary-hover); color: #fff; }

.mkf-submit:disabled { opacity: 0.7; cursor: wait; }

.mkf-spinner {
  display: none;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mkf-spin 0.8s linear infinite;
}

.mkf-form--busy .mkf-spinner { display: inline-block; }

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

/* --- Zusammenfassung (Vorschau) ----------------------------------- */

.mkf-summary {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25em;
  font-size: 0.95em;
}

.mkf-summary th,
.mkf-summary td {
  text-align: left;
  vertical-align: top;
  padding: 0.45em 0.6em;
  border-bottom: 1px solid var(--mkf-border);
}

.mkf-summary th { width: 40%; font-weight: 600; color: var(--mkf-text-soft); }
