/* immoexpertenrat.de — an die Markenfarben von Rheinland.immo angelehnt */

:root {
  --navy: #0a2342;
  --blue: #1a4480;
  --blue-light: #e8f0fb;
  --gold: #c9971c;
  --text: #0f2035;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f7f9fc;
  --white: #ffffff;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  /* Verhindert, dass der Browser den Scroll-Offset automatisch "korrigiert",
     wenn die Nav beim Scrollen ihre Höhe ändert (sonst Flacker-Loop am Schwellenwert) */
  overflow-anchor: none;
}

h1, h2, h3 { font-family: 'Inter', -apple-system, sans-serif; font-weight: 600; color: var(--navy); margin: 0 0 .5em; }
a { color: var(--blue); }
p { margin: 0 0 1em; }

/* ---------- Scroll progress ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; width: 0%;
  height: 3px; background: var(--gold);
  z-index: 2000; pointer-events: none;
  transition: width .08s linear;
}

/* ---------- Nav ---------- */
#nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--white);
  box-shadow: 0 2px 20px rgba(10,35,66,.12);
  padding: 12px 0;
  transition: box-shadow .3s ease, padding .3s ease;
}
#nav.scrolled {
  padding: 10px 0;
  box-shadow: 0 2px 20px rgba(10,35,66,.18);
}
.nav-inner {
  /* Gleiche Breite wie .container (1200px), damit Logo/Nav mit dem Seiteninhalt
     darunter fluchten – genau wie auf rheinland.immo. Passt die Nav bei mehr
     Menüpunkten (z.B. Admin) nicht mehr in eine Zeile, übernimmt das JS in
     footer.php automatisch die Umschaltung auf das Hamburger-Menü. */
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 16px;
}
.nav-logo {
  display: flex; align-items: center;
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-img { height: 80px; width: auto; display: block; transition: height .3s ease; }
#nav.scrolled .nav-logo-img { height: 52px; }
.nav-menu { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
.nav-menu > * { flex-shrink: 0; }
.nav-menu a { text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text); padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
.nav-menu a:hover { background: var(--blue-light); color: var(--blue); }
.nav-user { font-size: 14px; color: var(--text-muted); padding: 8px 4px; text-decoration: none; white-space: nowrap; }
.nav-user:hover { color: var(--blue); }
.btn-nav, .btn-nav-outline {
  padding: 9px 18px; border-radius: 6px; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn-nav { background: var(--blue); color: var(--white) !important; }
.btn-nav:hover { background: var(--navy); }
.btn-nav-outline { border: 2px solid var(--blue); color: var(--blue) !important; }
.btn-nav-outline:hover { background: var(--blue-light); }

/* Hamburger (nur unterhalb des Breakpoints sichtbar) */
.hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  padding: 8px; margin-left: auto;
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  position: relative; z-index: 1001;
}
.hamburger span { display: block; width: 24px; height: 2px; background: var(--navy); border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Der Umschaltpunkt ist nicht an eine feste Fensterbreite gekoppelt, sondern wird
   per JS (footer.php) live gemessen: erst wenn die Menüpunkte tatsächlich nicht mehr
   in eine Zeile passen, bekommt #nav die Klasse „nav-collapsed" – das ist nötig, weil
   die Nav je nach Login-Status/Rolle sehr unterschiedlich lang ist (anonym vs. Admin). */
#nav.nav-collapsed .nav-menu {
  display: none;
  position: fixed; inset: 0;
  background: var(--white);
  flex-direction: column; align-items: stretch;
  gap: 2px; padding: 96px 24px 40px;
  overflow-y: auto; z-index: 999;
}
#nav.nav-collapsed .nav-menu.open { display: flex; }
#nav.nav-collapsed .nav-menu a, #nav.nav-collapsed .nav-menu .nav-user { width: 100%; padding: 14px 10px; font-size: 16px; border-bottom: 1px solid var(--border); border-radius: 0; }
#nav.nav-collapsed .nav-menu .btn-nav, #nav.nav-collapsed .nav-menu .btn-nav-outline { width: 100%; text-align: center; margin-top: 10px; border-bottom: none; }
#nav.nav-collapsed .hamburger { display: flex; }
#nav.nav-collapsed .nav-logo-img, #nav.nav-collapsed.scrolled .nav-logo-img { height: 52px; }

/* Sicherheitsnetz für sehr schmale Bildschirme, falls JS noch nicht gegriffen hat */
@media (max-width: 480px) {
  .nav-menu:not(.open) { display: none; }
  .hamburger { display: flex; }
}

/* ---------- Layout helpers ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

.hero {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  padding: 64px 24px;
  text-align: center;
}
.hero h1 { color: var(--white); font-size: 38px; }
.hero p { color: #cdddf5; font-size: 18px; max-width: 640px; margin: 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 12px 26px; border-radius: 8px;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; border: none;
}
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #b3860f; }
.btn-secondary { background: var(--white); color: var(--blue); border: 2px solid var(--blue); }
.btn-secondary:hover { background: var(--blue-light); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- Suche & Kategorien ---------- */
.search-form { display: flex; gap: 10px; margin-top: 8px; }
.search-form input[type=text] {
  flex: 1; padding: 13px 16px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 15px; background: var(--white); color: var(--text);
}
.search-form input[type=text]:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.search-form .btn { flex-shrink: 0; padding: 12px 24px; }

.category-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 20px 0 8px; }
.category-pills a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--white); color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 500; transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.category-pills a:hover { border-color: var(--blue); color: var(--blue); }
.category-pills a.active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.category-pills a .count { font-size: 12px; opacity: .7; }
.category-pills-link {
  display: inline-block; margin-bottom: 10px;
  padding: 5px 14px; border-radius: 20px; background: var(--blue-light);
  color: var(--blue); text-decoration: none; font-size: 13px; font-weight: 600;
}
.category-pills-link:hover { background: var(--blue); color: var(--white); }

