/* ─── Drawflow Canvas ──────────────────────────────────── */

#drawflow {
  background-color: #f5f5ef;
  background-image:
    radial-gradient(circle, #d4d4c8 1px, transparent 1px);
  background-size: 24px 24px;
  width: 100%;
  height: 100%;
}

/* Connections */
.drawflow .connection .main-path {
  stroke: #034f46;
  stroke-width: 2.5;
}
.drawflow .connection .main-path:hover {
  stroke: #4d65ff;
  stroke-width: 3;
}

/* ─── Node Base ────────────────────────────────────────── */

#drawflow .drawflow-node {
  background: white !important;
  border: 2px solid #e5e5dc;
  border-radius: 14px;
  min-width: 220px;
  max-width: 260px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 0;
  overflow: hidden;
}
#drawflow .drawflow-node:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
#drawflow .drawflow-node.selected {
  border-color: #4d65ff;
  box-shadow: 0 0 0 3px rgba(77,101,255,0.12);
}
#drawflow .drawflow-node .drawflow-content-node,
#drawflow .drawflow_content_node {
  padding: 0;
}

/* Port dots */
#drawflow .drawflow-node .input,
#drawflow .drawflow-node .output {
  width: 12px;
  height: 12px;
  border: 2px solid #034f46;
  background: white !important;
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
#drawflow .drawflow-node .input:hover,
#drawflow .drawflow-node .output:hover {
  background: #034f46 !important;
  transform: scale(1.3);
}
#drawflow .drawflow-node .output {
  right: -7px;
}
#drawflow .drawflow-node .input {
  left: -7px;
}

/* ─── Node State Indicators ────────────────────────────── */

#drawflow .drawflow-node.node-idle    { border-color: #e5e5dc; }
#drawflow .drawflow-node.node-pending { border-color: #f59e0b; border-style: dashed; }
#drawflow .drawflow-node.node-running { border-color: #4d65ff; animation: node-pulse 1.5s ease-in-out infinite; }
#drawflow .drawflow-node.node-complete { border-color: #10b981; }
#drawflow .drawflow-node.node-error   { border-color: #ef4444; }
#drawflow .drawflow-node.node-skipped { border-color: #9ca3af; border-style: dashed; opacity: 0.6; }

@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77,101,255,0.25); }
  50% { box-shadow: 0 0 0 6px rgba(77,101,255,0); }
}

/* ─── Node Header ──────────────────────────────────────── */

.wf-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1A1A1A;
  letter-spacing: -0.01em;
}
.wf-node-header .wf-node-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}
.wf-node-header .wf-node-status {
  margin-left: auto;
  font-size: 12px;
}

/* ─── Node Body ────────────────────────────────────────── */

.wf-node-body {
  padding: 0 12px 10px;
  font-size: 11px;
  color: #555;
  line-height: 1.4;
}

/* Form controls inside nodes */
.wf-node-body select,
.wf-node-body input[type="number"],
.wf-node-body input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e5e5dc;
  border-radius: 8px;
  font-size: 11px;
  margin-top: 4px;
  background: #fafaf6;
  font-family: inherit;
  color: #1A1A1A;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.wf-node-body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238d8d83'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  cursor: pointer;
}
.wf-node-body textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e5e5dc;
  border-radius: 8px;
  font-size: 11px;
  margin-top: 4px;
  background: #fafaf6;
  font-family: inherit;
  color: #1A1A1A;
  resize: vertical;
  min-height: 40px;
  outline: none;
  transition: border-color 0.15s;
}
.wf-node-body select:focus,
.wf-node-body input:focus,
.wf-node-body textarea:focus {
  border-color: #034f46;
}

.wf-node-body label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #8d8d83;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.wf-node-body label:first-child {
  margin-top: 0;
}

/* Node description text */
.wf-node-body .wf-desc {
  color: #8d8d83;
  font-size: 10.5px;
  line-height: 1.4;
}

/* ─── File Upload Drop Zone ────────────────────────────── */

.wf-dropzone {
  border: 2px dashed #d4d4c8;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 4px;
  position: relative;
}
.wf-dropzone:hover {
  border-color: #034f46;
  background: #f0faf8;
}
.wf-dropzone .wf-dropzone-icon {
  font-size: 18px;
  color: #b0b0a4;
  margin-bottom: 4px;
}
.wf-dropzone .wf-dropzone-text {
  font-size: 10px;
  color: #8d8d83;
  line-height: 1.3;
}
.wf-dropzone .wf-dropzone-text strong {
  color: #034f46;
  font-weight: 600;
}
.wf-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ─── Checkbox group (outpaint directions) ─────────────── */

