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

/* ── Theme variables ── */
:root {
  --bg:         #0f1117;
  --bg-card:    #161b22;
  --bg-input:   #0d1117;
  --border:     #30363d;
  --border-sub: #21262d;
  --text:       #e1e4e8;
  --text-muted: #8b949e;
  --text-body:  #c9d1d9;
  --accent:     #58a6ff;
  --code-color: #79c0ff;
  --btn-green:  #238636;
  --btn-green-h:#2ea043;
}

html.light {
  --bg:         #f6f8fa;
  --bg-card:    #ffffff;
  --bg-input:   #f0f2f4;
  --border:     #d0d7de;
  --border-sub: #e1e4e8;
  --text:       #1f2328;
  --text-muted: #57606a;
  --text-body:  #24292f;
  --accent:     #0969da;
  --code-color: #0550ae;
  --btn-green:  #2da44e;
  --btn-green-h:#2c974b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* ── Theme toggle button ── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  transition: background 0.15s;
  z-index: 100;
}

.theme-toggle:hover {
  background: var(--bg-input);
}

/* ── Layout ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Nav link ── */
.nav-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 8px;
  transition: background 0.15s;
}

.nav-link:hover {
  background: var(--bg-card);
}

/* ── Search ── */
.search-section {
  margin-bottom: 32px;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

#streetNumber {
  max-width: 80px;
}

.search-bar input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-bar select {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.search-bar button {
  padding: 10px 24px;
  background: var(--btn-green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}

.search-bar button:hover {
  background: var(--btn-green-h);
}

/* ── Results ── */
.results-section {
  margin-bottom: 32px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 12px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.result-header h3 {
  color: var(--accent);
  font-size: 1.1rem;
}

.confidence-badge {
  background: #238636;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.confidence-badge.medium {
  background: #d29922;
}

.confidence-badge.low {
  background: #da3633;
}

.result-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-description {
  color: var(--text-body);
  font-size: 0.9rem;
  line-height: 1.5;
}

.matched-fields {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.field-tag {
  background: var(--bg-input);
  color: var(--code-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ── Info cards ── */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.info-card h3 {
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 1rem;
}

.info-card pre {
  background: var(--bg-input);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-body);
  border: 1px solid var(--border);
  max-height: 400px;
}

.info-card table {
  width: 100%;
  border-collapse: collapse;
}

.info-card th,
.info-card td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-sub);
  font-size: 0.85rem;
}

.info-card th {
  color: var(--text-muted);
  font-weight: 600;
}

.info-card td code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--code-color);
}

.info-card ol {
  padding-left: 20px;
}

.info-card li {
  margin-bottom: 10px;
  line-height: 1.6;
  font-size: 0.9rem;
  color: var(--text-body);
}

.info-card li code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--code-color);
}

.status-msg {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .container {
    padding: 24px 14px;
  }

  header {
    margin-bottom: 28px;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .theme-toggle {
    top: 10px;
    right: 12px;
    padding: 5px 10px;
    font-size: 1rem;
  }

  /* Address input takes full row */
  #searchInput {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Nr. field grows to fill remaining space beside button */
  #streetNumber {
    flex: 1 1 auto;
    max-width: none;
  }

  /* Button stays at natural width */
  #searchBtn {
    flex: 0 0 auto;
  }

  .result-card {
    padding: 14px;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .result-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .no-results {
    padding: 28px 16px;
  }
}
