/* NVE-Tracking – Mobile-first Styles */
:root {
  --bg: #0f1218;
  --bg-card: #1a1f2b;
  --bg-card-hover: #232938;
  --fg: #e8eaee;
  --fg-muted: #9aa0ac;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-fg: #ffffff;
  --success: #16a34a;
  --warning: #f59e0b;
  --error: #ef4444;
  --border: #2a3142;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .back { color: var(--fg); font-size: 24px; display: inline-block; padding: 4px 8px; margin-right: 4px; }
/* Feste Breite reserviert: Zeilen-Zähler lädt nachträglich, darf aber die
   Buttons (Protokoll/Abmelden) nicht nach links schieben → kein Verklicken. */
.status { font-size: 12px; color: var(--fg-muted); display: inline-block; min-width: 88px; text-align: right; white-space: nowrap; }
.status.online { color: var(--success); }
.status.offline { color: var(--error); }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

h1 { font-size: 24px; margin: 0 0 20px; }
h2 { font-size: 18px; margin: 24px 0 12px; color: var(--fg); }

/* ===== Menü-Seite ===== */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 380px) { .menu-grid { grid-template-columns: 1fr; } }

.menu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  color: var(--fg);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: background 0.15s;
  min-height: 140px;
  justify-content: center;
}
.menu-card:hover { background: var(--bg-card-hover); color: var(--fg); }
.menu-card.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.menu-card.primary:hover { background: var(--accent-hover); }
.menu-icon { font-size: 36px; }
.menu-title { font-weight: 600; font-size: 16px; }
.menu-sub { font-size: 12px; color: var(--fg-muted); }
.menu-card.primary .menu-sub { color: var(--accent-fg); opacity: 0.8; }

/* ===== Formulare ===== */
.field { margin-bottom: 14px; }
label {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input, select, textarea {
  width: 100%;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-card); color: var(--fg); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); }
.btn-danger { background: var(--error); }
.btn-group { display: flex; gap: 8px; }
.btn-group .btn { flex: 1; }

.toast-overlay {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.92);
  color: white;
  padding: 24px 32px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  z-index: 1000;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: var(--shadow);
}
.toast-overlay.visible { opacity: 1; }
.toast-overlay.success { border-left: 4px solid var(--success); }
.toast-overlay.error { border-left: 4px solid var(--error); background: rgba(60,0,0,0.95); }



/* ===== Tabelle ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg-card); font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--fg-muted); }
tr:hover td { background: var(--bg-card); }
td.mono { font-family: ui-monospace, Menlo, monospace; }
td .row-actions { display: flex; gap: 6px; }
td .row-actions button {
  background: var(--bg-card-hover);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
td .row-actions button.danger { background: var(--error); color: white; border-color: var(--error); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-card .label { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

/* ===== Misc ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
}
.alert {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--error);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  color: var(--error);
}
.alert.success { background: rgba(22,163,74,0.1); border-color: var(--success); color: var(--success); }
.alert.info { background: rgba(59,130,246,0.1); border-color: var(--accent); color: var(--accent); }

.footnote {
  margin-top: 32px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 12px;
}

.loader {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.row { display: flex; gap: 8px; align-items: end; }
.row > * { flex: 1; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tb-filters { display: flex; gap: 8px; }
.tb-filters > div { flex: 1; min-width: 0; }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Aktions-Buttons: gleiche Hoehe/Box wie die Datum-Felder (Input), gleich breit, kompakte Schrift */
.tb-actions .btn { flex: 1 1 150px; min-width: 0; padding: 14px 12px; font-size: 14px; border: 1px solid transparent; white-space: nowrap; }
.tb-actions .btn-secondary { border-color: var(--border); }
.chip {
  display: inline-block;
  background: var(--bg-card-hover);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin-right: 6px;
}
.chip.standort { background: rgba(59,130,246,0.15); border-color: var(--accent); color: var(--accent); }

