/* flow.css — Styles für die Flow-Ansicht */

/* ── Split-Layout ───────────────────────────────────────────── */
.flow-layout {
  display: flex;
  height: calc(100vh - 130px);
}

.flow-sidebar {
  width: 200px;
  min-width: 160px;
  flex-shrink: 0;
  border-right: 1px solid #1e293b;
  overflow-y: auto;
  padding: 8px 0;
}

.flow-diagram {
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px;
}

/* ── Prozessliste ───────────────────────────────────────────── */
.flow-proc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}

.flow-proc-item:hover {
  background: #1e293b;
  color: #cbd5e1;
}

.flow-proc-item.active {
  background: #0f172a;
  border-left-color: #60a5fa;
  color: #f8fafc;
}

.flow-proc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-trigger-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.flow-trigger-extern      { background: #1e3a5f; color: #60a5fa; }
.flow-trigger-intern      { background: #1a2e1a; color: #4ade80; }
.flow-trigger-zeitbasiert { background: #2d1f00; color: #fbbf24; }

/* ── Diagramm ───────────────────────────────────────────────── */
.flow-chain {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Kurze Verbindungslinie: Elternknoten → Branch-Track */
.flow-branch-stub {
  width: 1px;
  height: 14px;
  background: #475569;
  margin-left: 36px;
}

/* Branch-Track: vertikale Linie (::before) + Kindschritte nebeneinander */
.flow-branch-track {
  display: flex;
  align-items: stretch;
  padding-bottom: 6px;
}

.flow-branch-track::before {
  content: '';
  display: block;
  width: 1px;
  background: #475569;
  flex-shrink: 0;
  margin: 0 18px 0 36px;
}

.flow-branch-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2px 0;
}

/* Pfeil zwischen Schritten */
.flow-arrow {
  color: #475569;
  font-size: 18px;
  line-height: 1;
  margin: 4px 0 4px 0;
  padding-left: 4px;
  user-select: none;
}

.flow-arrow-child {
  padding-left: 0;
}

/* ── Schritt-Node ───────────────────────────────────────────── */
.flow-step-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.flow-node {
  position: relative;
  display: inline-block;
  margin: 4px 0;
}

/* ── Schritt-Shape: Normal ──────────────────────────────────── */
.flow-type-normal .flow-node-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 8px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
}

/* ── Schritt-Shape: Verzweigung (Raute) ─────────────────────── */
.flow-type-verzweigung {
  /* Extra Platz für die rotierte Form */
  margin: 16px 0;
}

.flow-type-verzweigung .flow-node-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  min-width: 0;
  background: #0e2218;
  border: 2px solid #4ade80;
  color: #86efac;
  border-radius: 4px;
  transform: rotate(45deg);
  margin: 0 20px;
}

.flow-type-verzweigung .flow-node-label {
  display: block;
  transform: rotate(-45deg);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  max-width: 88px;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.4;
}

/* ── Schritt-Shape: Eskalation ──────────────────────────────── */
.flow-type-eskalation .flow-node-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 8px 16px;
  background: #200a0a;
  border: 2px solid #ef4444;
  border-radius: 4px;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

/* Fallback für unbekannte step_type */
.flow-node-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 8px 16px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
}

/* ── Tooltip (hover, rechts neben dem Node) ─────────────────── */
.flow-tooltip {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  transform: translateY(-50%);
  width: max-content;
  max-width: 480px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
  padding: 8px 12px;
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
  z-index: 100;
}

.flow-node:hover .flow-tooltip {
  display: block;
}

/* ── Mode-Toggle (form-row) ─────────────────────────────────── */
.flow-mode-toggle {
  display: flex;
  gap: 4px;
}

.flow-mode-btn {
  background: transparent;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.flow-mode-btn:hover {
  border-color: #475569;
  color: #94a3b8;
}

.flow-mode-btn.active {
  background: #1e293b;
  border-color: #60a5fa;
  color: #60a5fa;
}

/* ── Sticky Nav-Panel (Schritt-für-Schritt) ─────────────────── */
.flow-nav-panel {
  width: 140px;
  flex-shrink: 0;
  border-left: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  padding: 24px 16px;
}

.flow-nav-counter {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  user-select: none;
}

.flow-nav-btn {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  text-align: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  width: 100%;
}

.flow-nav-btn:hover:not(:disabled) {
  border-color: #475569;
  color: #cbd5e1;
}

.flow-nav-btn:disabled {
  cursor: default;
  opacity: 0.35;
}

.flow-nav-fwd {
  background: #0f2a1a;
  border-color: #4ade80;
  color: #4ade80;
}

.flow-nav-fwd:hover:not(:disabled) {
  background: #133620;
  border-color: #86efac;
  color: #86efac;
}

.flow-nav-restart {
  background: #1a2535;
  border-color: #60a5fa;
  color: #60a5fa;
}

.flow-nav-restart:hover {
  background: #1e2e45;
  border-color: #93c5fd;
  color: #93c5fd;
}

/* ── Leerzustand ────────────────────────────────────────────── */
.flow-empty {
  color: #64748b;
  font-size: 12px;
  text-align: center;
  padding: 32px 16px;
  border: 1.5px dashed #1e293b;
  border-radius: 8px;
}

.flow-sidebar-empty {
  margin: 12px 8px;
  padding: 16px 8px;
}
