/**
 * satz.css — Satzzettel-Tabelle, Tab-Nav, Oxide-Chips, Mini-History,
 *             Massenbilanz, Physik-KPI, Wasser-Zeile, LOI-Badge
 * Modul: public/assets/js/modules/satz.js
 * v6.3 CSS-MODULARISIERUNG
 */

/* ── Tab-Navigation (Satz-Tabs: Satzzettel | Oxide | Redox) ─────────────── */
.satz-tab-row {
  display: flex;
  gap: 4px;
  margin: 8px 0 0;
  border-bottom: 2px solid var(--line);
}

.satz-tab-btn {
  padding: 6px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--t2);
  cursor: pointer;
  font-size: .9rem;
  margin-bottom: -2px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color .15s, border-color .15s;
}

.satz-tab-btn:hover  { color: var(--t1); }

.satz-tab-btn.active {
  color: var(--acc);
  border-bottom-color: var(--acc);
  font-weight: 700;
}

.satz-spektral-inline { margin-bottom: 8px; }

/* ── Physik-KPI-Row ──────────────────────────────────────────────────────── */
.phys-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.phys-kpi {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.pkpi-val { font-size: 1.2rem; font-weight: 700; font-family: var(--mono); color: var(--acc); }
.pkpi-lbl { font-size: .72rem; color: var(--t3); margin-top: 2px; text-align: center; }

/* ── Oxide-Vergleichstabelle ─────────────────────────────────────────────── */
.oxide-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: .87rem;
}

.oxide-compare-table th,
.oxide-compare-table td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
}

.oxide-compare-table thead th {
  font-size: .78rem;
  color: var(--t3);
  font-weight: 600;
}

.oxide-compare-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--line);
  border-bottom: none;
}

.oxide-compare-table input.ziel-ox-input {
  width: 72px;
  text-align: right;
  font-family: var(--mono);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--t1);
  padding: 1px 4px;
}

.oxide-compare-table input.ziel-ox-input:focus {
  border-color: var(--acc);
  outline: none;
}

/* ── Satz-Scale-Bar (Zielgewicht-Steuerung) ─────────────────────────────── */
.satz-scale-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 12px;
}

.satz-scale-bar label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--t3);
  font-size: 12px;
  margin: 0;
}

.inp-satz-ziel {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--t1);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 7px;
  width: 88px;
  text-align: right;
}

.inp-satz-ziel:focus {
  outline: none;
  border-color: var(--accent);
}

.scale-factor-display {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
}

.satz-scale-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ── Prozentuale Skalierung ──────────────────────────────────────────────── */
.satz-pct-block {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inp-satz-pct {
  background: var(--bg3);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 7px;
  width: 62px;
  text-align: right;
}
.inp-satz-pct:focus {
  outline: none;
  border-color: var(--accent);
}

.satz-pct-presets {
  display: flex;
  gap: 3px;
  align-items: center;
}

.satz-pct-btn {
  padding: 3px 7px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--t2);
  cursor: pointer;
  transition: background var(--trans-fast), color var(--trans-fast), border-color var(--trans-fast);
  line-height: 1.4;
  white-space: nowrap;
}
.satz-pct-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-border);
}
.satz-pct-btn--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.satz-pct-btn--delta {
  border-color: var(--line);
  color: var(--t3);
  font-size: 12px;
  padding: 3px 6px;
}
.satz-pct-btn--delta:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}
.satz-pct-display {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  min-width: 38px;
  text-align: right;
}

/* ── +/− Step-Buttons neben NEU-Eingabe ──────────────────────────────────── */
.satz-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.satz-step-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--t2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--trans-fast), color var(--trans-fast);
  flex-shrink: 0;
  touch-action: manipulation;
}

.satz-step-btn:hover  { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent-border); }
.satz-step-btn:active { transform: scale(.92); }

/* ── Oxide-Übersicht Chips ───────────────────────────────────────────────── */
.satz-oxide-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}

.ox-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: filter var(--trans-fast);
  cursor: default;
}

.ox-chip:hover  { filter: brightness(1.15); }
.ox-chip-d      { font-size: 10px; opacity: .75; }
.ox-chip-ok     { background: var(--success-subtle); border-color: var(--success-border); color: var(--success); }
.ox-chip-warn   { background: var(--warn-subtle);    border-color: var(--warn-border);    color: var(--warn); }
.ox-chip-err    { background: var(--error-subtle);   border-color: var(--error-border);   color: var(--error); }
.ox-chip-neutral { background: var(--bg3); border-color: var(--line); color: var(--t3); }
.ox-chip-redox  { background: var(--accent-subtle);  border-color: var(--accent-border);  color: var(--accent); }

/* ── Option C: Oxide-Chip Flash + Δ-Badge ───────────────────────────────── */

@keyframes oxFlashUp {
  0%   { box-shadow: 0 0 0 3px var(--success); background: var(--success-subtle); }
  60%  { box-shadow: 0 0 0 2px var(--success); }
  100% { box-shadow: none; }
}

