/* OneBrain Web-App — das Fenster, nicht das System.
   Bewusst zurückhaltend: keine externen Fonts/CDN-Ressourcen geladen
   (Produktprinzip "100% lokal, keine Cloud" gilt auch fürs Frontend). */

:root {
  --bg: #14161a;
  --panel: #1c1f26;
  --panel-border: #2a2e38;
  --text: #e4e6eb;
  --text-muted: #8b92a3;
  --accent: #5fa8d3;
  --accent-dim: #3d6b85;
  --edge: #3a3f4b;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--panel-border);
  position: relative;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--accent);
}

#search-box {
  flex: 1;
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

#search-box:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#search-results {
  position: absolute;
  top: 100%;
  left: 5.5rem;
  width: 320px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
}

#search-results:empty {
  display: none;
}

#search-results li {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--panel-border);
}

#search-results li:last-child {
  border-bottom: none;
}

#search-results li:hover {
  background: var(--accent-dim);
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#graph-panel {
  flex: 1;
  position: relative;
}

#graph-svg {
  display: block;
}

.node circle {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2px;
  cursor: pointer;
  transition: r 0.15s ease, fill 0.15s ease;
}

.node:hover circle {
  fill: #ffffff;
  r: 8;
}

.node text {
  fill: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  pointer-events: none;
}

.edge {
  stroke: var(--edge);
  stroke-width: 1px;
}

#note-panel {
  width: 380px;
  flex-shrink: 0;
  border-left: 1px solid var(--panel-border);
  background: var(--panel);
  padding: 1.25rem;
  overflow-y: auto;
}

#note-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#note-title {
  margin-top: 0;
  font-size: 1rem;
  color: var(--accent);
}

#note-content {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

#note-title:empty,
#note-content:empty {
  display: none;
}

#api-key-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#api-key-overlay.hidden {
  display: none;
}

#api-key-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 1.5rem;
  width: 320px;
}

#api-key-box p {
  margin-top: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#api-key-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

#api-key-submit {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

#api-key-submit:hover {
  background: #7dbce0;
}

@media (max-width: 700px) {
  main {
    flex-direction: column;
  }
  #note-panel {
    width: 100%;
    max-height: 40vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .node circle {
    transition: none;
  }
}
