/* =========================================================================
   Mein Zuhause Massivhaus – gemeinsames Kontakt-Popup (Modal)
   -------------------------------------------------------------------------
   Lebt nur EINMAL in shared/. Eingebunden auf jeder Seite per
     <link rel="stylesheet" href="[..]shared/contact-modal.css">
     <script src="[..]shared/contact-modal.js"></script>
   Öffnet sich automatisch bei Klick auf jeden Link mit href, der auf
   "#kontakt" endet, sowie auf jedes Element mit [data-contact-open].
   Namespace .mzc-* (eigenständig, keine Abhängigkeit vom Seiten-CSS).
   Optik aus dem Quiz-Lead-Formular abgeleitet (quiz/quiz.css).
   ========================================================================= */

.mzc {
  --mzc-navy: #183054;
  --mzc-navy-deep: #1e2f51;
  --mzc-text: #0f172a;
  --mzc-surface: #f5f7fa;
  --mzc-border: #d9dee7;
  --mzc-white: #ffffff;
  --mzc-muted: #64748b;
  --mzc-navy-tint: rgba(24, 48, 84, 0.055);
  --mzc-navy-ring: rgba(24, 48, 84, 0.18);
  --mzc-radius-lg: 24px;
  --mzc-radius-sm: 12px;
  --mzc-shadow-card: 0 40px 90px -32px rgba(15, 23, 42, 0.5);
  --mzc-shadow-soft: 0 10px 28px -16px rgba(15, 23, 42, 0.22);

  font-family: "Inter", "Manrope", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Scroll-Lock auf dem Body, solange das Modal offen ist ---- */
body.mzc-locked {
  overflow: hidden;
}

/* ---- Overlay / Backdrop ---- */
.mzc-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 15, 30, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
  overflow-y: auto;
}

/* Das [hidden]-Attribut muss display:flex schlagen, sonst bleibt das
   unsichtbare Overlay (opacity:0) als bildschirmfüllende Ebene aktiv und
   blockiert Scroll/Klicks der Seite. */
.mzc-overlay[hidden] {
  display: none;
}

.mzc-overlay.is-open {
  opacity: 1;
}

/* ---- Dialog-Card ---- */
.mzc-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  background: var(--mzc-white);
  color: var(--mzc-text);
  border-radius: var(--mzc-radius-lg);
  box-shadow: var(--mzc-shadow-card);
  padding: 34px 34px 30px;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

.mzc-overlay.is-open .mzc-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ---- Close-Button ---- */
.mzc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--mzc-surface);
  color: var(--mzc-muted);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.mzc-close:hover {
  background: #e9edf3;
  color: var(--mzc-text);
}

.mzc-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--mzc-navy-ring);
}

.mzc-close svg {
  width: 18px;
  height: 18px;
}

/* ---- Header / Intro ---- */
.mzc-head {
  margin-bottom: 22px;
  padding-right: 34px;
}

.mzc-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mzc-navy);
}

.mzc-title {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.mzc-subtitle {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--mzc-muted);
}

/* ---- Formular ---- */
.mzc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

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

.mzc-field--full {
  grid-column: 1 / -1;
}

.mzc-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mzc-text);
}

.mzc-field label .mzc-req {
  color: var(--mzc-navy);
}

.mzc-field input,
.mzc-field select,
.mzc-field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--mzc-text);
  background: var(--mzc-white);
  border: 1.5px solid var(--mzc-border);
  border-radius: var(--mzc-radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
}

.mzc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.mzc-field input::placeholder {
  color: #9aa6b8;
}

.mzc-field textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.55;
}
.mzc-field textarea::placeholder {
  color: #9aa6b8;
}

.mzc-field input:focus,
.mzc-field select:focus,
.mzc-field textarea:focus {
  outline: none;
  border-color: var(--mzc-navy);
  box-shadow: 0 0 0 4px var(--mzc-navy-ring);
}

.mzc-field input.is-invalid {
  border-color: #d4604f;
  box-shadow: 0 0 0 4px rgba(212, 96, 79, 0.14);
}

.mzc-error {
  font-size: 12.5px;
  color: #c0503f;
  min-height: 0;
}

/* ---- DSGVO Consent ---- */
.mzc-consent {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 2px;
  padding: 14px 16px;
  background: var(--mzc-surface);
  border: 1px solid var(--mzc-border);
  border-radius: var(--mzc-radius-sm);
}