/* ---------- A-Z index ---------- */
.az-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 40px; }
.az-jump a {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 1px solid var(--border); border-radius: 6px;
  text-decoration: none; font-weight: 600; font-size: 13px; color: var(--blue);
}
.az-jump a.disabled { color: var(--text-muted); opacity: .35; pointer-events: none; }
.az-section { margin-bottom: 36px; scroll-margin-top: 90px; }
.az-letter {
  font-family: 'Inter', -apple-system, sans-serif; font-weight: 600; font-size: 28px; color: var(--gold);
  border-bottom: 2px solid var(--border); padding-bottom: 6px; margin-bottom: 12px;
}
.az-list { list-style: none; margin: 0; padding: 0; }
.az-list li {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 10px;
}
.az-list a { text-decoration: none; font-weight: 600; color: var(--navy); font-size: 17px; }
.az-list a:hover { color: var(--blue); }
.az-list .teaser { color: var(--text-muted); font-size: 14px; margin: 6px 0 0; }
.az-list .meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Article ---------- */
.article-header { padding: 48px 24px 0; }
.article-header .meta { color: var(--text-muted); font-size: 14px; }
.article-body { padding: 24px 0 48px; font-size: 17px; }
.article-body h2 { font-size: 24px; margin-top: 1.4em; scroll-margin-top: 130px; }
.article-body h3 { font-size: 19px; margin-top: 1.2em; scroll-margin-top: 130px; }
.article-body p { margin-bottom: 1.2em; }
.article-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px auto 24px; display: block; }
.article-body img.img-size-klein { max-width: min(320px, 100%); }
.article-body img.img-size-mittel { max-width: min(560px, 100%); }

/* Zweispaltiges Layout für eingeloggte Ansicht: Artikel + Sidebar (TOC, verwandte Artikel) */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
  padding-bottom: 40px;
}
.article-sidebar { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 20px; }
.sidebar-box { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.sidebar-box h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--navy); margin-bottom: 14px; }
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block; padding: 7px 10px; border-radius: 6px; text-decoration: none;
  font-size: 14px; color: var(--text-muted); border-left: 2px solid transparent;
}
.toc-list a.toc-level-3 { padding-left: 22px; font-size: 13px; }
.toc-list a:hover { color: var(--blue); background: var(--blue-light); }
.related-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.related-list a { font-size: 14px; font-weight: 500; color: var(--navy); text-decoration: none; line-height: 1.4; }
.related-list a:hover { color: var(--blue); }
.sidebar-more { font-size: 13px; font-weight: 600; color: var(--blue); text-decoration: none; }
.sidebar-more:hover { text-decoration: underline; }

