/* Nexxcore-Karte Testbühne — Grundlayout */
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, sans-serif; }
#map { position: absolute; inset: 0; z-index: 0; background: #a8cc88; }

/* Rollen-Umschalter oben mittig ("Ansicht als:" — einziges testbühnen-eigenes Element) */
#rollen-leiste {
  position: absolute; z-index: 1200; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: rgba(17, 24, 39, .86); color: #fff;
  padding: 6px 8px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.35);
  font-size: 13px; backdrop-filter: blur(4px);
}
#rollen-leiste .rl-titel { opacity: .75; padding: 0 4px; }
.rl-btn {
  border: 0; background: rgba(255,255,255,.12); color: #fff;
  padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.rl-btn:hover { background: rgba(255,255,255,.22); }
.rl-btn.aktiv { background: #2563eb; }

/* Leaflet-Panes-Reihenfolge: MapLibre-Unterlage ganz unten, Overlays darüber */
.leaflet-container { background: #a8cc88; }

/* ===== Markermodus-Button oben mittig (wie in Nexxcore: an = orange leuchtend, aus = gedämpft) ===== */
#nx-markermodus {
  position: absolute; z-index: 1200; top: 52px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(148,163,184,.6); background: #f8fafc; color: #334155;
  padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); opacity: .8;
  transition: background-color .15s, color .15s, opacity .15s, border-color .15s;
}
#nx-markermodus:hover { opacity: 1; }
#nx-markermodus.aktiv {
  background: #f97316; color: #fff; border-color: #f97316; opacity: 1;
  box-shadow: 0 2px 12px rgba(249,115,22,.5);
}
#nx-markermodus .nx-mm-icon { display: flex; }
#nx-markermodus .nx-mm-icon svg { width: 17px; height: 17px; display: block; }

