/* Minority Report inspired Data Knowledge Platform */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-deep: #03060d;
  --bg-mid: #060b18;
  --bg-panel: rgba(8, 14, 28, 0.86);
  --bg-panel-solid: #0a1024;
  --accent-cyan: #4dd2ff;
  --accent-cyan-glow: rgba(77, 210, 255, 0.55);
  --accent-blue: #6aa3ff;
  --accent-amber: #ffb955;
  --accent-magenta: #ff66cc;
  --accent-green: #66ffb2;
  --accent-red: #ff5577;
  --text-primary: #e6f1ff;
  --text-secondary: #8eb1d4;
  --text-dim: #5f7d99;
  --border: rgba(77, 210, 255, 0.18);
  --border-strong: rgba(77, 210, 255, 0.45);
  --font: 'Orbitron', 'Inter', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(77, 210, 255, 0.10), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(106, 163, 255, 0.08), transparent 55%),
    var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
}
/* Grid Overlay */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(77, 210, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 210, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 1;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(77, 210, 255, 0.025) 0, rgba(77, 210, 255, 0.025) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  z-index: 2;
  animation: scanlines 12s linear infinite;
}
@keyframes scanlines { from { background-position: 0 0; } to { background-position: 0 100px; } }

#app {
  position: relative;
  z-index: 5;
  width: 100vw; height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
}

/* ====== HEADER ====== */
.hud-header {
  display: grid;
  grid-template-columns: 280px 1fr auto;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8,14,28,0.95), rgba(8,14,28,0.7));
  backdrop-filter: blur(10px);
}
.brand {
  font-family: var(--font);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--accent-cyan);
  text-shadow: 0 0 14px var(--accent-cyan-glow);
}
.brand .sub {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}
.search-bar {
  display: flex; align-items: center;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 8px 16px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 0 24px rgba(77, 210, 255, 0.12);
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1px;
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar .icon { color: var(--accent-cyan); margin-right: 10px; font-size: 14px; }
.hud-stats {
  display: flex; gap: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}
.hud-stats b { color: var(--accent-cyan); font-weight: 700; }

/* ====== MAIN LAYOUT ====== */
.main {
  display: grid;
  grid-template-columns: 280px 1fr 420px;
  overflow: hidden;
}

/* ====== SIDE LEFT (Filters & Clusters) ====== */
.sidebar-left {
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  overflow-y: auto;
  padding: 20px 18px;
}
.sidebar-left h3 {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.cluster-list { list-style: none; margin-bottom: 24px; }
.cluster-item {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
  font-size: 12px;
  transition: all 0.15s;
  color: var(--text-secondary);
}
.cluster-item:hover { background: rgba(77, 210, 255, 0.08); border-color: var(--border); color: var(--text-primary); }
.cluster-item.active {
  background: rgba(77, 210, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(77, 210, 255, 0.25);
}
.cluster-item .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}
.cluster-item .count { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

.quick-actions { display: flex; flex-direction: column; gap: 6px; }
.quick-btn {
  background: rgba(77, 210, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  border-radius: 3px;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.quick-btn:hover { background: rgba(77, 210, 255, 0.18); border-color: var(--accent-cyan); }
.quick-btn .ico { font-size: 16px; }

/* ====== GRAPH ====== */
.graph-wrap {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(10,20,40,0.4), rgba(3,6,13,0.8));
}
#graph { width: 100%; height: 100%; display: block; }
.graph-corner {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding: 8px 12px;
  pointer-events: none;
  z-index: 3;
}
.graph-corner.tl { top: 10px; left: 14px; border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); padding: 8px 14px 4px 8px; }
.graph-corner.br { bottom: 10px; right: 14px; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); padding: 4px 8px 8px 14px; }
.graph-corner b { color: var(--accent-cyan); }

.graph-help {
  position: absolute;
  bottom: 14px; left: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  z-index: 3;
  pointer-events: none;
}

/* SVG node styles */
.node circle {
  cursor: pointer;
  transition: filter 0.2s, stroke 0.2s;
}
.node circle:hover { filter: drop-shadow(0 0 12px var(--accent-cyan)); }
.node text {
  pointer-events: none;
  font-family: var(--font);
  fill: var(--text-primary);
  font-size: 10px;
  letter-spacing: 1px;
  text-anchor: middle;
  user-select: none;
}
.link {
  stroke: rgba(77, 210, 255, 0.22);
  stroke-width: 1;
  transition: stroke 0.2s, stroke-width 0.2s;
}
.link.active { stroke: var(--accent-cyan); stroke-width: 2; }
.node.selected circle {
  stroke: var(--accent-amber) !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 18px rgba(255, 185, 85, 0.8));
}
.node.dimmed { opacity: 0.15; }
.link.dimmed { opacity: 0.05; }

/* ====== DETAIL PANEL ====== */
.detail-panel {
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  overflow-y: auto;
  padding: 22px 22px 60px 22px;
  position: relative;
}
.detail-panel .empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-align: center;
  font-size: 13px;
}
.detail-panel .empty .big {
  font-family: var(--font);
  font-size: 28px;
  letter-spacing: 5px;
  color: var(--accent-cyan);
  margin-bottom: 18px;
  text-shadow: 0 0 18px var(--accent-cyan-glow);
}
.detail-card .type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 3px 8px;
  border-radius: 2px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.detail-card h2 {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
  text-shadow: 0 0 16px var(--accent-cyan-glow);
}
.detail-card .short {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-style: italic;
  border-left: 2px solid var(--accent-cyan);
  padding-left: 10px;
}
.section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.section h4 {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-amber);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase;
}
.section h4::before { content: "▌"; color: var(--accent-amber); }
.section p, .section li { color: var(--text-secondary); font-size: 13px; }
.section .body { color: var(--text-primary); white-space: pre-wrap; }
.section ul { list-style: none; padding-left: 0; }
.section ul li {
  padding: 6px 10px;
  margin-bottom: 4px;
  background: rgba(255, 85, 119, 0.06);
  border-left: 2px solid var(--accent-red);
  font-size: 12px;
}
.section.questions ul li {
  background: rgba(77, 210, 255, 0.06);
  border-left: 2px solid var(--accent-cyan);
  color: var(--text-primary);
  cursor: pointer;
}
.section.questions ul li:hover { background: rgba(77, 210, 255, 0.15); }
.section.related .chips, .section.roles .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.section .chip {
  display: inline-block;
  background: rgba(77, 210, 255, 0.10);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}