/* FAQ-Akkordeon (native <details>/<summary>, kein JS nötig) */
.faq-section { margin: 40px 0; }
.faq-entry {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; margin-bottom: 10px; background: var(--white);
}
.faq-entry summary {
  font-weight: 600; color: var(--navy); cursor: pointer; list-style: none; position: relative; padding-right: 28px;
}
.faq-entry summary::-webkit-details-marker { display: none; }
.faq-entry summary::after {
  content: '+'; position: absolute; right: 0; top: 0; font-size: 20px; color: var(--blue); font-weight: 400;
}
.faq-entry[open] summary::after { content: '\2212'; }
.faq-entry .faq-answer { margin-top: 12px; color: var(--text-muted); line-height: 1.6; }

@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
}

.gate-box {
  background: var(--white); border: 2px dashed var(--gold); border-radius: 12px;
  padding: 32px; text-align: center; margin: 32px 0;
}
.gate-box h3 { margin-top: 0; }

.homepage-cta {
  background: var(--blue-light); border-radius: 12px; padding: 28px; text-align: center; margin: 40px 0;
}
.homepage-cta h3 { margin-top: 0; }

.author-box {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-top: 40px;
  text-decoration: none; color: inherit; transition: box-shadow .2s ease;
}
.author-box:hover { box-shadow: 0 4px 16px rgba(10,35,66,.1); }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--blue);
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
}

/* ---------- Forms ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 32px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-group .hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 15px; background: var(--white); color: var(--text);
}
textarea { min-height: 260px; resize: vertical; font-family: 'Inter', sans-serif; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
input:disabled, textarea:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.radio-row { display: flex; gap: 20px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.radio-row input { width: auto; }

.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c1; }
.alert-success { background: #eaf6ec; color: #1e7a34; border: 1px solid #bfe4c6; }

table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: var(--blue-light); color: var(--navy); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-admin { background: #f4e4c1; color: #7a5a0a; }
.badge-experte { background: var(--blue-light); color: var(--blue); }
.badge-user { background: #e4e4e4; color: #555; }
.badge-ja { background: #eaf6ec; color: #1e7a34; }
.badge-nein { background: #f1f1f1; color: #666; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

/* ---------- Team / Experten ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.team-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(10,35,66,.08);
  text-align: center;
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
}
.team-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(10,35,66,.14); }
.team-avatar {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 32px; font-weight: 600;
  color: var(--white);
  position: relative; overflow: hidden;
}
.team-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.team-avatar-initials { position: relative; z-index: 1; }
.team-body { padding: 20px 18px 24px; flex: 1; display: flex; flex-direction: column; }
.team-name { font-family: 'Inter', -apple-system, sans-serif; font-size: 18px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.team-role { font-size: 12px; color: var(--blue); font-weight: 600; margin-bottom: 8px; }
.team-qual { font-size: 13px; color: var(--text-muted); line-height: 1.6; flex: 1; }
.team-divider { height: 1px; background: var(--border); margin: 14px 0; }
.team-meta { font-size: 12px; color: var(--text-muted); font-weight: 600; }

@media (max-width: 1000px) { .team-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .team-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { margin-top: 60px; background: var(--navy); color: rgba(255,255,255,.7); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 56px 24px 40px;
}
.footer-brand { text-align: center; }
.footer-brand img { width: 75%; max-width: 220px; height: auto; margin: 0 auto 16px; }
.footer-brand p { font-size: 13px; line-height: 1.7; color: rgba(255,255,255,.6); max-width: 320px; margin-left: auto; margin-right: auto; }
.footer-social { display: flex; gap: 10px; margin-top: 20px; justify-content: center; }
.footer-social a {
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.footer-social a:hover { background: var(--blue); color: var(--white); border-color: var(--blue); }
.footer-col h4 {
  font-size: 13px; font-weight: 600; color: var(--white);
  letter-spacing: .4px; text-transform: uppercase; margin-bottom: 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col ul a { font-size: 14px; color: rgba(255,255,255,.65); text-decoration: none; }
.footer-col ul a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 18px 24px; }
.footer-bottom p { margin: 0; font-size: 12px; color: rgba(255,255,255,.5); text-align: center; }

@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; text-align: left; } .footer-brand p { max-width: none; } }

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .nav-menu { width: 100%; justify-content: flex-start; }
}
