/* ═══════════════════════════════════════════════════════════════════════════
   sim.css  –  LeSim Simulation Page Stylesheet
   Layout-Größen (Breiten, Plot-Höhen) werden per Inline-Style in index.html
   gesetzt. Diese Datei regelt nur Farben, Typografie und Struktur.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Global Resets ─────────────────────────────────────────────────────────── */
html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:       #ffffff;
  --surface:  #ffffff;
  --card:     #f0f2f6;
  --border:   #c8cdde;
  --text:     #111318;
  --muted:    #555e75;
  --accent:   #1a4fc4;
  --ok:       #166534;
  --warn:     #991b1b;
  --radius:   4px;
  --font:     'Segoe UI', system-ui, sans-serif;
  --font-mono:'Consolas', monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #111318;
    --surface: #1c1f28;
    --card:    #242836;
    --border:  #333848;
    --text:    #e8eaf2;
    --muted:   #8890aa;
    --accent:  #6b9fff;
    --ok:      #4ade80;
    --warn:    #f87171;
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.sim-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .65rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.sim-header h1 { font-size: .95rem; font-weight: 700; }
.sim-header p  { font-size: .8rem; color: var(--text); margin-left: auto; }

.badge {
  font-size: .65rem; font-weight: 700; letter-spacing: .06em;
  padding: .1rem .45rem; border-radius: 3px;
  background: var(--card); color: var(--accent);
  border: 1px solid var(--border);
  text-transform: uppercase;
}

/* ── Seiten-Layout ───────────────────────────────────────────────────────── */
.sim-page {
  display: flex;
  gap: 1.2rem;
  padding: 1.2rem 1.5rem;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* Steuerleiste */
#sim-ctrl { flex: 0 0 180px; position: sticky; top: 1rem; }

.sim-ctrl {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  font-size: .78rem;
  color: var(--text);
}

/* Hauptinhalt */
.sim-main { 
  flex: 1; 
  min-width: 0; 
  display: block;
  width: 100%;
  box-sizing: border-box;
  gap: 1rem;
}

/* ── sim-top ────────────────────────────────────────────────────────────── */
.sim-top {
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
}

/* Beschreibungstext */
.sim-desc {
  font-size: .84rem;
  color: var(--text);
  line-height: 1.7;
}
.sim-desc h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.sim-desc p {
  text-align: justify;
  line-height: 1.5;
}
.sim-desc p + p   { margin-top: .5rem; }
.sim-desc a       { color: var(--accent); text-decoration: none; }
.sim-desc a:hover { text-decoration: underline; }
.sim-desc strong  { color: var(--text); font-weight: 600; }
.sim-desc ul {
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.sim-desc ul li {
  margin-bottom: 0.3em;
}

/* Schaltplan */
#LeSim1 {
  position: relative;
  border: 1px solid #c8a020;
  border-radius: var(--radius);
  background: var(--surface);
  float: right;
  margin-left: 1.2rem;
  flex-shrink: 0;
}

/* ── Steuerleiste – Elemente ─────────────────────────────────────────────── */
.progress-wrap {
  height: 3px;
  background: var(--card);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .15s ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--text);
  margin-top: .15rem;
}

.btn-row { display: flex; gap: .35rem; flex-wrap: wrap; }

button {
  font-family: var(--font);
  font-size: .77rem; font-weight: 600;
  padding: .28rem .6rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:hover                       { background: var(--card); }
#StartSimuBtn                      { background: var(--accent); color: #fff; border-color: var(--accent); }
#StartSimuBtn:hover:not(:disabled) { filter: brightness(1.1); }
#StartSimuBtn:disabled             { opacity: .4; cursor: not-allowed; }
#ClearSimBtn                       { color: var(--warn); border-color: currentColor; background: transparent; }
#ClearSimBtn:hover                 { background: var(--card); }
.btn-secondary                     { color: var(--text); font-weight: 400; font-size: .72rem; }

.param-row { display: flex; align-items: center; gap: .4rem; }

input[type="number"] {
  font-family: var(--font-mono); font-size: .77rem;
  width: 66px; padding: .22rem .38rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
}
input:focus { outline: none; border-color: var(--accent); }

select {
  font-family: var(--font); font-size: .74rem;
  width: 100%; padding: .22rem .38rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
}

.add-block-label { font-size: .68rem; color: var(--text); }

#statistic {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text);
  line-height: 1.45;
  opacity: .7;
}

.props-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
#ElmPropsTable            { width: 100%; border-collapse: collapse; font-size: .78rem; }
#ElmPropsTable th         { color: var(--text); font-weight: 600; padding: .1rem .4rem;
                            border-bottom: 1px solid var(--border); text-align: left; }
#ElmPropsTable td         { padding: .1rem .4rem; }

.sim-error {
  display: none;
  padding: .35rem .55rem;
  border: 1px solid var(--warn);
  border-radius: 3px;
  font-size: .74rem;
  color: var(--warn);
}

/* ── Diagramme ───────────────────────────────────────────────────────────── */
.diagrams { display: flex; flex-direction: column; gap: .4rem; }

.plot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.plot-title {
  font-size: .67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text);
  padding: .28rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .sim-page          { flex-direction: column; padding: .8rem 1rem; }
  #sim-ctrl          { position: static; flex: none; width: 100%; }
  .sim-top           { clear: both; }
  #LeSim1            { width: 100% !important; float: none; }
  .sim-desc          { width: 100%; }
}