/* Endlich Tiny House — gemeinsames Stylesheet */

:root {
  --sage: #7a8a5e;
  --sage-dark: #64744a;
  --accent: #c67139;
  --accent-dark: #a85c2b;
  --neutral: #82796a;
  --bg: #faf9f5;
  --card: #ffffff;
  --ink: #2e2a24;
  --ink-soft: #5c564c;
  --border: #e6e1d6;
  --danger: #b34a3e;
  --ok: #4c7a4c;
  --radius: 14px;
  --shadow: 0 2px 6px rgba(46, 42, 36, 0.06), 0 10px 28px rgba(46, 42, 36, 0.08);
  --max-width: 1180px;
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--sage-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { color: var(--ink-soft); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; width: 100%; }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 500;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  flex: none;
}
.brand:hover { text-decoration: none; }
.brand .logo-mark {
  height: 48px;
  width: auto;
  display: block;
}
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 8px;
}
.main-nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.main-nav a.active { color: var(--sage-dark); background: rgba(122,138,94,0.12); }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav {
    position: absolute;
    top: 62px; left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px 14px;
    display: none;
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: #efece2;
  border-top: 1px solid var(--border);
  padding: 28px 0 20px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.footer-disclaimer {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--ink);
}
.footer-links {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 10px;
}
.footer-links a { color: var(--ink-soft); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--sage); color: #fff; box-shadow: 0 1px 2px rgba(100,116,74,0.25); }
.btn-primary:hover { background: var(--sage-dark); box-shadow: 0 4px 12px rgba(100,116,74,0.32); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(168,92,43,0.25); }
.btn-accent:hover { background: var(--accent-dark); box-shadow: 0 4px 12px rgba(168,92,43,0.32); transform: translateY(-1px); }
.btn-secondary { background: var(--card); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(143,58,48,0.25); }
.btn-danger:hover { background: #8f3a30; box-shadow: 0 4px 12px rgba(143,58,48,0.32); transform: translateY(-1px); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; color: var(--ink);
}
.field .hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; }
.field .error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=number], input[type=search],
input[type=password], textarea, select {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(122,138,94,0.18);
}
textarea { resize: vertical; min-height: 110px; }
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-pill {
  border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px;
  cursor: pointer; font-weight: 600; font-size: 0.88rem; background: #fff;
}
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill.checked { background: var(--sage); border-color: var(--sage); color: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Cards / badges ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge-sage { background: rgba(122,138,94,0.16); color: var(--sage-dark); }
.badge-accent { background: rgba(198,113,57,0.16); color: var(--accent-dark); }
.badge-neutral { background: rgba(130,121,106,0.18); color: var(--neutral); }
.badge-warn { background: #fff2d9; color: #916715; }
.badge-info { background: rgba(92,122,156,0.16); color: #3f5a78; }
.badge-village { background: rgba(184,92,122,0.16); color: #8a3f57; }
.badge-airbnb-village { background: rgba(124,92,184,0.16); color: #5c3f8a; }
.badge-pending { background: #fff2d9; color: #916715; }
.badge-approved { background: #e1f0e1; color: var(--ok); }
.badge-rejected { background: #f6dfdc; color: var(--danger); }

/* ---------- Page header block ---------- */
.page-hero {
  padding: 34px 0 22px;
}
.page-hero h1 { margin-bottom: 6px; }
.page-hero p { max-width: 62ch; }

/* ---------- Seitenfoto (Ratgeber-Artikel, Inserat-Formular, Admin-Login) ---------- */
/* Die Quellfotos sind hochformatig (380x510) - Breite bewusst begrenzt statt
   auf volle Containerbreite gestreckt, damit object-fit:cover nicht nur einen
   schmalen Streifen des Originalbilds zeigt. */
.page-photo {
  display: block;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 22px;
}
.page-photo.short { max-width: 320px; aspect-ratio: 16 / 10; margin: 0 auto 18px; }

/* ---------- Utility ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--sage); color: #fff;
  padding: 10px 16px; z-index: 2000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 0.9rem; z-index: 3000; box-shadow: var(--shadow); max-width: 92vw;
}
.toast.error { background: var(--danger); }

.flag { margin-right: 4px; }

/* ---------- Range-Slider (z. B. Finanzierungsrechner) ---------- */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  outline: none;
  background: var(--border);
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--sage);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px var(--sage), 0 2px 6px rgba(46,42,36,0.25);
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--sage);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px var(--sage), 0 2px 6px rgba(46,42,36,0.25);
  cursor: pointer;
}
input[type=range]:focus-visible { outline: 2px solid var(--sage-dark); outline-offset: 3px; }

/* ---------- Ratgeber / Prose ---------- */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 32px; margin-bottom: 10px; }
.prose h3 { margin-top: 22px; margin-bottom: 8px; }
.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { margin: 0 0 14px 22px; color: var(--ink-soft); }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--ink); }
.prose blockquote {
  border-left: 3px solid var(--sage);
  padding: 4px 16px;
  margin: 18px 0;
  color: var(--ink-soft);
  background: var(--bg);
  border-radius: 0 8px 8px 0;
}
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; font-size: 0.9rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.info-box {
  background: #fff2d9; border: 1px solid #f0dba8; border-radius: var(--radius);
  padding: 14px 16px; font-size: 0.88rem; margin: 18px 0;
}
.info-box.danger { background: #f6dfdc; border-color: #e3b6ac; color: var(--danger); }
.template-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem; line-height: 1.6; margin: 14px 0;
}
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 24px; }
.guide-card { display: block; }
.guide-card .emoji { font-size: 1.8rem; }
.guide-card h3 { margin: 10px 0 6px; }
.breadcrumb { font-size: 0.85rem; margin-bottom: 14px; }
.breadcrumb a { color: var(--ink-soft); }

/* ---------- Werbekennzeichnung (Partner-/Affiliate-Seiten) ---------- */
.ad-disclosure {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff2d9;
  color: #916715;
  border: 1px solid #f0d99a;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---------- Produkt-/Modell-Karten (z. B. Partnerangebote) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; margin-top: 24px; }
.product-card { display: flex; flex-direction: column; }
.product-card .product-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.product-card h3 { margin: 0 0 4px; }
.product-card .specs { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 10px; }
.product-card .desc { margin: 0 0 14px; flex: 1; }
.product-card .price { font-size: 1.2rem; font-weight: 700; color: var(--accent-dark); margin: 0 0 14px; }
.product-card .price .hint { display: block; font-size: 0.78rem; font-weight: 400; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Bildergalerie je Modell (extern eingebundene Fotos, mit Fehler-Platzhalter) ---------- */
.product-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 14px;
  padding-bottom: 4px;
}
.product-gallery::-webkit-scrollbar { height: 6px; }
.product-gallery::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.gallery-item {
  position: relative;
  flex: none;
  width: 150px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  scroll-snap-align: start;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item.img-error img { display: none; }
.gallery-item.img-error::after {
  content: "🏠 Bild nicht verfügbar";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--bg);
}

/* ---------- PWA-Installations-Hinweis (mobiler Banner + Anleitungs-Modal) ---------- */
.pwa-install-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  /* Höher als .filters-panel (z-index:3000, der mobile Vollbild-Filter-Screen auf der
     Kartenseite) - sonst wäre der Banner dort unsichtbar/nicht klickbar, sobald der
     Filter-Screen offen ist (Standardzustand beim ersten Laden auf Mobile). */
  z-index: 3600;
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 12px 12px 14px;
}
.pwa-install-banner-icon { font-size: 1.3rem; flex: none; }
.pwa-install-banner-text { flex: 1; font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.pwa-install-banner-cta {
  flex: none;
  background: var(--sage); color: #fff; border: none; border-radius: 999px;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.pwa-install-banner-cta:hover { background: var(--sage-dark); }
.pwa-install-banner-close {
  flex: none;
  background: none; border: none; color: var(--ink-soft); font-size: 0.9rem;
  cursor: pointer; padding: 4px;
}
/* Nur mobil relevant - auf Desktop/Laptop nicht anzeigen (der Use Case ist mobil,
   und die Bildschirmbreite dort macht einen am unteren Rand fixierten Banner ohnehin
   unpassend). Die JS-Seite filtert zusätzlich per User-Agent auf iOS/Android - diese
   Regel ist ein zweites, robustes Sicherheitsnetz rein auf Basis der Bildschirmbreite. */
@media (min-width: 901px) {
  .pwa-install-banner { display: none !important; }
}

.pwa-install-modal-overlay {
  position: fixed; inset: 0; background: rgba(30,26,20,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 3700; padding: 0;
}
@media (min-width: 700px) { .pwa-install-modal-overlay { align-items: center; padding: 24px; } }
.pwa-install-modal {
  background: #fff; width: 100%; max-width: 420px;
  border-radius: 16px 16px 0 0; padding: 22px;
  box-shadow: var(--shadow);
}
@media (min-width: 700px) { .pwa-install-modal { border-radius: 16px; } }
.pwa-install-modal-close { float: right; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ink-soft); line-height: 1; }
.pwa-install-modal h2 { margin-bottom: 8px; }
.pwa-install-modal-sub { font-size: 0.86rem; color: var(--ink-soft); margin-bottom: 18px; clear: both; }
.pwa-install-steps { display: flex; flex-direction: column; gap: 14px; list-style: none; counter-reset: pwa-step; }
.pwa-install-steps li { display: flex; align-items: center; gap: 12px; font-size: 0.92rem; counter-increment: pwa-step; }
.pwa-install-step-icon {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--sage-dark);
}
