/**
 * rezept.css — Rezepte 3-Panel Workbench Layout
 * Modul: public/assets/js/modules/rezept.js
 * v1.1 W-Make Batch - JMW
 */

/* ── 3-Panel Workbench ───────────────────────────────────────────────────── */
.rez-workbench {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-height: 500px;
  background: var(--bg1);
}

@media (max-width: 1100px) {
  .rez-workbench {
    grid-template-columns: 200px 1fr 240px;
  }
}

@media (max-width: 820px) {
  .rez-workbench {
    grid-template-columns: 1fr;
  }
}

/* ── Listen-Panel (links) ────────────────────────────────────────────────── */
.rez-list-pane {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rez-list-search {
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--t1);
  box-sizing: border-box;
  margin-bottom: 8px;
  outline: none;
  transition: border-color var(--trans-fast);
}

.rez-list-search:focus {
  border-color: var(--accent-border);
}

.rez-list-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.rez-list-item {
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--trans-fast);
  user-select: none;
}

.rez-list-item.active {
  background: rgba(108, 143, 255, .15);
  color: var(--accent);
  font-weight: 700;
}

.rez-list-item:hover:not(.active) {
  background: var(--bg3);
}

.rez-li-badge {
  font-size: 9px;
  background: rgba(108, 143, 255, .15);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.rez-li-farbe {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Editor-Panel (Mitte) ────────────────────────────────────────────────── */
.rez-editor-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg1);
  min-width: 0;
}

.rez-editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rez-editor-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rez-editor-key {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--t4);
}

.rez-dirty-dot {
  font-size: 10px;
  color: var(--warn);
  flex-shrink: 0;
}

.rez-editor-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  background: var(--bg2);
  flex-shrink: 0;
}

.rez-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--t3);
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: color var(--trans-fast), border-color var(--trans-fast);
  white-space: nowrap;
}

.rez-tab-btn:hover {
  color: var(--t1);
  background: var(--bg3);
}

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

.rez-tab-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.rez-editor-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  background: var(--bg2);
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
}

/* ── Preview-Panel (rechts) ──────────────────────────────────────────────── */
.rez-preview-pane {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  background: var(--bg2);
  padding: 14px;
}

.rez-prev-section {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.rez-prev-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.rez-prev-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--t3);
  font-weight: 700;
  margin-bottom: 8px;
}

.rez-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
}

.rez-stat-label {
  color: var(--t3);
}

.rez-stat-value {
  font-weight: 600;
  font-family: var(--mono);
  color: var(--t1);
}

/* Oxide-Balken */
.rez-oxide-row {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  gap: 6px;
  align-items: center;
  margin-bottom: 5px;
}

.rez-oxide-bar-bg {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.rez-oxide-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
  background: var(--accent);
}

.rez-oxide-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--t2);
}

.rez-oxide-val {
  font-size: 10px;
  text-align: right;
  font-family: var(--mono);
  color: var(--t2);
}

/* Silo-Status */
.rez-silo-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 0;
  color: var(--t2);
}

.rez-silo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rez-silo-dot.ok   { background: #2ecc71; }
.rez-silo-dot.warn { background: #f39c12; }
.rez-silo-dot.crit { background: #e74c3c; }
.rez-silo-dot.none { background: var(--t4); }

/* Redox-Anzeige */
.rez-redox-display {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--mono);
  text-align: center;
  padding: 8px 0;
}

.rez-redox-ok   { color: var(--success); }
.rez-redox-warn { color: var(--warn); }
.rez-redox-crit { color: var(--error); }

.rez-scale-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.rez-scale-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--t2);
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  transition: border-color var(--trans-fast), color var(--trans-fast);
}

.rez-scale-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ── Zutaten-Tabelle: Silo-Ampel ─────────────────────────────────────────── */
.rez-zutat-ampel {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.rez-zutat-ampel.ok   { background: #2ecc71; }
.rez-zutat-ampel.warn { background: #f39c12; }
.rez-zutat-ampel.crit { background: #e74c3c; }
.rez-zutat-ampel.none { background: var(--t4); }

/* ── Glasfarbe Pills ─────────────────────────────────────────────────────── */
.rez-farbe-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rez-farbe-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg3);
  color: var(--t2);
  transition: border-color var(--trans-fast), color var(--trans-fast), background var(--trans-fast);
  display: flex;
  align-items: center;
  gap: 5px;
}

.rez-farbe-pill:hover {
  background: var(--bg4);
  color: var(--t1);
}

.rez-farbe-pill.active {
  font-weight: 700;
  color: var(--t1);
  background: var(--bg4);
}

/* ── Verlauf (History) ───────────────────────────────────────────────────── */
.rez-hist-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line2);
  font-size: 12px;
}

.rez-hist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 3px;
}

.rez-hist-text {
  color: var(--t2);
  flex: 1;
}

.rez-hist-ts {
  font-size: 10px;
  color: var(--t4);
  white-space: nowrap;
}

/* ── Leer-Zustände ───────────────────────────────────────────────────────── */
.rez-empty-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--t3);
  text-align: center;
  min-height: 200px;
  font-size: 13px;
  padding: 24px;
}

/* ── Schritt-Editor Karten (Kompatibilität) ──────────────────────────────── */
.rez-step-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.rez-step-header {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg3);
  cursor: pointer;
  user-select: none;
}

.rez-step-header:hover {
  background: var(--bg2);
}

.rez-step-body {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: none;
}

.rez-step-body.open {
  display: block;
}

/* ── Delta-Spalte in Schritt-Zutaten ─────────────────────────────────────── */
.step-delta-pos {
  color: var(--success);
  font-weight: 700;
  font-family: var(--mono);
}

.step-delta-neg {
  color: var(--error);
  font-weight: 700;
  font-family: var(--mono);
}

.step-delta-eq {
  color: var(--t4);
  font-family: var(--mono);
}

.step-zutat-changed {
  background: rgba(255, 200, 68, .06);
}

/* ── Formular-Helfer (innerhalb Tab-Body) ────────────────────────────────── */
.rez-form-label {
  font-size: 10px;
  color: var(--t3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
  display: block;
}

.rez-form-hint {
  font-size: 10px;
  color: var(--t4);
  margin-top: 3px;
  display: block;
}

/* ── Redox-Alarm Balken (Preview) ────────────────────────────────────────── */
.rez-alarm-bar-wrap {
  position: relative;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.rez-alarm-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
}
