/* ─────────────────────────────────────────────────────────────────────────────
   Mietrechner 1 – Scoped Styles
   Alle Regeln unter #mietrechner1-app für hohe Spezifität gegen Divi/Theme.
   h1 und p bleiben NICHT gescoopt → Website-Theme darf sie überschreiben.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── CSS-Variablen ─────────────────────────────────────────────────────── */

#mietrechner1-app {
  --bg: #dddddd;
  --card: #ffffff;
  --text: #1e2532;
  --muted: #555;
  --accent: #000;
  --border: #ddd;
  --shadow: 0 16px 40px rgba(30, 37, 50, 0.08);
}

/* ── Element-Reset (neutralisiert Divi/Theme-Overrides) ────────────────── */

#mietrechner1-app *,
#mietrechner1-app *::before,
#mietrechner1-app *::after {
  box-sizing: border-box;
}

#mietrechner1-app h2,
#mietrechner1-app h3,
#mietrechner1-app label,
#mietrechner1-app span,
#mietrechner1-app strong,
#mietrechner1-app small,
#mietrechner1-app div,
#mietrechner1-app section,
#mietrechner1-app form {
  font-family: inherit;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}

#mietrechner1-app input[type="text"] {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: normal;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

#mietrechner1-app button {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.5;
}

/* ── App-Container ─────────────────────────────────────────────────────── */

#mietrechner1-app {
  font-family: 'The-SansB2-Bold', "Inter", Helvetica, Arial, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  color: var(--text);
  width: min(100%, 1140px);
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background-color: #fff !important;
  position: relative;
}

/* ── Header ────────────────────────────────────────────────────────────── */

#mietrechner1-app .app__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#mietrechner1-app .lang-switch {
  position: absolute;
  right: 20px;
  top: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

#mietrechner1-app .lang-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

#mietrechner1-app .lang-link.is-active { color: var(--text); }
#mietrechner1-app .lang-link:hover { color: var(--text); }
#mietrechner1-app .lang-sep { color: var(--muted); }

/* ── Layout ────────────────────────────────────────────────────────────── */

#mietrechner1-app .stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#mietrechner1-app .card {
  background: var(--card);
  border-radius: 18px;
  padding: clamp(16px, 3vw, 24px);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

#mietrechner1-app .card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--text);
}

#mietrechner1-app .card h2 .info-icon { margin-left: 2px; }

#mietrechner1-app .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

/* ── Felder ─────────────────────────────────────────────────────────────── */

#mietrechner1-app .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

#mietrechner1-app .field span {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  align-items: center;
  gap: 6px;
}

#mietrechner1-app .field input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fdfdff;
  transition: border-color 0.2s ease;
  height: auto;
}

#mietrechner1-app .field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 91, 255, 0.15);
}

#mietrechner1-app .field .unit {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Zusammenfassungen ─────────────────────────────────────────────────── */

#mietrechner1-app .summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e0e8ff;
  display: block;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #eef1f6;
}

#mietrechner1-app .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

#mietrechner1-app .summary .label {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  align-items: center;
  gap: 6px;
}

#mietrechner1-app .summary strong {
  font-size: 1.05rem;
}

/* ── Ergebnis ──────────────────────────────────────────────────────────── */

#mietrechner1-app .results { border: 1px solid #ddd; margin-bottom: 5rem; }

#mietrechner1-app .results-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

#mietrechner1-app .results-grid .summary { background: #c8e17d; }

/* ── Hypotheken-Aktionen ───────────────────────────────────────────────── */

#mietrechner1-app .hidden { display: none !important; }

#mietrechner1-app .mortgage-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#mietrechner1-app .mortgage-btn--remove {
  color: #b33;
  border-color: #dcc;
}

#mietrechner1-app .mortgage-btn--remove:hover {
  background: #fdf0f0;
  color: #900;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

#mietrechner1-app .action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1rem;
  margin-bottom: 0px;
  flex-wrap: wrap;
  flex-direction: row-reverse;
}

#mietrechner1-app .action-bar .action-btn {
  margin-top: 20px;
  float: right;
}

#mietrechner1-app .action-btn {
  padding: 10px 20px;
  font-size: 14px;
  border: 1px solid #d9d9d9;
  background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
  cursor: pointer;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

#mietrechner1-app .action-btn:hover { background: #eee; }

#mietrechner1-app #pdfBtn {
  background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
  border-color: #d9d9d9;
}
#mietrechner1-app #pdfBtn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e6e6e6 100%);
}

/* ── Logo ──────────────────────────────────────────────────────────────── */

#mietrechner1-app .logo { max-width: 160px; }
#mietrechner1-app .logofr { max-width: 270px; }
#mietrechner1-app .branding { margin-bottom: 2rem; }

/* ── Info-Icons ────────────────────────────────────────────────────────── */

#mietrechner1-app .info-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-height: 0;
}
#mietrechner1-app .info-icon:hover { color: var(--text); border-color: var(--accent); }
#mietrechner1-app .info-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Info-Modal ────────────────────────────────────────────────────────── */

.info-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.info-modal.is-open { display: flex; }

.info-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.info-modal__dialog {
  position: relative;
  width: min(92vw, 420px);
  background: #fff;
  color: #1e2532;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 16px 40px rgba(30, 37, 50, 0.08);
  z-index: 1;
  font-family: 'The-SansB2-Bold', "Inter", Helvetica, Arial, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.info-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #555;
}
.info-modal__close:hover { color: #1e2532; }

/* ── Laufende Kosten ───────────────────────────────────────────────────── */

#mietrechner1-app .running-costs-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: end;
}

#mietrechner1-app .running-costs-row .field { min-width: 0; }

#mietrechner1-app .running-costs-result {
  padding: 12px;
  background: #f7f8fb;
  border-radius: 12px;
  border: 1px solid #eef1f6;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 140px;
  height: 46px;
  color: var(--text);
  font-weight: 600;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  #mietrechner1-app { padding: 20px 14px 32px; }
  #mietrechner1-app .summary { flex-direction: column; align-items: flex-start; }
}
