/* style.css - eigenständiges, spielbezogenes Design (Abschnitt 3): klar
   getrennte Farben pro Fraktion, kein DPSG-Branding im Prototyp. */

:root {
  --color-bg: #10151c;
  --color-panel: #1a2129;
  --color-panel-alt: #212a34;
  --color-border: #2c3844;
  --color-text: #e7edf3;
  --color-text-muted: #93a2b1;
  --color-accent: #4f8ef7;

  --color-misterx: #d4a017;
  --color-polizei: #1565c0;
  --color-spielleiter: #37474f;
  --color-regie: #6a1b9a;

  --role-color: var(--color-accent);
}

body[data-role="misterx"] { --role-color: var(--color-misterx); }
body[data-role="polizei"] { --role-color: var(--color-polizei); }
body[data-role="spielleiter"] { --role-color: var(--color-spielleiter); }
body[data-role="regie"] { --role-color: var(--color-regie); }

* { box-sizing: border-box; }

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

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Topbar --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: var(--color-panel);
  border-bottom: 3px solid var(--role-color);
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.05rem;
}

.topbar-sub {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--role-color);
  color: #0c1015;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.topbar-link {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.topbar-link:hover { background: var(--color-panel-alt); color: var(--color-text); }
.topbar-link.active { background: var(--role-color); color: #0c1015; font-weight: 600; }

/* --- Layout --- */

#view-root { flex: 1; min-height: 0; }

.view-layout {
  display: flex;
  height: 100%;
}

.map { flex: 1; min-width: 0; background: #0c1015; }

.sidebar {
  width: 360px;
  flex: none;
  background: var(--color-panel);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-card {
  background: var(--color-panel-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}

.sidebar-card h3 { margin: 0 0 8px; font-size: 1rem; }
.sidebar-card label { display: block; font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 6px; }

.sidebar-tabs { display: flex; gap: 4px; }

.tab-btn {
  flex: 1;
  background: var(--color-panel-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.tab-btn.active { background: var(--role-color); color: #0c1015; border-color: var(--role-color); font-weight: 600; }
.tab-panel.is-hidden { display: none; }
.tab-panel { flex: 1; min-height: 0; overflow-y: auto; }

/* --- Role picker (landing) --- */

.role-picker {
  max-width: 640px;
  margin: 60px auto;
  padding: 0 20px;
  text-align: center;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 24px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 0.15s;
}

.role-card:hover { border-color: var(--color-accent); }
.role-card-icon { font-size: 2rem; }
.role-card-label { font-weight: 600; }

/* --- Simulation panel --- */

.sim-section { border-bottom: 1px solid var(--color-border); padding: 14px 0; }
.sim-section:first-child { padding-top: 0; }
.sim-section:last-child { border-bottom: none; }
.sim-section h3 { margin: 0 0 4px; }
.sim-section h4 { margin: 14px 0 6px; font-size: 0.9rem; color: var(--color-text-muted); }

.sim-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.sim-row label { flex: none; min-width: 120px; color: var(--color-text-muted); font-size: 0.85rem; }
.sim-inline { display: flex; align-items: center; gap: 6px; }

.hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 4px 0; }

.input {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

.input-narrow { width: 80px; }

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--role-color); color: #0c1015; }
.btn-secondary { background: var(--color-panel-alt); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger { background: #b71c1c; color: #fff; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; }

.sim-feedback { font-size: 0.85rem; min-height: 1.2em; margin-top: 6px; }
.sim-feedback.is-ok { color: #66bb6a; }
.sim-feedback.is-warning { color: #ff7043; }

.gm-request-list { display: flex; flex-direction: column; gap: 8px; }
.gm-request-row {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.gm-request-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-status-angefragt { background: #37474f; color: #cfd8dc; }
.badge-status-wartet { background: #f9a825; color: #1a1a1a; }
.badge-status-erhalten { background: #2e7d32; color: #fff; }
.badge-status-timeout { background: #c62828; color: #fff; }

.range-value { font-variant-numeric: tabular-nums; color: var(--color-text-muted); font-size: 0.85rem; }

/* --- Log table --- */

.log-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.log-table th, .log-table td { padding: 6px 8px; border-bottom: 1px solid var(--color-border); text-align: left; }
.log-table th { color: var(--color-text-muted); font-weight: 600; position: sticky; top: 0; background: var(--color-panel-alt); }
.log-table tr.row-suspect { background: rgba(198, 40, 40, 0.18); }
.mono { font-family: 'Cascadia Code', 'Consolas', monospace; font-size: 0.8rem; }

/* --- Distances (Mister X view) --- */

.distance-big { font-size: 2.2rem; font-weight: 700; color: var(--role-color); margin: 6px 0; }
.distance-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.distance-list li { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.radio-inline { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--color-text); min-width: 0; }

/* --- Regie page --- */

.view-layout--regie { flex-direction: row; padding: 20px; gap: 20px; overflow-y: auto; }
.regie-panel { flex: 1; max-width: 520px; }
.regie-feed { flex: 1; max-width: 480px; }
.regie-panel h2, .regie-feed h2 { margin-top: 0; }

.feed-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.feed-row.is-suspect { background: rgba(198, 40, 40, 0.18); }

/* --- Leaflet marker overrides --- */

.mx-marker-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
  font-size: 11px;
}
.mx-marker-dot--ghost { background: transparent; border: none; box-shadow: none; font-size: 18px; }

/* --- Footer --- */

.version-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  padding: 4px;
  background: var(--color-panel);
  border-top: 1px solid var(--color-border);
}

/* --- Responsive --- */

@media (max-width: 900px) {
  .view-layout { flex-direction: column; }
  .sidebar { width: auto; max-height: 55vh; border-left: none; border-top: 1px solid var(--color-border); }
  .role-cards { grid-template-columns: 1fr; }
  .view-layout--regie { flex-direction: column; }
}