/* ===== Gebiete-Werkzeug oben links (nur Admin/Teamleiter) ===== */
#nx-gebiete-panel {
  position: absolute; z-index: 1200; top: 10px; left: 10px; width: 220px;
  background: #fff; color: #111827; border-radius: 11px; box-shadow: 0 4px 18px rgba(0,0,0,.25);
  padding: 10px; font-size: 13px;
}
.ngp-zeichnen {
  width: 100%; border: 0; background: #f97316; color: #fff; padding: 8px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.ngp-zeichnen:hover { background: #ea580c; }
.ngp-zeichnen:disabled { background: #cbd5e1; color: #64748b; cursor: not-allowed; }
.ngp-liste { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.ngp-leer { color: #94a3b8; font-size: 12px; }
.ngp-gebiet { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; }
.ngp-gebiet:not(.ngp-gebiet--entwurf) { cursor: pointer; }
.ngp-gebiet:not(.ngp-gebiet--entwurf):hover { background: #f1f5f9; }
.ngp-gebiet--aktiv, .ngp-gebiet--aktiv:hover { background: #fff7ed; box-shadow: inset 0 0 0 1.5px #f97316; }
/* Spezifischer als ".ngp-gebiet button", damit der Farbpunkt (jetzt ein <button>) rund bleibt */
.ngp-gebiet .ngp-punkt { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px #0002; flex: 0 0 auto; border: 0; padding: 0; }
.ngp-punkt--klick { cursor: pointer; }
.ngp-punkt--klick:hover { box-shadow: 0 0 0 2px #0004; }
.ngp-name { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ngp-gebiet button { border: 0; background: #f1f5f9; cursor: pointer; border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.ngp-del:hover { background: #fee2e2; }

/* Entwurf: das gerade gezeichnete, noch nicht gespeicherte Gebiet (ohne Bearbeiten/Loeschen) */
.ngp-gebiet--entwurf { opacity: .9; cursor: default; }
.ngp-entwurf-badge { font-size: 10px; color: #f97316; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }

/* Untere, mittig fixierte Aktionsleiste beim Zeichnen (Speichern / Abbrechen) */
#nx-zeichnen-aktionen {
  position: fixed; z-index: 1300; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 7px; padding: 6px 8px;
  background: rgba(17,24,39,.9); border-radius: 10px; box-shadow: 0 3px 14px rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
}
/* display:flex oben wuerde sonst das hidden-Attribut aushebeln -> nur beim Zeichnen sichtbar */
#nx-zeichnen-aktionen[hidden] { display: none; }
.nza-speichern, .nza-abbrechen {
  border: 0; border-radius: 7px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.nza-speichern { background: #f97316; color: #fff; }
.nza-speichern:hover { background: #ea580c; }
.nza-abbrechen { background: rgba(255,255,255,.14); color: #fff; }
.nza-abbrechen:hover { background: rgba(255,255,255,.24); }

/* Farb-Popup fuer Gebiete (12 vorgegebene Farben, 6x2-Raster) */
.ngp-farbpopup {
  position: fixed; z-index: 1400;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  padding: 8px; background: #fff; border-radius: 10px; box-shadow: 0 6px 22px rgba(0,0,0,.3);
}
.ngp-farbe {
  width: 22px; height: 22px; padding: 0; border: 2px solid #fff; border-radius: 6px;
  box-shadow: 0 0 0 1px #0002; cursor: pointer; transition: transform .1s;
}
.ngp-farbe:hover { transform: scale(1.15); }
.ngp-farbe--aktiv { outline: 2px solid #111827; outline-offset: 1px; }
html[data-theme="dark"] .ngp-farbpopup { background: #1f2937; }
html[data-theme="dark"] .ngp-farbe--aktiv { outline-color: #e5e7eb; }
html[data-theme="dark"] .ngp-gebiet:not(.ngp-gebiet--entwurf):hover { background: #172033; }
html[data-theme="dark"] .ngp-gebiet--aktiv, html[data-theme="dark"] .ngp-gebiet--aktiv:hover { background: #422006; box-shadow: inset 0 0 0 1.5px #f97316; }

/* ===== Gebiet-Card oben rechts (Teammitglieder des ausgewaehlten Gebiets) ===== */
#nx-gebiet-card {
  position: absolute; z-index: 1200; top: 10px; right: 10px; width: 232px;
  background: #fff; color: #111827; border-radius: 11px; box-shadow: 0 4px 18px rgba(0,0,0,.25);
  padding: 10px; font-size: 13px;
}
.ngc-kopf { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 9px; }
.ngc-punkt { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 1px #0002; flex: 0 0 auto; }
.ngc-titel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ngc-schliessen {
  flex: 0 0 auto; border: 0; background: none; cursor: pointer; padding: 2px; margin: -2px -2px -2px 0;
  color: #94a3b8; font-size: 15px; line-height: 1; border-radius: 6px;
}
.ngc-schliessen:hover { background: #f1f5f9; color: #334155; }
html[data-theme="dark"] .ngc-schliessen:hover { background: #334155; color: #e5e7eb; }
.ngc-label { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.ngc-liste { display: flex; flex-direction: column; gap: 4px; }
.ngc-mitglied {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; padding: 5px 8px; cursor: pointer;
  font-size: 13px; color: #334155; transition: background-color .12s, border-color .12s;
}
.ngc-mitglied:hover { background: #f8fafc; }
.ngc-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; color: #475569; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.ngc-mitglied .ngc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ngc-check { color: #f97316; font-weight: 700; opacity: 0; flex: 0 0 auto; }
.ngc-mitglied--aktiv { border-color: #f97316; background: #fff7ed; color: #9a3412; }
.ngc-mitglied--aktiv .ngc-avatar { background: #f97316; color: #fff; }
.ngc-mitglied--aktiv .ngc-check { opacity: 1; }

html[data-theme="dark"] #nx-gebiet-card { background: #1f2937; color: #e5e7eb; }
html[data-theme="dark"] .ngc-mitglied { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .ngc-mitglied:hover { background: #172033; }
html[data-theme="dark"] .ngc-avatar { background: #334155; color: #e5e7eb; }
html[data-theme="dark"] .ngc-mitglied--aktiv { background: #7c2d12; border-color: #f97316; color: #fed7aa; }
html[data-theme="dark"] .ngc-mitglied--aktiv .ngc-avatar { background: #f97316; color: #fff; }

/* ===== Team-Leiste unten mittig (kompakt, je drei Status-Kringel pro Mitglied) ===== */
#nx-team-leiste {
  position: fixed; z-index: 1200; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; padding: 8px 12px; max-width: 94vw; overflow-x: auto;
  background: rgba(255,255,255,.96); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
}
.nx-tm { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.nx-tm-avatar-wrap { position: relative; display: flex; }
.nx-tm-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #e2e8f0; color: #475569; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.nx-tm-name { font-size: 11px; color: #334155; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Kringel als Overlay am unteren Avatar-Rand: Unterkante buendig mit der Avatar-Unterkante */
.nx-tm-kringel { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; gap: 2px; z-index: 2; }
.nx-kringel {
  width: 5px; height: 5px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid #cbd5e1; background: #fff; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 4px; line-height: 1; font-weight: 700;
}
.nx-kringel:hover { border-color: #94a3b8; }
.nx-kringel--aktiv { background: #f97316; border-color: #f97316; }
.nx-kringel--erledigt { background: #16a34a; border-color: #16a34a; }

html[data-theme="dark"] #nx-team-leiste { background: rgba(31,41,55,.96); }
html[data-theme="dark"] .nx-tm-name { color: #cbd5e1; }
html[data-theme="dark"] .nx-tm-avatar { background: #334155; color: #e5e7eb; }
html[data-theme="dark"] .nx-kringel { background: #0f172a; border-color: #334155; }

/* ===== Karten-Controls: Info-Box (unten links) + Theme-/Satellit-Schalter (unten rechts) =====
   Die zentrale leaflet-override.css stylt diese Controls fest DUNKEL (bewusst, fuer Nexxcore).
   Auf der Testbühne sollen sie dem Theme folgen: im Dark-Mode dunkel (= Basis-Styles), im
   Light-Mode hell. Deshalb hier nur der Light-Look, greift wenn das Theme NICHT dark ist
   (auch initial, wenn noch kein data-theme gesetzt wurde). */
html:not([data-theme="dark"]) .leaflet-theme-schalter,
html:not([data-theme="dark"]) .leaflet-satellit-schalter,
html:not([data-theme="dark"]) .leaflet-info-box-btn {
  color: #334155;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
html:not([data-theme="dark"]) .leaflet-theme-schalter:hover,
html:not([data-theme="dark"]) .leaflet-satellit-schalter:hover,
html:not([data-theme="dark"]) .leaflet-info-box-btn:hover,
html:not([data-theme="dark"]) .leaflet-info-box-btn--aktiv {
  background: #ffffff;
  color: #111827;
}
html:not([data-theme="dark"]) .leaflet-theme-schalter--inaktiv:hover {
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
}
html:not([data-theme="dark"]) .leaflet-info-box-popup {
  background: rgba(255, 255, 255, 0.97);
  color: #1f2937;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
html:not([data-theme="dark"]) .leaflet-info-box-titel { color: #64748b; }
html:not([data-theme="dark"]) .leaflet-info-box-checkzeile { border-bottom-color: rgba(100, 116, 139, 0.25); }
html:not([data-theme="dark"]) .leaflet-info-box-checkbox { accent-color: #f97316; }
html:not([data-theme="dark"]) .leaflet-info-box-punkt { border-color: rgba(0, 0, 0, 0.15); }

/* Info-Box (unten links) mit ihrem aufklappenden Popup in den Vordergrund heben: der
   Leaflet-Control-Container deckelt sonst bei z-index ~1000, sodass das nach oben wachsende
   Popup hinter dem Gebiete-Panel (z-index 1200) verschwindet. Nur der untere-linke Control-
   Bereich (dort sitzt ausschliesslich die Info-Box) wird angehoben. */
.leaflet-bottom.leaflet-left { z-index: 1250; }

/* Dunkelmodus für das Gebiete-Panel (folgt dem Theme-Schalter via html[data-theme=dark]) */
html[data-theme="dark"] #nx-gebiete-panel { background: #1f2937; color: #e5e7eb; }
html[data-theme="dark"] .ngp-gebiet button { background: #0f172a; color: #cbd5e1; }
html[data-theme="dark"] #nx-markermodus { background: #1f2937; color: #cbd5e1; border-color: #334155; }
html[data-theme="dark"] #nx-markermodus.aktiv { background: #f97316; color: #fff; border-color: #f97316; }