/* ===== Farbschemata (umschaltbar in den Einstellungen) ===== */
/* "Standard" = :root oben (Dunkelblau). Die folgenden Sets ueberschreiben nur die Farb-Variablen. */
html[data-theme="hell"] {
  --bg: #eef1f6; --bg-card: #ffffff; --bg-card-hover: #eef2f8;
  --fg: #1b2430; --fg-muted: #5b6675;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-fg: #ffffff;
  --success: #15803d; --warning: #b45309; --error: #dc2626;
  --border: #d7dee9; --shadow: 0 4px 12px rgba(20,30,50,0.10);
}
html[data-theme="beige"] {
  --bg: #f4eee2; --bg-card: #fbf8f1; --bg-card-hover: #efe7d8;
  --fg: #4a443b; --fg-muted: #8e8676;
  --accent: #46b3a9; --accent-hover: #3a9b91; --accent-fg: #0d2b28;
  --success: #4f9e74; --warning: #bf8a3e; --error: #c25b4f;
  --border: #e6dcca; --shadow: 0 4px 16px rgba(120,100,70,0.12);
}
/* —— dunkel: augenschonendes Anthrazit/Schwarz (allgemein) —— weiches Grau statt Reinweiss, gedämpfter Akzent —— */
html[data-theme="dunkel"] {
  --bg: #0d0e10; --bg-card: #17191d; --bg-card-hover: #1f2226;
  --fg: #d3d6db; --fg-muted: #868b93;
  --accent: #6cae9e; --accent-hover: #5b9a8b; --accent-fg: #0d0e10;
  --success: #67b58c; --warning: #c8a667; --error: #cf8585;
  --border: #262a30; --shadow: 0 4px 14px rgba(0,0,0,0.5);
}
/* —— bunt: farbenfroh (allgemein) —— großer Farbtopf: Blau · Orange · Violett · Cyan · Grün —— */
html[data-theme="bunt"] {
  --bg: #141225; --bg-card: #1f1b36; --bg-card-hover: #2a2447;
  --fg: #f1ecff; --fg-muted: #ada3c9;
  --accent: #4f8cff; --accent-hover: #6f6bff; --accent-fg: #ffffff;
  --success: #22c55e; --warning: #f59e0b; --error: #fb7185;
  --border: #352c52; --shadow: 0 6px 22px rgba(60,40,150,0.34);
}
html[data-theme="bunt"] body {
  background:
    radial-gradient(820px 520px at 8% -6%, rgba(79,140,255,.24), transparent 60%),
    radial-gradient(820px 520px at 96% -2%, rgba(255,138,76,.20), transparent 58%),
    radial-gradient(820px 560px at 102% 62%, rgba(168,85,247,.18), transparent 60%),
    radial-gradient(820px 560px at -4% 70%, rgba(34,211,238,.18), transparent 60%),
    radial-gradient(900px 560px at 50% 116%, rgba(34,197,94,.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* —— nacht: warmes, blaureduziertes Dunkel (Spät-/Nachtschicht) — Amber-Akzent, wenig Blaulicht —— */
html[data-theme="nacht"] {
  --bg: #15120d; --bg-card: #201b13; --bg-card-hover: #2b2418;
  --fg: #ece3d2; --fg-muted: #a99c84;
  --accent: #e0a44e; --accent-hover: #c98f3c; --accent-fg: #1a1408;
  --success: #8fbf6a; --warning: #d99a3a; --error: #d97a5e;
  --border: #322a1d; --shadow: 0 4px 16px rgba(0,0,0,0.55);
}
/* —— kontrast: hoher Kontrast / barrierefrei (WCAG AAA) — kräftige Farben, klare Rahmen —— */
html[data-theme="kontrast"] {
  --bg: #ffffff; --bg-card: #ffffff; --bg-card-hover: #eaeaea;
  --fg: #000000; --fg-muted: #1f1f1f;
  --accent: #0033cc; --accent-hover: #002299; --accent-fg: #ffffff;
  --success: #006b1f; --warning: #8a5300; --error: #c00000;
  --border: #333333; --shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* ===== Admin-Themes / Fun-Pack (nur sichtbar nach Anmeldung mit dem Admin-Passwort) ===== */
/* Alle dunkel -> Karte erbt die Standard-Kachel-Invertierung (kein Eintrag in der hell/beige-Ausnahme noetig). */
html[data-theme="matrix"] {                 /* 🟢 Matrix – Neon-Gruen auf Schwarz */
  --bg: #000600; --bg-card: #02140a; --bg-card-hover: #04250f;
  --fg: #b7ffc4; --fg-muted: #4caf63;
  --accent: #00ff41; --accent-hover: #00cc34; --accent-fg: #001a06;
  --success: #00ff41; --warning: #d7ff00; --error: #ff5555;
  --border: #0c4a1a; --shadow: 0 4px 18px rgba(0,255,65,0.18);
}
html[data-theme="azeroth"] {                /* ⚔️ Azeroth – WoW Gold auf Nachtblau (Allianz-Optik) */
  --bg: #0a0f1a; --bg-card: #121a2b; --bg-card-hover: #1b2640;
  --fg: #f4e4c1; --fg-muted: #b89c6a;
  --accent: #f8b700; --accent-hover: #d99e00; --accent-fg: #1a1200;
  --success: #1eff00; --warning: #ff8000; --error: #ff4040;
  --border: #2c3a5a; --shadow: 0 4px 18px rgba(248,183,0,0.18);
}
html[data-theme="horde"] {                  /* 💀 Horde – WoW Blutrot auf Schwarz */
  --bg: #100604; --bg-card: #1e0c08; --bg-card-hover: #2c120c;
  --fg: #f1d9cf; --fg-muted: #b8897c;
  --accent: #c41f1f; --accent-hover: #a01818; --accent-fg: #ffe9e0;
  --success: #6abe30; --warning: #e0a020; --error: #ff5340;
  --border: #3a1a12; --shadow: 0 4px 18px rgba(196,31,31,0.22);
}
html[data-theme="synthwave"] {              /* 🌆 Synthwave – Magenta & Cyan auf Tieflila */
  --bg: #1a0b2e; --bg-card: #241141; --bg-card-hover: #321a57;
  --fg: #ffe6ff; --fg-muted: #c79bd6;
  --accent: #ff2bd6; --accent-hover: #e018bd; --accent-fg: #1a0b2e;
  --success: #05ffa1; --warning: #ffd319; --error: #ff5e7e;
  --border: #3d2363; --shadow: 0 4px 20px rgba(255,43,214,0.22);
}
html[data-theme="dracula"] {                /* 🧛 Dracula – der Klassiker fuer Entwickler */
  --bg: #282a36; --bg-card: #343746; --bg-card-hover: #404456;
  --fg: #f8f8f2; --fg-muted: #9ea0b0;
  --accent: #bd93f9; --accent-hover: #a875f5; --accent-fg: #1a1b24;
  --success: #50fa7b; --warning: #f1fa8c; --error: #ff5555;
  --border: #44475a; --shadow: 0 4px 16px rgba(20,20,30,0.5);
}
html[data-theme="tron"] {                   /* 🔵 Tron – Elektro-Cyan auf Schwarz */
  --bg: #00060a; --bg-card: #021018; --bg-card-hover: #04222e;
  --fg: #d6f7ff; --fg-muted: #5fa9bd;
  --accent: #00e5ff; --accent-hover: #00bcd4; --accent-fg: #001318;
  --success: #00ffd0; --warning: #ffcc00; --error: #ff4d6d;
  --border: #0a3a48; --shadow: 0 4px 18px rgba(0,229,255,0.2);
}

/* ===== Bild-Kulissen NUR fuer die WoW-Themes (Azeroth/Horde) — gemeinfreie Gemaelde (Met Open Access, CC0) ===== */
/* Ebene hinter dem Inhalt (html::before). Dunkles Overlay haelt Tabellen/Zahlen lesbar; Szene je Seite ueber html[data-scene]. */
html[data-theme="azeroth"], html[data-theme="horde"] { background: var(--bg); }            /* dunkler Fallback unter dem Bild */
html[data-theme="azeroth"] body, html[data-theme="horde"] body { background: transparent; } /* Body durchsichtig -> Bild scheint durch */
html[data-theme="azeroth"]::before, html[data-theme="horde"]::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
/* Azeroth (Allianz): Standard = episches Tal (Sturmwind); einzelne Seiten ueberschreiben die Szene */
html[data-theme="azeroth"]::before { background-image: linear-gradient(rgba(10,15,26,0.84), rgba(10,15,26,0.93)), url("themes/valley.jpg"); }
html[data-theme="azeroth"][data-scene="dashboard"]::before { background-image: linear-gradient(rgba(8,18,12,0.80), rgba(8,15,26,0.92)), url("themes/elwynn.jpg"); }       /* Wald von Elwynn */
html[data-theme="azeroth"][data-scene="verladebilder"]::before { background-image: linear-gradient(rgba(10,15,26,0.82), rgba(10,15,26,0.93)), url("themes/ironforge.jpg"); }  /* Ironforge / Dun Morogh */
/* Horde: feurige Daemmerung (Durotar/Orgrimmar) */
html[data-theme="horde"]::before { background-image: linear-gradient(rgba(24,7,4,0.80), rgba(16,6,4,0.92)), url("themes/orgrimmar.jpg"); }

/* ===== Karte (Leaflet): native CARTO-Basemaps (Voyager hell / Dark Matter dunkel, in dashboard.html theme-abhängig gewählt) – KEIN Invert-Hack mehr nötig ===== */
.leaflet-tile-pane { filter: none; }
