/* ============================================================================
   style.css — Engineering-Dark-Theme für das Strahlschlaufenreaktor-Modell
   ============================================================================ */
:root {
  --bg: #0b0f14;
  --panel: #101723;
  --panel2: #15202e;
  --border: #243446;
  --text: #d6e2ee;
  --dim: #7e93a8;
  --accent: #53b0e8;
  --good: #4cc38a;
  --warn: #c9a227;
  --bad: #e5534b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 13px;
  overflow: hidden;
}

/* ------------------------------------------------------------------ Header */
header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
h1 { font-size: 17px; font-weight: 600; letter-spacing: 0.3px; }
h1 .sub { color: var(--dim); font-weight: 400; font-size: 14px; }
.reaction { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.reaction .arrow { color: var(--accent); }
.header-controls { display: flex; gap: 14px; align-items: center; }
.chk { color: var(--dim); font-size: 12px; cursor: pointer; user-select: none; }
button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ Layout */
main {
  display: grid;
  grid-template-columns: 305px 1fr 360px;
  height: calc(100% - 58px);
}
aside {
  background: var(--panel);
  overflow-y: auto;
  padding: 12px 14px 40px;
}
#left-panel { border-right: 1px solid var(--border); }
#right-panel { border-left: 1px solid var(--border); }
aside h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--dim);
  margin: 14px 0 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}
aside::-webkit-scrollbar { width: 8px; }
aside::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ------------------------------------------------------------------ Parameter */
.param { margin-bottom: 14px; }
.param-head { display: flex; justify-content: space-between; align-items: baseline; }
.param-head label { font-size: 12.5px; }
.param-val { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.param input[type="range"] {
  width: 100%;
  margin: 6px 0 4px;
  accent-color: var(--accent);
  cursor: pointer;
}
.param-hint { font-size: 11px; color: var(--dim); line-height: 1.45; }

/* ------------------------------------------------------------------ Warnungen */
.warning {
  border-left: 3px solid var(--warn);
  background: var(--panel2);
  border-radius: 0 6px 6px 0;
  padding: 7px 9px;
  margin-bottom: 7px;
  font-size: 11.5px;
  line-height: 1.45;
}
.warning.err { border-color: var(--bad); }
.warning.ok { border-color: var(--good); color: var(--dim); }

/* ------------------------------------------------------------------ Viewport */
#viewport-wrap { position: relative; }
#viewport { position: absolute; inset: 0; }
#viewport canvas { display: block; }
#tooltip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 1px 4px #000;
}
#viewport-hint {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 11px;
  color: var(--dim);
  pointer-events: none;
  line-height: 1.5;
}
#viewport-hint .dim { opacity: 0.7; }

/* ------------------------------------------------------------------ Ergebnisse */
.res-group { margin-bottom: 16px; }
.res-group h3 {
  font-size: 11.5px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}
.res-group table { width: 100%; border-collapse: collapse; }
.res-group td {
  padding: 3px 0;
  font-size: 12px;
  border-bottom: 1px solid #1a2533;
  color: var(--dim);
  line-height: 1.4;
}
.res-group td.res-val {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 8px;
}
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); font-weight: 700; }

/* Widerstandsbalken */
#resistance-bar { margin-top: 10px; }
.bar-label { font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.bar-track {
  height: 14px;
  border-radius: 7px;
  background: var(--good);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--warn);
  transition: width 0.15s;
}
.bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  margin-top: 3px;
}
.bar-legend span:first-child { color: var(--warn); }
.bar-legend span:last-child { color: var(--good); }

/* Diagramm */
#chart { width: 100%; height: 170px; background: var(--panel2); border-radius: 6px; }

/* ------------------------------------------------------------------ Info-Panel */
#info-panel {
  position: fixed;
  left: 50%;
  bottom: -100%;
  transform: translateX(-50%);
  width: min(760px, 92vw);
  max-height: 56vh;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  transition: bottom 0.25s ease;
  display: flex;
  flex-direction: column;
  z-index: 50;
}
#info-panel.open { bottom: 0; }
#info-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 8px;
  border-bottom: 1px solid var(--border);
}
#info-head h2 { font-size: 15px; color: var(--accent); }
#info-close { padding: 2px 9px; font-size: 14px; }
#info-body {
  overflow-y: auto;
  padding: 14px 18px 20px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
}
#info-body p { margin-bottom: 10px; }
#info-body b { color: var(--accent); }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 11.5px; }
.doc-table th, .doc-table td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}
.doc-table th { background: var(--panel); color: var(--dim); }

/* ------------------------------------------------------------------ Schmale Bildschirme */
@media (max-width: 1100px) {
  main { grid-template-columns: 270px 1fr 310px; }
}
@media (max-width: 860px) {
  html, body { overflow: auto; }
  main { display: block; height: auto; }
  #viewport-wrap { height: 60vh; position: relative; }
  aside { border: none !important; }
}
