:root {
  --green: #4a5d3a;
  --green-dark: #374429;
  --bg: #f5f1e8;
  --card-bg: #ffffff;
  --text: #2b2b26;
  --muted: #6b6b63;
  --red: #b3452c;
  --danger-bg: #fbeceb;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.beta-banner {
  background: #f4c542;
  color: #4a3b00;
  text-align: center;
  font-size: 0.75rem;
  padding: 6px 10px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1001;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--green);
  color: white;
  position: sticky;
  top: 28px;
  z-index: 1000;
}
.topbar h1 { font-size: 1.05rem; margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-badge { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.hidden { display: none !important; }

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
  position: sticky;
  top: 74px;
  z-index: 950;
}
.stats-bar b { color: var(--green-dark); }
.stats-bar .link-btn { margin-left: auto; color: var(--green-dark); }

.floating-filter {
  position: fixed;
  bottom: 20px;
  right: 10px;
  background: white;
  padding: 6px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 900;
}
.floating-filter select {
  border: none;
  background: transparent;
  font-size: 0.8rem;
  padding: 4px 2px;
  max-width: 140px;
}

.inline-link { text-decoration: underline; font-size: inherit; padding: 0; }

.menu-card { max-width: 320px; }
.menu-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.menu-nav-item {
  text-align: left;
  background: var(--bg);
  border: 1px solid #e4ded0;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}
.menu-nav-item:hover { background: #ece6d8; }

.text-page { max-width: 520px; max-height: 85vh; overflow-y: auto; text-align: left; line-height: 1.5; }
.text-page h3 { margin-top: 0; }

.species-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  background: #ece6d8;
  color: var(--green-dark);
  font-weight: 600;
  margin-bottom: 6px;
}

.link-btn {
  background: none;
  border: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
}

.view { height: calc(100% - 112px); }

.card {
  background: var(--card-bg);
  max-width: 480px;
  margin: 24px auto;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card h2 { margin-top: 0; }

form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=file], select, textarea {
  font-size: 1rem;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-weight: normal;
  font-family: inherit;
}
textarea { resize: vertical; width: 100%; }

.btn-primary {
  background: var(--green);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary:active { background: var(--green-dark); }

.btn-secondary {
  background: #eee;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.error {
  background: var(--danger-bg);
  color: var(--red);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

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

.fab {
  position: fixed;
  bottom: 20px;
  left: 10px;
  background: var(--green);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 30px;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 900;
  cursor: pointer;
}

.locate-btn {
  position: fixed;
  right: 10px;
  bottom: 90px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  font-size: 1.3rem;
  z-index: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.locate-btn:active { background: #eee; }
.locate-btn.locating { opacity: 0.6; cursor: wait; }

.detail-location-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.detail-location-actions .btn-secondary { flex: 1; min-width: 140px; text-align: center; text-decoration: none; display: inline-block; }

.my-location-dot { width: 18px; height: 18px; border-radius: 50%; background: #4285f4; border: 3px solid white; box-shadow: 0 0 0 2px rgba(66,133,244,0.5); }

.legend {
  position: fixed;
  top: 122px;
  right: 10px;
  background: white;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 900;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot-open { background: var(--red); }
.dot-done { background: var(--green); }

.photo-preview {
  max-width: 100%;
  max-height: 45vh;
  object-fit: contain;
  background: #f4f1ea;
  display: block;
  border-radius: 8px;
  margin-top: -4px;
}

.location-toggle { display: flex; gap: 8px; }
.toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #eee;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.toggle-option input { display: none; }
.toggle-option.active { background: var(--green); color: white; border-color: var(--green); }

.manual-map {
  width: 100%;
  height: 220px;
  border-radius: 8px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.place-search { display: flex; gap: 6px; margin-top: 4px; }
.place-search input {
  flex: 1;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-weight: normal;
}
.place-search button { padding: 8px 12px; }
.place-search-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid #e4ded0;
  border-radius: 8px;
  overflow: hidden;
  max-height: 160px;
  overflow-y: auto;
}
.place-search-results li {
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.place-search-results li:last-child { border-bottom: none; }
.place-search-results li:hover { background: var(--bg); }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: normal;
  background: #fff6e5;
  border: 1px solid #f0d9a6;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
}
.checkbox-label input { margin-top: 3px; }

.id-field-group { display: flex; flex-direction: column; gap: 6px; margin-top: -4px; }
.id-field-label { font-size: 0.85rem; font-weight: 600; margin: 0; }

.flag-report-btn { margin-top: 10px; color: var(--red); text-align: center; width: 100%; }

.photo-wrap { position: relative; margin-bottom: 10px; }
/* Cap photo height so very large/tall photos can't blow up the detail card
   (was causing the close button to end up unreachable above the viewport). */
.photo-wrap .detail-photo {
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  background: #f4f1ea;
  border-radius: 8px;
  display: block;
  margin-bottom: 0;
}
.photo-wrap.blurred .detail-photo { filter: blur(24px) saturate(0.6); }
.photo-warning-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  cursor: pointer;
  border-radius: 8px;
  background: rgba(0,0,0,0.15);
}
.photo-warning-overlay .eye-slash { font-size: 2rem; }
.photo-warning-overlay .warning-text {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 20px;
}

.overview-thumb-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.overview-thumb-blurred { filter: blur(6px); }
.overview-thumb-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
/* max-height + overflow-y ensure the close button is always reachable by
   scrolling, even in edge cases (e.g. a very long description) — mirrors the
   same pattern already used for .overview-card / .text-page. */
.detail-card { position: relative; width: 100%; max-height: 85vh; overflow-y: auto; }
.close-x { position: absolute; top: 8px; right: 8px; font-size: 1.1rem; z-index: 5; }
.detail-photo { width: 100%; max-height: 45vh; object-fit: contain; background: #f4f1ea; border-radius: 8px; margin-bottom: 10px; }
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--danger-bg);
  color: var(--red);
}
.status-badge.done { background: #e8f0e2; color: var(--green-dark); }

.overview-card { max-height: 85vh; overflow-y: auto; }
.overview-card h4 { margin-bottom: 6px; margin-top: 18px; }
.overview-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.overview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}
.overview-item:hover { background: #ece6d8; }
.overview-item-text { display: flex; flex-direction: column; gap: 2px; }
.overview-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.overview-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: #e4ded0; font-size: 1.2rem;
}

/* Tropfen-/Bubble-Marker auf der Karte */
.pin-marker { width: 30px; height: 40px; position: relative; }
.pin-marker .pin-body {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--red);
  transform: rotate(-45deg);
  position: absolute;
  top: 2px;
  left: 1px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  border: 2px solid white;
}
.pin-marker.done .pin-body { background: var(--green); }
.pin-marker .pin-emoji {
  position: absolute;
  top: 6px;
  left: 0;
  width: 28px;
  text-align: center;
  font-size: 1rem;
  transform: rotate(0deg);
}

/* Cluster-Bubbles (Leaflet.markercluster) im App-Farbschema, eigenes Markup via iconCreateFunction */
.cluster-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  background: rgba(74, 93, 58, 0.9);
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.cluster-bubble.cluster-small { width: 46px; height: 46px; font-size: 0.95rem; }
.cluster-bubble.cluster-medium { width: 60px; height: 60px; font-size: 1.15rem; background: rgba(74, 93, 58, 0.95); }
.cluster-bubble.cluster-large { width: 76px; height: 76px; font-size: 1.4rem; background: rgba(179, 69, 44, 0.9); }

/* Nutzungsregeln */
.rules-list { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.rules-list li { line-height: 1.4; }

/* Admin-Panel */
/* Höhere Selektor-Spezifität (.text-page.admin-page statt nur .admin-page)
   ist hier bewusst nötig: das Admin-Overlay trägt sowohl "text-page" (max-width
   520px) als auch "admin-page" als Klasse. Mit gleicher Spezifität würde bei
   einer künftigen Umsortierung der Regeln im Stylesheet plötzlich wieder die
   520px-Regel gewinnen und der Admin-Bereich unerwartet schmal werden. */
.text-page.admin-page { max-width: 1400px; width: 92vw; max-height: 85vh; overflow-y: auto; text-align: left; }
.admin-tabs { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.admin-tab {
  background: var(--bg);
  border: 1px solid #e4ded0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
}
.admin-tab.active { background: var(--green); color: white; border-color: var(--green); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee; vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table .btn-secondary { padding: 5px 9px; font-size: 0.78rem; margin-right: 4px; margin-bottom: 4px; }
.admin-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 600; }
.admin-badge.banned { background: var(--danger-bg); color: var(--red); }
.admin-badge.admin { background: #e8f0e2; color: var(--green-dark); }

/* Kurzes Aufblitzen, um eine per Klick aus den Neuigkeiten
   angesprungene Nutzerzeile eindeutig erkennbar zu machen. */
@keyframes rowHighlightFlash {
  from { background-color: #fff3b0; }
  to { background-color: transparent; }
}
.row-highlight { animation: rowHighlightFlash 2.2s ease; }

/* Nutzer-Suche/-Filter im Admin-Tab "Nutzer" */
.admin-user-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-user-filters input[type=text] { flex: 1; min-width: 180px; }
.admin-user-filters select { min-width: 130px; }

/* Sperren-Modal: Grund + Dauer */
.radio-row { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: normal; padding: 2px 0; }
.ban-duration-options { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; }

/* Datenschutzerklärung - etwas breiter als normale Textseiten, viele Abschnitte */
.privacy-page { max-width: 640px; }
.privacy-page h4 { margin-bottom: 4px; margin-top: 18px; }
.privacy-page h4:first-of-type { margin-top: 10px; }

/* Toast-Benachrichtigungen (z. B. Logout-Bestätigung, Hinweise nach Login) —
   bewusst mittig und groß, damit sie nicht übersehen werden. */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 90vw;
  max-width: 420px;
  pointer-events: none;
}
.toast {
  background: var(--green-dark);
  color: white;
  padding: 18px 24px;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: scale(1); }
.toast.error { background: var(--red); }

/* Admin-Ereignisliste / Übersichtslisten ohne Foto-Thumbnail */
.overview-item-text { width: 100%; }
