/* Admin-Webportal – dunkles Design passend zur App (Anthrazit + Logo-Blau). */
:root {
  --bg: #0e0f13;
  --surface: #181a20;
  --surface-2: #242730;
  --surface-3: #2e323c;
  --primary: #2f7bff;
  --primary-dim: #173a80;
  --text: #ecedef;
  --muted: #a3a7b1;
  --outline: rgba(255, 255, 255, 0.12);
  --error: #e5484d;
  --success: #3fb950;
  --warning: #f9a825;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 12px; }
a { color: var(--primary); }

/* ---------- Anmeldung ---------- */
.login { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; padding: 32px;
  background: var(--surface-2); border: 2px solid var(--primary); border-radius: 18px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-logo { width: 96px; height: 96px; border-radius: 22%; margin: 0 auto; }
label { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--outline); border-radius: 12px; padding: 10px 12px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 14px; padding: 9px 16px; font: inherit; cursor: pointer;
  background: var(--surface-3); color: var(--text);
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn.danger { background: var(--error); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; height: 100%; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--outline);
  display: flex; flex-direction: column; padding: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; margin-bottom: 20px; }
.brand img { width: 44px; height: 44px; border-radius: 22%; }
.brand small { color: var(--muted); font-weight: 400; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a {
  color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
#nav a:hover { background: var(--surface-2); }
#nav a.active { background: var(--primary-dim); }
.pill { background: var(--error); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.pill:empty { display: none; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.content { overflow: auto; padding: 24px; }

/* ---------- Karten, Tabellen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--outline); }
.stat b { display: block; font-size: 26px; }
.panel { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { min-width: 200px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--outline); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:hover td { background: rgba(255, 255, 255, .02); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary);
}
.user-cell { display: flex; align-items: center; gap: 10px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-3); }
.tag.new { background: var(--error); color: #fff; }
.tag.in_progress { background: var(--warning); color: #111; }
.tag.done { background: var(--success); color: #fff; }
.tag.online { background: var(--success); color: #fff; }
.tag.banned { background: var(--error); color: #fff; }
.tag.admin { background: var(--primary); color: #fff; }

/* ---------- Karte ---------- */
.map { height: 560px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--outline); position: relative; }
.map.tall { height: calc(100vh - 210px); min-height: 420px; }
/* Seiten mit Karte füllen die Höhe bis zum unteren Rand (Übersicht und Gebiete gleich groß). */
.page-fill { display: flex; flex-direction: column; height: calc(100vh - 48px); min-height: 520px; }
.page-fill > .grow { flex: 1; min-height: 360px; }
.map.fill { height: 100%; min-height: 360px; }

/* Stecknadel für Gebietsvorschläge (wie in der App: roter Kopf, dünner Stiel) */
.needle { position: relative; width: 18px; height: 44px; }
.needle::before {
  content: ""; position: absolute; left: 8px; top: 12px; width: 2px; height: 32px;
  background: #d6d8de; border-radius: 1px;
}
.needle::after {
  content: ""; position: absolute; left: 2px; top: 0; width: 14px; height: 14px; border-radius: 50%;
  background: var(--error); box-shadow: 0 0 0 2px #fff;
}
.needle.active::after { background: var(--warning); width: 16px; height: 16px; left: 1px; }

/* Adresssuche oben mittig auf der Karte */
.map-search {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1000; width: min(480px, calc(100% - 120px));
}
.map-search-row { display: flex; gap: 6px; }
.map-search-row input {
  flex: 1; border: 2px solid var(--primary); background: rgba(24, 26, 32, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.map-search-results {
  margin-top: 6px; background: var(--surface-2); border: 1px solid var(--outline);
  border-radius: 12px; overflow: hidden; box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.map-search-hit {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.map-search-hit:hover { background: var(--primary-dim); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--text); }
.leaflet-container { background: #0b0c10; font: inherit; }
/* Dunkle Karte: helle OSM-Kacheln invertieren (nur die Kacheln, nicht Marker/Gebiete). */
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.6); }
.leaflet-control-attribution { background: rgba(24, 26, 32, 0.8) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--primary); }

/* ---------- Galerie ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; cursor: zoom-in; }

/* ---------- Beweis-Nachrichten (Meldungen) ---------- */
.evidence { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: 16px; background: var(--surface-3); }
.msg.reported { align-self: flex-start; border: 1px solid var(--error); }
.msg.other { align-self: flex-end; background: var(--primary-dim); }
.msg small { display: block; color: var(--muted); font-size: 11px; }
.msg img { max-width: 220px; border-radius: 10px; display: block; margin-top: 4px; }

/* ---------- Dialoge ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: grid; place-items: center; padding: 24px; z-index: 2000;
}
.modal {
  width: 100%; max-width: 720px; max-height: 90vh; overflow: auto;
  background: var(--surface-2); border: 2px solid var(--primary); border-radius: 18px; padding: 24px;
  background-image: url("../img/logo.png"); background-repeat: no-repeat;
  background-position: center; background-size: 170px; background-blend-mode: soft-light;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal .form { display: flex; flex-direction: column; gap: 12px; }
.lightbox { max-width: 92vw; max-height: 88vh; border-radius: 12px; }

/* ---------- Hinweise ---------- */
#toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 3000; }
.toast { background: var(--surface-3); border-left: 4px solid var(--primary); padding: 10px 14px; border-radius: 10px; max-width: 380px; }
.toast.error { border-left-color: var(--error); }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { margin-top: 0; }
}
