/* The workflow editor (build S34): the palette on the left, the canvas in the middle, the selected
   step's settings on the right, the problems along the bottom. On a phone the three stack and the
   canvas scrolls. Builds on /css/base.css and /admin3000/admin.css. */

.wf-page { background: var(--ground); }
.wf-top { padding: 12px var(--gutter); background: var(--paper); border-bottom: var(--border); display: grid; gap: 8px; }
.wf-top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.wf-title { font-stretch: 112%; font-weight: 800; font-size: 20px; line-height: 1.2; flex: 1 1 300px; min-width: 0; overflow-wrap: anywhere; }
.wf-version { color: var(--text-3); font-size: 14px; flex: 1 1 260px; }
.wf-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.wf-status { min-height: 1.2em; font-size: 14px; font-weight: 600; }
.wf-status.is-error { color: var(--danger); }
.wf-restore { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wf-runbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--on-ink); }
.wf-runbar p { flex: 1 1 320px; }
#wf-save.is-dirty::after { content: ' *'; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: 14px; }

.wf-main { display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px; min-height: calc(100vh - 220px); }
.wf-palette, .wf-panel { background: var(--paper); padding: 14px; overflow-y: auto; max-height: calc(100vh - 200px); }
.wf-palette { border-right: var(--border); }
.wf-panel { border-left: var(--border); display: flex; flex-direction: column; gap: 10px; }
.wf-palette-h { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 14px 0 6px; }
.wf-palette-group { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.wf-palette-item { width: 100%; text-align: left; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--ground-2); cursor: grab; font: inherit; font-size: 15px; }
.wf-palette-item:hover, .wf-palette-item:focus-visible { border-color: var(--ink); }

.wf-canvas-wrap { position: relative; overflow: hidden; min-height: 480px; outline: none; }
.wf-canvas { width: 100%; height: 100%; min-height: 480px; display: block; touch-action: none; }
.wf-canvas.is-hidden { display: none; }
.wf-canvas-tools { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 1; }
.wf-bg { fill: var(--ground); cursor: grab; }
.wf-empty { position: absolute; top: 60px; left: 20px; right: 20px; max-width: 480px; }

.wf-node { cursor: move; }
.wf-node-box { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.wf-node:focus { outline: none; }
.wf-node:focus .wf-node-box, .wf-node.is-selected .wf-node-box { stroke: var(--accent-dark); stroke-width: 3; }
.wf-group-triggers .wf-node-box { fill: #FFF1EA; }
.wf-group-logic .wf-node-box { fill: var(--ground-2); }
.wf-node-mark { font-family: var(--font-mono); font-size: 11px; fill: var(--text-3); }
.wf-node-label { font-weight: 700; font-size: 15px; fill: var(--text); }
.wf-node-sub { font-size: 12px; fill: var(--muted); }
.wf-port { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.wf-port-out { cursor: crosshair; }
.wf-port-out:hover { fill: var(--accent); }
.wf-edge-line { fill: none; stroke: var(--ink); stroke-width: 2; }
.wf-edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.wf-edge.is-selected .wf-edge-line { stroke: var(--accent-dark); stroke-width: 3; }
.wf-edge-label { font-family: var(--font-mono); font-size: 11px; fill: var(--text-3); }
.wf-edge-temp { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }

/* The run view: grey not run, blue running, green done, amber waiting or not sure, red failed, striped skipped. */
.wf-node.is-pending .wf-node-box { fill: #E4E5E1; stroke: #8A8D92; }
.wf-node.is-running .wf-node-box { fill: #DCE9FB; stroke: #1F5FBF; animation: wf-pulse 1.4s ease-in-out infinite; }
.wf-node.is-done .wf-node-box { fill: #DDF3E3; stroke: #1B7A3A; }
.wf-node.is-waiting .wf-node-box { fill: #FFF1D6; stroke: #A86400; }
.wf-node.is-failed .wf-node-box { fill: #FCE0DA; stroke: #B3261E; }
.wf-node.is-skipped .wf-node-box { fill: #F1F1EF; stroke: #A9B4C4; stroke-dasharray: 5 4; }
@keyframes wf-pulse { 50% { stroke-width: 4; } }
@media (prefers-reduced-motion: reduce) { .wf-node.is-running .wf-node-box { animation: none; stroke-width: 3; } }

.wf-field .label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wf-wording { font-size: 10px; }
.wf-check label, .wf-check-line { display: flex; gap: 8px; align-items: center; }
.wf-checks { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; }
.wf-fields-row { display: grid; grid-template-columns: 1fr 90px 1.4fr auto; gap: 6px; margin-bottom: 6px; }
.wf-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wf-test-out { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; background: var(--ground-2); padding: 8px; border-radius: 8px; max-height: 320px; overflow: auto; }
.wf-trigger { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.wf-copy { user-select: all; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 13px; }

.wf-outline { padding: 50px 16px 16px; overflow-y: auto; max-height: calc(100vh - 220px); }
.wf-outline-list { display: grid; gap: 8px; padding-left: 20px; }
.wf-outline-item { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.wf-outline-item[data-depth="1"] { margin-left: 16px; } .wf-outline-item[data-depth="2"] { margin-left: 32px; } .wf-outline-item[data-depth="3"] { margin-left: 48px; }
.wf-outline-item[data-depth="4"], .wf-outline-item[data-depth="5"], .wf-outline-item[data-depth="6"], .wf-outline-item[data-depth="7"], .wf-outline-item[data-depth="8"] { margin-left: 64px; }
.wf-outline-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-outline-tools .select { max-width: 220px; }

.wf-problems { background: var(--paper); border-top: var(--border); padding: 10px var(--gutter); }
.wf-problems ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 4px; }
.wf-problem { background: none; border: 0; padding: 0; text-align: left; font: inherit; font-size: 14px; color: var(--danger); cursor: pointer; }

.wf-dialog { border: var(--border); border-radius: var(--radius); padding: 20px 22px; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.wf-dialog-wide { max-width: min(760px, calc(100vw - 32px)); }
.wf-dialog::backdrop { background: rgba(15, 30, 54, .5); }
.wf-dialog form { display: grid; gap: 10px; }
.wf-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

.wf-mode-view .wf-edit-only { display: none !important; }

/* Build S45: the Use a website step's action log in the run view, with screenshot thumbnails. */
.wf-site-log { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.wf-site-log li { overflow-wrap: anywhere; }
.wf-site-log .is-refused { color: var(--danger, #b42318); }
.wf-site-thumb { display: block; margin-top: 4px; max-width: 100%; width: 240px; height: auto; border: var(--border); border-radius: 4px; }

@media (max-width: 960px) {
  .wf-main { grid-template-columns: 1fr; }
  .wf-palette, .wf-panel { max-height: none; border: 0; border-bottom: var(--border); }
  .wf-palette-list { display: block; }
  .wf-canvas-wrap { overflow: auto; }
  .wf-fields-row { grid-template-columns: 1fr 1fr; }
}
