:root {
  --thw-blau: #003399;
  --thw-blau-hell: #0940B0;
  --thw-zusatzblau: #6680B3;
  --thw-gelb: #FFFF00;
  --thw-zusatzgelb: #EDD849;
  --thw-grau: #8B8885;
  --thw-grau-hell: #E8E3DD;
  --thw-grau-heller: #F7F0EA;
  --thw-schwarz: #202020;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
  color: var(--thw-schwarz);
  background: linear-gradient(180deg, #F7F0EA 0%, #ffffff 320px);
}

a { color: var(--thw-blau); }

/* Header im THW-Look: blauer Verlauf, Logo rechts, gelber Akzent */
.thw-header {
  background: linear-gradient(90deg, var(--thw-blau) 0%, var(--thw-blau-hell) 100%);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.thw-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thw-logo-gear {
  width: 44px;
  height: 44px;
  flex: none;
}

.thw-header h1 {
  font-size: 20px;
  font-weight: bold;
  margin: 0;
  letter-spacing: .2px;
}
.thw-header h1 small {
  display: block;
  font-size: 11px;
  font-weight: normal;
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.thw-meta-nav {
  font-size: 11px;
  text-transform: uppercase;
  opacity: .9;
}

/* Content */
.thw-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

.thw-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 14px;
}
.thw-heading::before {
  content: "";
  width: 9px;
  height: 20px;
  background: var(--thw-gelb);
  display: inline-block;
}
.thw-heading h2 {
  font-size: 20px;
  color: var(--thw-blau);
  margin: 0;
  font-weight: bold;
}

/* Suchleiste / Filterkarte */
.thw-search-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 8px;
}

.thw-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.thw-tab {
  border: none;
  background: var(--thw-grau-hell);
  color: var(--thw-schwarz);
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.thw-tab.active {
  background: var(--thw-blau);
  color: #fff;
}
.thw-tab:hover:not(.active) { background: #dcd6cd; }

.thw-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.thw-field label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--thw-grau);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.thw-field input[type=text],
.thw-field input[type=number],
.thw-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8d3cb;
  border-radius: 6px;
  font-size: 15px;
  background: #fff;
}
.thw-field input:focus, .thw-field select:focus {
  outline: 2px solid var(--thw-blau);
  outline-offset: 1px;
}

.thw-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.thw-btn {
  border: none;
  cursor: pointer;
  padding: 11px 20px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
}
.thw-btn-primary {
  background: var(--thw-blau);
  color: #fff;
}
.thw-btn-primary:hover { background: var(--thw-blau-hell); }
.thw-btn-secondary {
  background: var(--thw-grau-hell);
  color: var(--thw-schwarz);
}
.thw-btn-secondary:hover { background: #dcd6cd; }

.thw-result-count {
  margin: 14px 2px 4px;
  font-size: 13px;
  color: var(--thw-grau);
  font-weight: bold;
}

/* Karte */
#thw-map {
  height: 340px;
  border-radius: var(--radius);
  margin-top: 14px;
  box-shadow: var(--shadow);
}
.thw-map-hint {
  font-size: 12px;
  color: var(--thw-grau);
  margin-top: 6px;
}

/* Ergebnisliste als Karten */
.thw-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.thw-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  border-left: 5px solid var(--thw-blau);
  position: relative;
}

.thw-card .badge {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
  background: var(--thw-grau);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.thw-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--thw-blau);
}

.thw-card .addr {
  font-size: 13px;
  color: var(--thw-schwarz);
  line-height: 1.5;
  margin-bottom: 8px;
}

.thw-card .contact-line {
  font-size: 13px;
  margin: 2px 0;
}
.thw-card .distance {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  font-weight: bold;
  color: var(--thw-blau);
  background: var(--thw-grau-heller);
  padding: 3px 8px;
  border-radius: 999px;
}

.thw-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--thw-grau);
  font-size: 14px;
}

/* Baumstruktur */
.thw-tree {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  margin-top: 10px;
}
.thw-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 20px;
}
.thw-tree > ul { padding-left: 4px; }

.thw-tree li { position: relative; }

.thw-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.thw-node:hover { background: var(--thw-grau-heller); }

.thw-node .toggle {
  width: 16px;
  flex: none;
  text-align: center;
  font-size: 11px;
  color: var(--thw-grau);
  transition: transform .15s;
}
.thw-node.open .toggle { transform: rotate(90deg); }

.thw-node .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.thw-node .name { font-size: 14px; font-weight: bold; }
.thw-node .sub { font-size: 12px; color: var(--thw-grau); font-weight: normal; }

.thw-children { display: none; }
.thw-children.open { display: block; }

.thw-node-detail {
  font-size: 13px;
  color: var(--thw-schwarz);
  padding: 4px 8px 10px 34px;
  display: none;
}
.thw-node-detail.open { display: block; }

/* Footer */
.thw-footer {
  background: var(--thw-blau);
  color: #fff;
  padding: 26px 20px;
  margin-top: 40px;
  font-size: 13px;
}
.thw-footer .bar {
  width: 8px;
  height: 30px;
  background: var(--thw-gelb);
  display: inline-block;
  vertical-align: middle;
  margin-right: 12px;
}

/* Responsive: Tablet/iPad */
@media (max-width: 900px) {
  .thw-header h1 { font-size: 17px; }
  .thw-meta-nav { display: none; }
}

/* Responsive: Mobile */
@media (max-width: 600px) {
  .thw-container { padding: 14px 12px 40px; }
  .thw-header { padding: 12px 14px; }
  .thw-logo-gear { width: 34px; height: 34px; }
  .thw-heading h2 { font-size: 17px; }
  .thw-tabs { gap: 6px; }
  .thw-tab { padding: 8px 12px; font-size: 12px; }
  .thw-actions { flex-direction: column; align-items: stretch; }
  #thw-map { height: 260px; }
  .thw-card-grid { grid-template-columns: 1fr; }
}

.thw-loading {
  text-align: center;
  padding: 30px;
  color: var(--thw-grau);
  font-size: 13px;
}

.thw-source-note {
  font-size: 11px;
  color: var(--thw-grau);
  margin-top: 10px;
  line-height: 1.5;
}