.section .chip:hover { background: var(--accent-cyan); color: #001122; border-color: var(--accent-cyan); }
.section.salespitch .pitch {
  background: rgba(255, 185, 85, 0.06);
  border: 1px solid rgba(255, 185, 85, 0.4);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.6;
  border-radius: 2px;
  position: relative;
}
.section.salespitch .pitch::before {
  content: "◆";
  position: absolute;
  top: 10px; right: 12px;
  color: var(--accent-amber);
}

.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  border-radius: 2px;
}
.copy-btn:hover { background: var(--accent-cyan); color: #001122; }

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  width: 720px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 0 60px rgba(77, 210, 255, 0.3);
  position: relative;
}
.modal h2 {
  font-family: var(--font);
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}
.modal .modal-sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }
.modal-close {
  position: absolute; top: 16px; right: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  font-size: 18px;
  width: 32px; height: 32px;
  cursor: pointer;
  border-radius: 2px;
}
.modal-close:hover { background: rgba(77, 210, 255, 0.15); }
.q-item {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: rgba(77, 210, 255, 0.04);
  border-left: 2px solid var(--accent-cyan);
}
.q-item .q {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}
.q-item .good { color: var(--accent-green); font-size: 12px; margin-bottom: 2px; }
.q-item .good::before { content: "✓ "; }
.q-item .bad { color: var(--accent-red); font-size: 12px; margin-bottom: 2px; }
.q-item .bad::before { content: "✗ "; }
.q-item .interp { color: var(--text-secondary); font-size: 12px; font-style: italic; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.q-item .interp::before { content: "💡 "; }

/* type-badge colors */
.type-concept { background: rgba(77, 210, 255, 0.15); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }
.type-role { background: rgba(102, 255, 178, 0.15); color: var(--accent-green); border: 1px solid var(--accent-green); }
.type-tool { background: rgba(255, 102, 204, 0.15); color: var(--accent-magenta); border: 1px solid var(--accent-magenta); }
.type-regulation { background: rgba(255, 85, 119, 0.15); color: var(--accent-red); border: 1px solid var(--accent-red); }

/* Print Pitch */
.pitch-modal pre {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  background: rgba(255, 185, 85, 0.05);
  border: 1px solid rgba(255, 185, 85, 0.4);
  padding: 16px 18px;
  white-space: pre-wrap;
  line-height: 1.7;
  border-radius: 2px;
}

/* Loading */
.loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  font-family: var(--font);
  letter-spacing: 4px;
  color: var(--accent-cyan);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel-solid);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 10px 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  z-index: 200;
  box-shadow: 0 0 24px rgba(102, 255, 178, 0.3);
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Search dropdown */
.search-results {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px; max-width: 80vw;
  background: var(--bg-panel-solid);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 8px 32px rgba(77, 210, 255, 0.25);
  max-height: 400px;
  overflow-y: auto;
  z-index: 50;
}
.search-results .result {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.search-results .result:hover { background: rgba(77, 210, 255, 0.12); }
.search-results .result .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-left: 8px;
}

