html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* WindAtlas */
html {
  font-size: 15px;
}

.filter-help summary {
  color: var(--bs-link-color);
  cursor: pointer;
}
.filter-help dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  max-width: 70rem;
}
.filter-help dd {
  margin-bottom: 0.25rem;
}
@media (max-width: 767.98px) {
  .filter-help dl { grid-template-columns: 1fr; }
}

.filter .form-label {
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
  color: var(--bs-secondary-color);
}

/* Anlagenliste kompakt, damit alle Spalten ohne Querscrollen passen */
table.units {
  font-size: 0.875rem;
}

/* Schmale Fenster: Tabelle scrollt seitlich. Ab 1280 px passt sie ins Fenster; ohne eigenen
   Scrollrahmen bleiben die Spaltenköpfe beim Herunterscrollen am oberen Fensterrand stehen. */
.units-wrap {
  overflow-x: auto;
}

@media (min-width: 1280px) {
  .units-wrap {
    overflow-x: visible;
  }

  /* Ganzer Kopf (Überschriften + Autofilter-Zeile) bleibt stehen. */
  table.units thead {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  table.units thead th {
    background-color: var(--bs-body-bg);
  }

  table.units thead tr:last-child th {
    box-shadow: inset 0 -2px 0 var(--bs-border-color);
  }
}

/* Autofilter-Zeile: schmale Felder, die sich der Spaltenbreite anpassen */
table.units tr.autofilter th {
  padding-top: 0;
  font-weight: normal;
}

table.units tr.autofilter input {
  width: 100%;
  min-width: 3rem;
  font-size: 0.8rem;
  padding: 0.1rem 0.35rem;
}

table.units tr.autofilter input:not(:placeholder-shown) {
  border-color: var(--bs-primary);
  background-color: var(--bs-primary-bg-subtle);
}

/* Während die gefilterte Liste lädt */
.units-wrap.loading tbody {
  opacity: 0.5;
  transition: opacity 0.2s 0.15s;
}

/* E-Mail und Betreuer-Domain dürfen umbrechen (sonst sehr breite Spalten) */
table.units .email-cell, table.units .caretaker {
  overflow-wrap: anywhere;
  max-width: 11rem;
}

table.units .email-cell {
  min-width: 8rem;
  font-size: 0.8rem;
}

/* Lange Namen ohne Leerzeichen (z. B. „SkyWindNG_I_Windkraft_…“) und „Vorübergehend
   stillgelegt“ sollen die Tabelle nicht verbreitern. */
table.units td:not(.text-end) {
  overflow-wrap: anywhere;
}

table.units td .badge {
  white-space: normal;
  text-align: left;
}

/* Spaltenköpfe etwas kleiner – bei den Zahlenspalten bestimmt die Überschrift die Breite */
table.units thead th {
  font-size: 0.8rem;
}

table.units .caretaker {
  max-width: 8rem;
  margin-left: auto;
}

table.units .badge {
  font-weight: 500;
}

table.units th a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

/* Spaltenfilter: Trichter dezent, aktiv kräftig blau */
.col-filter > .btn {
  color: var(--bs-secondary-color);
  opacity: 0.45;
  line-height: 1;
}

.col-filter > .btn:hover, .col-filter > .btn.show {
  opacity: 1;
}

.col-filter > .btn.active-filter {
  color: var(--bs-primary);
  opacity: 1;
}

.col-filter .dropdown-menu {
  min-width: 15rem;
  white-space: normal;
}

table.units tr.removed td {
  opacity: 0.6;
}

table.kv th {
  width: 40%;
  font-weight: 500;
  color: var(--bs-secondary-color);
}

/* Datenstand: lange Anlagenlisten in zwei Spalten */
.changes-list {
  columns: 2 22rem;
}

details > summary.card-header {
  cursor: pointer;
}

/* Chronik: Zeilenumbrüche im Text erhalten */
.journal-text {
  white-space: pre-wrap;
}

/* Karte */
.map {
  position: relative;
  height: calc(100vh - 230px);
  min-height: 420px;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--bs-border-radius);
}

.map-legend {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--bs-border-radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.map-legend .dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 0.4rem;
  border-radius: 50%;
  vertical-align: -1px;
  border: 1px solid #fff;
}

.map-legend .dot.ring {
  background: #fff;
  border: 2.5px solid #fd7e14;
}

.map-legend .dot.ring.single {
  border: 3px solid #212529;
}

.map-legend .dot.own {
  background: #dc3545;
}

.map-popup table th {
  font-weight: 500;
  color: var(--bs-secondary-color);
  padding-right: 0.5rem;
  white-space: nowrap;
}

.map-popup table {
  font-size: 0.85rem;
}

.maplibregl-popup-content {
  padding: 10px 12px;
}