/* =========================================================
   community.css
   - Wird nur auf page-community.php geladen (via functions.php enqueue)
   - CI-nah: weiche Rundungen, dezente Borders, Card-Look
   ========================================================= */

/* Header über Leaflet */
.site-header{
  position: sticky;
  top: 0;
  z-index: 99999;
}

/* Map unter Header */
.community-map{
  position: relative;
  z-index: 1;
}
.leaflet-container{ z-index: 1 !important; }
.leaflet-pane, .leaflet-top, .leaflet-bottom{ z-index: 2 !important; }
.leaflet-popup{ z-index: 10 !important; }

/* a11y helper */
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

/* Kommunenliste Header */
.kommunenliste-header{
  display:flex;
  gap:16px;
  align-items:flex-end;
  justify-content:space-between;
  margin-bottom:18px;
}

.kommunenliste-filter{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width: 320px;
}

.kommunenliste-search{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.14);
  background:#fff;
  font: inherit;
  outline: none;
}

.kommunenliste-search:focus{
  border-color: rgba(15,23,42,.35);
  box-shadow: 0 0 0 4px rgba(15,23,42,.08);
}

.kommunenliste-count{
  font-size: .95em;
  opacity: .72;
}

/* Mobile */
@media (max-width: 640px){
  .kommunenliste-grid{
    grid-template-columns: 1fr;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1023px){
  .kommunenliste-grid{
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop */
@media (min-width: 1024px){
  .kommunenliste-grid{
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large Desktop */
@media (min-width: 1400px){
  .kommunenliste-grid{
    grid-template-columns: repeat(4, 1fr);
  }
}


/* Cards */
.kommune-card{
  padding:0;
}

.kommune-card-inner{
  display:flex;
  gap:14px;
  padding:16px;
  align-items:flex-start;
}

.kommune-media{
  flex:0 0 auto;
  width:54px;
  height:54px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.kommune-logo{
  width:54px;
  height:54px;
  object-fit:contain;
  border-radius:14px;
}

.kommune-logo-placeholder{
  width:54px;
  height:54px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(15,23,42,.06);
  font-size: 22px;
}

.kommune-name{
  margin:0 0 6px;
  font-size: 1.05em;
}

.kommune-meta{
  margin:0;
  font-size: .95em;
  opacity: .8;
}

.kommune-meta--placeholder{
  opacity: .6;
}

.kommune-actions{
  margin-top:10px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Empty */
.kommunenliste-empty{
  margin-top:14px;
  opacity:.8;
}

@media (max-width: 760px){
  .kommunenliste-header{
    flex-direction:column;
    align-items:stretch;
  }

  .kommunenliste-filter{
    min-width: 0;
    width:100%;
  }

  .kommunenliste-grid{
    grid-template-columns: 1fr;
  }
}
/* Logo/Wappen immer vollständig anzeigen */
.kommune-media{
  display: flex;
  align-items: center;
  justify-content: center;
}

.kommune-logo{
  width: 100%;
  height: 110px;              /* anpassen, wenn du höher willst */
  object-fit: contain;        /* WICHTIG: kein Abschneiden */
  object-position: center;
  background: #fff;           /* neutraler Hintergrund */
  border: 1px solid rgba(15,23,42,.12);   /* Rand um Grafik */
  border-radius: 14px;
  padding: 10px;              /* Luft um das Wappen */
  box-sizing: border-box;
}

/* falls du SVGs hast, hilft das manchmal */
.kommune-logo img, .kommune-logo svg{
  max-width: 100%;
  max-height: 100%;
}
/* Kennzahlen: "Label: Wert" */
.kommune-metric span::after{
  content: ": ";
}
/* --- FIX: Kommunen-Kacheln als Grid mit 4/3/2/1 Spalten --- */
.kommunenliste-grid{
  display: grid !important;
  gap: 1.5rem !important;
  grid-template-columns: 1fr; /* mobile default */
}

/* ab Tablet: 2 */
@media (min-width: 640px){
  .kommunenliste-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ab Desktop: 3 */
@media (min-width: 1024px){
  .kommunenliste-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ab großem Desktop: 4 */
@media (min-width: 1400px){
  .kommunenliste-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Sicherheit: Cards dürfen nicht künstlich begrenzt sein */
.kommunenliste-grid .kommune-card{
  width: auto !important;
  max-width: none !important;
}