/* Scrollbar */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
*::-webkit-scrollbar-thumb { background: rgba(77, 210, 255, 0.3); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* Responsiveness */
@media (max-width: 1200px) {
  .main { grid-template-columns: 220px 1fr 360px; }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 200px 1fr 250px; }
  .sidebar-left { display: none; }
}

/* PROBLEM-ROWS im Detail-Panel (klickbar -> Probleme-Board) */
.problems-list-inline {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.problem-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: rgba(255, 85, 119, 0.04);
  border-left: 2px solid rgba(255, 85, 119, 0.35);
  border-radius: 1px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.problem-row:hover {
  background: rgba(255, 85, 119, 0.1);
  border-left-color: #ff5577;
  transform: translateX(2px);
}
.problem-row.highlight {
  background: linear-gradient(90deg, rgba(255, 85, 119, 0.18), rgba(255, 85, 119, 0.06));
  border-left-color: #ff5577;
  box-shadow: 0 0 0 1px rgba(255, 85, 119, 0.3), 0 0 12px rgba(255, 85, 119, 0.2);
}
.problem-row.flash { animation: rowFlash 1.5s ease-in-out 2; }
@keyframes rowFlash {
  0%, 100% { background: rgba(255, 85, 119, 0.06); }
  50% { background: rgba(255, 85, 119, 0.3); box-shadow: 0 0 16px rgba(255, 85, 119, 0.5); }
}
.problem-bullet {
  color: #ff5577;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 0 6px #ff5577;
  flex-shrink: 0;
}
.problem-label {
  flex: 1; color: #e6f1ff; font-size: 12px; line-height: 1.4;
}
.problem-open {
  color: #ff5577; text-decoration: none; font-size: 14px;
  padding: 2px 6px; border: 1px solid transparent; border-radius: 2px;
  opacity: 0.6; transition: all 0.15s;
}
.problem-row:hover .problem-open {
  opacity: 1; border-color: rgba(255, 85, 119, 0.45);
  text-shadow: 0 0 6px #ff5577;
}

/* Problem-Badge im Graph (rotes Hexagon) */
.problem-badge { animation: badgePulse 2.5s ease-in-out infinite; transform-origin: center; }
@keyframes badgePulse {
  0%, 100% { filter: drop-shadow(0 0 4px #ff5577); }
  50% { filter: drop-shadow(0 0 10px #ff5577); }
}
