/* Workflow Editor Custom Styles */

/* Canvas background */
#drawflow {
  background-color: #f8fafc;
  background-image:
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
  width: 100%;
  height: 100%;
}

/* Dark mode canvas */
.dark #drawflow {
  background-color: #1e293b;
  background-image:
    linear-gradient(#334155 1px, transparent 1px),
    linear-gradient(90deg, #334155 1px, transparent 1px);
}

/* Base node styles */
.drawflow .drawflow-node {
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  background: white;
  border: 2px solid #e2e8f0;
}

.dark .drawflow .drawflow-node {
  background: #1e293b;
  border-color: #475569;
}

.drawflow .drawflow-node.selected {
  box-shadow: 0 0 0 3px #3b82f6, 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.drawflow .drawflow-node:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Node content wrapper */
.drawflow .drawflow-node .drawflow_content_node {
  padding: 0;
}

/* Node header styles by type */
.node-header {
  padding: 8px 12px;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
}

.node-body {
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.dark .node-body {
  color: #94a3b8;
  border-top-color: rgba(255,255,255,0.1);
}

/* Node type colors */
.node-start .node-header { background: #10b981; color: white; }
.node-end .node-header { background: #ef4444; color: white; }
.node-greeting .node-header { background: #3b82f6; color: white; }
.node-data_collection .node-header { background: #22c55e; color: white; }
.node-media_collection .node-header { background: #a855f7; color: white; }
.node-validation .node-header { background: #f97316; color: white; }
.node-calculation .node-header, .node-processing .node-header { background: #eab308; color: #1e293b; }
.node-loop .node-header { background: #6366f1; color: white; }
.node-conditional .node-header { background: #f59e0b; color: #1e293b; }
.node-approval .node-header { background: #ef4444; color: white; }
.node-notification .node-header { background: #f97316; color: white; }

/* Connection ports */
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 14px;
  height: 14px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.drawflow .drawflow-node .input {
  background: #64748b;
  left: -7px;
}

.drawflow .drawflow-node .output {
  background: #64748b;
  right: -7px;
}

/* Multiple outputs for branching */
.drawflow .drawflow-node .output.output-success { background: #22c55e; }
.drawflow .drawflow-node .output.output-failure { background: #ef4444; }
.drawflow .drawflow-node .output.output-loop { background: #6366f1; }

/* Connection lines */
.drawflow .connection .main-path {
  stroke: #64748b;
  stroke-width: 2;
}

.drawflow .connection .main-path:hover {
  stroke: #3b82f6;
  stroke-width: 3;
}

/* Indicators */
.node-indicators {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.node-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(0,0,0,0.05);
}

.dark .node-indicator {
  background: rgba(255,255,255,0.1);
}

.node-indicator.validation { color: #22c55e; }
.node-indicator.reask { color: #3b82f6; }
.node-indicator.loop { color: #6366f1; }
.node-indicator.formula { color: #eab308; }
.node-indicator.branch { color: #f59e0b; }
.node-indicator.warning { color: #ef4444; background: rgba(239,68,68,0.1); }

/* Loop protection badge */
.loop-protection-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(255,255,255,0.2);
}

.loop-protection-badge.warning {
  background: rgba(239,68,68,0.3);
}

/* Palette items */
.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: grab;
  transition: all 0.2s;
  font-size: 13px;
}

.dark .palette-item {
  background: #1e293b;
  border-color: #475569;
}

.palette-item:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item .icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

/* Step editor panel */
.step-editor-panel {
  background: white;
  border-left: 1px solid #e2e8f0;
  overflow-y: auto;
}

.dark .step-editor-panel {
  background: #1e293b;
  border-left-color: #475569;
}

.step-editor-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
}

.dark .step-editor-tabs {
  border-bottom-color: #475569;
}

.step-editor-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.step-editor-tab:hover {
  color: #3b82f6;
  background: #f8fafc;
}

.dark .step-editor-tab:hover {
  background: #334155;
}

.step-editor-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

/* Form elements in editor */
.editor-form-group {
  margin-bottom: 16px;
}

.editor-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 4px;
}

.dark .editor-label {
  color: #94a3b8;
}

.editor-input, .editor-select, .editor-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #1e293b;
}

.dark .editor-input, .dark .editor-select, .dark .editor-textarea {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

.editor-input:focus, .editor-select:focus, .editor-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Condition builder */
.condition-row {
  background: #f8fafc;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.dark .condition-row {
  background: #0f172a;
  border-color: #475569;
}

/* Re-ask toggle */
.reask-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f0f9ff;
  border-radius: 6px;
  border: 1px solid #bae6fd;
}

.dark .reask-toggle {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Minimap */
.drawflow-minimap {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 150px;
  height: 100px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.drawflow-minimap:hover {
  opacity: 1;
}

.dark .drawflow-minimap {
  background: #1e293b;
  border-color: #475569;
}

/* Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.dark .editor-toolbar {
  background: #1e293b;
  border-bottom-color: #475569;
}

.toolbar-btn {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: white;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.dark .toolbar-btn {
  background: #0f172a;
  border-color: #475569;
  color: #94a3b8;
}

.toolbar-btn:hover {
  background: #f8fafc;
  color: #1e293b;
}

.dark .toolbar-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

.toolbar-btn.primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.toolbar-btn.primary:hover {
  background: #2563eb;
}

/* Zoom controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border-radius: 6px;
  padding: 4px;
}

.dark .zoom-controls {
  background: #0f172a;
}

.zoom-level {
  font-size: 12px;
  color: #64748b;
  min-width: 40px;
  text-align: center;
}