.mzc-consent input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  border: 1.5px solid var(--mzc-border);
  border-radius: 6px;
  background: var(--mzc-white);
  cursor: pointer;
  position: relative;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.mzc-consent input[type="checkbox"]:checked {
  background: var(--mzc-navy);
  border-color: var(--mzc-navy);
}

.mzc-consent input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--mzc-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.mzc-consent input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--mzc-navy-ring);
}

.mzc-consent label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--mzc-muted);
  cursor: pointer;
}

.mzc-consent a {
  color: var(--mzc-navy);
  text-decoration: underline;
}

/* ---- Submit + Trust ---- */
.mzc-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.mzc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 14px 26px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--mzc-radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease,
    opacity 0.2s ease;
}

.mzc-btn svg {
  width: 18px;
  height: 18px;
}

.mzc-btn--primary {
  background: var(--mzc-navy);
  color: var(--mzc-white);
}

.mzc-btn--primary:hover {
  background: var(--mzc-navy-deep);
  transform: translateY(-1px);
  box-shadow: var(--mzc-shadow-soft);
}

.mzc-btn--primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--mzc-navy-ring);
}

.mzc-btn--primary:disabled {
  background: #c4ccd9;
  color: #eef1f6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Risiko-Entlastung direkt unter dem Senden-Button: nimmt dem Klick die
   Verbindlichkeit. Dezent, aber etwas präsenter als der reine Datenschutz-Hinweis. */
.mzc-reassure {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--mzc-navy);
  text-align: center;
}

.mzc-trust {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--mzc-muted);
}

.mzc-trust svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--mzc-navy);
}

/* ---- Success ---- */
.mzc-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 6px 6px;
}

.mzc-success__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--mzc-navy-tint);
  color: var(--mzc-navy);
  margin-bottom: 22px;
}

.mzc-success__icon svg {
  width: 36px;
  height: 36px;
}

.mzc-success h2 {
  margin: 0 0 10px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mzc-success p {
  margin: 0 0 26px;
  font-size: 15px;
  color: var(--mzc-muted);
  max-width: 42ch;
}

.mzc-success .mzc-btn {
  width: auto;
  padding: 13px 30px;
  text-decoration: none;
}

/* Entlastungs-Hinweis (kein Grundstück/Budget nötig) – etwas kleiner, ruhig */
.mzc-success__note {
  font-size: 13.5px !important;
  margin: 0 0 24px !important;
  max-width: 44ch;
}

/* Soft-CTAs in der Danke-View: nebeneinander, brechen auf Mobile um */
.mzc-success__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.mzc-btn--ghost {
  background: transparent;
  color: var(--mzc-navy);
  border-color: var(--mzc-navy-ring);
}

.mzc-btn--ghost:hover {
  background: var(--mzc-navy-tint);
  transform: translateY(-1px);
}

/* Dezenter Schließen-Link unter den Soft-CTAs */
.mzc-success__close {
  margin-top: 18px;
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--mzc-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.mzc-success__close:hover {
  color: var(--mzc-navy);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  /* Vollbild-Sheet auf dem Handy.
     align-items:flex-start ist der eigentliche Fix: ein zentriertes Flex-Item,
     das höher als der Viewport ist, schiebt seinen oberen Teil aus dem
     scrollbaren Bereich → Inhalt war oben abgeschnitten und nicht erreichbar.
     Oben ausrichten macht das gesamte Popup von oben nach unten scrollbar. */
  .mzc-overlay {
    padding: 0;
    align-items: flex-start;
  }

  .mzc-dialog {
    max-width: none;
    width: 100%;
    min-height: 100vh;   /* Fallback für ältere Browser */
    min-height: 100dvh;  /* dynamische Viewport-Höhe → Absenden-Button bleibt sichtbar, nicht unter der ein-/ausfahrenden Browserleiste */
    margin: 0;
    border-radius: 0;
    padding: 28px 22px 28px;
    /* Sauberes Slide-up ohne Scale → kein Backdrop-Spalt an den Kanten des Vollbild-Sheets */
    transform: translateY(14px);
  }

  .mzc-overlay.is-open .mzc-dialog {
    transform: translateY(0);
  }

  .mzc-form {
    grid-template-columns: 1fr;
  }

  .mzc-title {
    font-size: 22px;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .mzc-overlay,
  .mzc-dialog {
    transition: none;
  }
}
