@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #059669;
  --accent-light: #D1FAE5;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  flex-shrink: 0;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo img { height: 32px; width: auto; }

/* ===== Search Bar ===== */
.search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.search-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#search-input {
  flex: 1;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: var(--bg);
  color: var(--text);
}

#search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: white;
}

#search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search-btn {
  padding: 9px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
  font-family: inherit;
}

#search-btn:hover { background: var(--primary-dark); }

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  z-index: 2000;
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-list li {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s;
}

.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover, .autocomplete-list li.active { background: var(--primary-light); }

/* ===== Map ===== */
#map-container {
  position: relative;
  width: 100%;
  height: 60vh;
  min-height: 380px;
  max-height: 640px;
}

#map { width: 100%; height: 100%; }

.map-hint {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,58,95,.82);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  transition: opacity .4s;
}

.map-hint.hidden { opacity: 0; }

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.9);
  border-radius: var(--radius);
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  z-index: 600;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.map-loading.visible { display: flex; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ===== Results Section ===== */
#results-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  display: none;
}

#results-section.visible { display: block; }

.results-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.result-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.result-card h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-card h3 .card-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.card-alkis h3 .card-icon { background: var(--primary-light); color: var(--primary); }
.card-boris h3 .card-icon { background: var(--accent-light); color: var(--accent); }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.result-row:last-child { border-bottom: none; }
.result-label { color: var(--text-muted); font-size: 13px; }
.result-value { font-weight: 500; text-align: right; max-width: 60%; }

.brw-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0 4px;
}

.brw-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 10px;
  padding: 8px;
  background: #FEF9C3;
  border-radius: var(--radius-sm);
}

.not-found {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 16px 0;
}

/* ===== Error Toast ===== */
#error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  color: #DC2626;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 9999;
  transition: transform .3s ease;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-md);
}

#error-toast.visible { transform: translateX(-50%) translateY(0); }

/* ===== Ad Banner ===== */
.ad-section {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
}

.ad-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

/* ===== SEO Content ===== */
.seo-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 20px;
}

.seo-inner {
  max-width: 800px;
  margin: 0 auto;
}

.seo-inner h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  margin-top: 28px;
}

.seo-inner h2:first-child { margin-top: 0; }

.seo-inner p {
  font-size: 15px;
  color: #475569;
  line-height: 1.75;
  margin-bottom: 14px;
}

.seo-inner ul {
  margin: 12px 0 16px 20px;
  font-size: 15px;
  color: #475569;
  line-height: 1.75;
}

/* ===== Attribution ===== */
.attribution {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Footer ===== */
footer {
  background: #1E293B;
  color: #94A3B8;
  padding: 24px 20px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

.footer-links a {
  color: #94A3B8;
  text-decoration: none;
  font-size: 14px;
  transition: color .2s;
}

.footer-links a:hover { color: white; }
.footer-copy { font-size: 13px; }

/* ===== Mobile Ergebnis-Panel ===== */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .logo img { height: 26px; }
  #search-input { font-size: 13px; }
  #search-btn { display: none; }

  #map-container { height: 55vh; min-height: 300px; }

  .results-inner { grid-template-columns: 1fr; }

  #results-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
    padding: 0;
  }

  .results-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto 0;
  }

  .results-inner { padding: 16px; }

  .seo-section { padding: 28px 16px; }
  .seo-inner h2 { font-size: 18px; }
}

@media (max-width: 480px) {
  .search-wrap { max-width: none; }
}