@keyframes oxFlashDn {
  0%   { box-shadow: 0 0 0 3px var(--error); background: var(--error-subtle); }
  60%  { box-shadow: 0 0 0 2px var(--error); }
  100% { box-shadow: none; }
}

@keyframes oxDeltaFade {
  0%   { opacity: 1; transform: translateY(0); }
  70%  { opacity: .8; transform: translateY(-2px); }
  100% { opacity: 0; transform: translateY(-4px); }
}

.ox-chip-flash-up { animation: oxFlashUp 1.2s ease-out forwards; }
.ox-chip-flash-dn { animation: oxFlashDn 1.2s ease-out forwards; }

.ox-chip-chg {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--mono);
  opacity: 1;
  animation: oxDeltaFade 3s ease-out 0.2s forwards;
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* ── Änderungslog Bar ────────────────────────────────────────────────────── */
.satz-log-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
  margin-top: 6px;
}

.log-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  vertical-align: middle;
  margin-left: 2px;
}

/* ── Mini-History Panel ──────────────────────────────────────────────────── */
.satz-mini-history {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.mh-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line2);
  font-size: 12px;
  transition: background var(--trans-fast);
}

.mh-entry:last-child { border-bottom: none; }
.mh-entry:hover { background: var(--bg3); }
.mh-wissen      { background: var(--accent-subtle); }
.mh-wissen:hover { background: var(--accent-subtle); filter: brightness(1.08); }
.mh-ausfall     { background: var(--warn-subtle); }

.mh-time     { font-family: var(--mono); color: var(--t3); font-size: 10px; flex-shrink: 0; width: 58px; }
.mh-label    { flex: 1; font-weight: 500; color: var(--t2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-oxid-delta { font-family: var(--mono); font-size: 10px; color: var(--t3); flex-shrink: 0; text-align: right; }
.mh-empty    { color: var(--t3); font-style: italic; font-size: 12px; padding: 10px 12px; }

/* ── Wasser-Zeile in Satztabelle ─────────────────────────────────────────── */
.row-wasser td {
  background: rgba(91, 200, 245, .06);
  border-top: 1px solid rgba(91, 200, 245, .2);
  font-size: 12px;
  padding: 6px 8px;
}

.row-wasser { font-style: italic; }

/* ── Rohstoff-Ausfall Modal ──────────────────────────────────────────────── */
.ausfall-header {
  font-size: 11px;
  color: var(--t3);
  padding: 6px 0 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ausfall-alt-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: default;
  transition: border-color var(--trans-fast), background var(--trans-fast);
}

.ausfall-alt-card:hover { border-color: var(--accent-border); background: var(--bg4); }

.ausfall-alt-top  { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.ausfall-alt-name { font-weight: 600; font-size: 13px; color: var(--t1); }

.ausfall-match-badge {
  font-size: 10px; font-family: var(--mono); font-weight: 700;
  padding: 1px 6px; border-radius: 10px; border: 1px solid transparent;
}

.ausfall-alt-kg   { font-family: var(--mono); font-size: 12px; color: var(--t2); flex-shrink: 0; }
.ausfall-alt-meta { font-size: 10px; color: var(--t3); margin-top: 1px; font-family: var(--mono); }

.ausfall-apply-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-sm);
  color: var(--accent);
  cursor: pointer;
  transition: background var(--trans-fast);
}

.ausfall-apply-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Massenbilanz-Panel ──────────────────────────────────────────────────── */
.massenbilanz-card { padding: 14px 16px; }

.mb-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mb-flow     { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-family: var(--mono); }
.mb-row      { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.mb-row.mb-input  { color: var(--t1); font-weight: 700; }
.mb-row.mb-loss   { color: var(--t3); padding-left: 16px; }
.mb-row.mb-result { color: var(--success); font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.mb-row.mb-kpi    { color: var(--accent); }
.mb-label    { flex: 1; }
.mb-val      { text-align: right; min-width: 90px; }
.mb-unit     { color: var(--t4); min-width: 30px; font-size: 10px; }
.mb-side     { color: var(--t4); font-size: 10px; flex: 1; text-align: right; padding-left: 8px; }
.mb-grid     { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Wasser-Summenzeile in Satztabelle ───────────────────────────────────── */
.row-wasser-lbl { color: var(--water); font-size: 11px; font-weight: 600; padding: 4px 8px; }
.row-wasser-dim { color: var(--t4);    font-size: 11px; font-family: var(--mono); }
.row-wasser-ges { color: var(--water); font-weight: 700; font-family: var(--mono); }

/* ── Reichweite-in-Chargen (Satztabelle Bestand-Spalte) ─────────────────── */
.td-reichw      { font-size: 10px; color: var(--t3); margin-top: 2px; font-family: var(--mono); letter-spacing: .02em; }
.td-reichw.few  { color: var(--warn);  font-weight: 700; }
.td-reichw.crit { color: var(--error); font-weight: 700; }

/* ── LOI-Badge in Satztabelle ────────────────────────────────────────────── */
.loi-badge {
  display: inline-block;
  font-size: 9px;
  color: var(--t2);
  background: var(--bg4);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
  font-family: var(--mono);
  letter-spacing: .01em;
}