.wf-checkbox-group {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.wf-checkbox-group label {
  font-size: 10.5px !important;
  display: flex !important;
  align-items: center;
  gap: 3px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: 0 !important;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f5f5ef;
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500 !important;
  color: #555 !important;
}
.wf-checkbox-group label:hover {
  background: #e8e8e0;
}
.wf-checkbox-group input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: #034f46;
}

/* ─── Node Footer ──────────────────────────────────────── */

.wf-node-footer {
  padding: 6px 12px;
  border-top: 1px solid #f0f0e8;
  font-size: 10px;
  color: #8d8d83;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fafaf6;
}

/* ─── Category Colors ──────────────────────────────────── */

.wf-cat-input      .wf-node-icon { background: #6366f1; }
.wf-cat-analysis   .wf-node-icon { background: #f59e0b; }
.wf-cat-prompt     .wf-node-icon { background: #8b5cf6; }
.wf-cat-generation .wf-node-icon { background: #034f46; }
.wf-cat-editing    .wf-node-icon { background: #f97316; }
.wf-cat-quality    .wf-node-icon { background: #ec4899; }
.wf-cat-audio      .wf-node-icon { background: #06b6d4; }
.wf-cat-video      .wf-node-icon { background: #ef4444; }
.wf-cat-output     .wf-node-icon { background: #64748b; }

/* Category accent stripe on left edge */
.wf-cat-input      { border-left: 3px solid #6366f1 !important; }
.wf-cat-analysis   { border-left: 3px solid #f59e0b !important; }
.wf-cat-prompt     { border-left: 3px solid #8b5cf6 !important; }
.wf-cat-generation { border-left: 3px solid #034f46 !important; }
.wf-cat-editing    { border-left: 3px solid #f97316 !important; }
.wf-cat-quality    { border-left: 3px solid #ec4899 !important; }
.wf-cat-audio      { border-left: 3px solid #06b6d4 !important; }
.wf-cat-video      { border-left: 3px solid #ef4444 !important; }
.wf-cat-output     { border-left: 3px solid #64748b !important; }

/* ─── Node Palette Sidebar ─────────────────────────────── */

.wf-palette {
  width: 200px;
  border-right: 1px solid #e5e5dc;
  background: white;
  overflow-y: auto;
  flex-shrink: 0;
}
.wf-palette-group {
  padding: 6px 10px;
}
.wf-palette-group-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #b0b0a4;
  margin-bottom: 4px;
  padding-left: 2px;
}
.wf-palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: grab;
  font-size: 12px;
  font-weight: 500;
  color: #1A1A1A;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 1px;
}
.wf-palette-item:hover {
  background: #f5f5ef;
}
.wf-palette-item:active {
  cursor: grabbing;
  transform: scale(0.97);
}
.wf-palette-item .wf-pi-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}
.wf-palette-item .wf-pi-cost {
  margin-left: auto;
  font-size: 9px;
  color: #b0b0a4;
  font-weight: 600;
}

/* Palette icon colors */
.wf-palette-item[data-cat="input"]      .wf-pi-icon { background: #6366f1; }
.wf-palette-item[data-cat="analysis"]   .wf-pi-icon { background: #f59e0b; }
.wf-palette-item[data-cat="prompt"]     .wf-pi-icon { background: #8b5cf6; }
.wf-palette-item[data-cat="generation"] .wf-pi-icon { background: #034f46; }
.wf-palette-item[data-cat="editing"]    .wf-pi-icon { background: #f97316; }
.wf-palette-item[data-cat="quality"]    .wf-pi-icon { background: #ec4899; }
.wf-palette-item[data-cat="audio"]      .wf-pi-icon { background: #06b6d4; }
.wf-palette-item[data-cat="video"]      .wf-pi-icon { background: #ef4444; }
.wf-palette-item[data-cat="output"]     .wf-pi-icon { background: #64748b; }

/* ─── Zoom Controls ────────────────────────────────────── */

.wf-zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 10;
}
.wf-zoom-controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e5dc;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #1A1A1A;
  transition: background 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.wf-zoom-controls button:hover {
  background: #f5f5ef;
}

/* ─── Result Preview ───────────────────────────────────── */

.wf-result-preview {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e5e5dc;
}

/* ─── Delete button on node hover ──────────────────────── */

#drawflow .drawflow-node .wf-node-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: 2px solid white;
  font-size: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.1s;
}
#drawflow .drawflow-node:hover .wf-node-delete {
  display: flex;
}
#drawflow .drawflow-node .wf-node-delete:hover {
  transform: scale(1.15);
}
