/* ============================================
   Agent Canvas - Drawflow Styles
   ============================================ */

#canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #f8fafb;
  background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: hidden;
}

#canvas-container .drawflow {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#canvas-container .drawflow:active {
  cursor: grabbing;
}

/* ===== Node Styles ===== */
.drawflow-node {
  border-radius: 12px;
  min-width: 180px;
  background: white;
  border: 2px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.drawflow-node:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.drawflow-node.selected {
  border-color: #0D9F6E;
  box-shadow: 0 0 0 3px rgba(13,159,110,0.2);
}

.drawflow-node .drawflow_content_node {
  padding: 0;
}

/* Node inner content */
.canvas-node {
  cursor: pointer;
  min-width: 170px;
}

.canvas-node-header {
  padding: 8px 12px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.canvas-node-body {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.canvas-node-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.canvas-node-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 9999px;
  font-weight: 500;
  white-space: nowrap;
}

/* Node type colors */
.canvas-node-header.type-preprocess { background: #6b7280; }
.canvas-node-header.type-triage { background: #f59e0b; }
.canvas-node-header.type-llm_call { background: #0D9F6E; }
.canvas-node-header.type-handoff { background: #ef4444; }
.canvas-node-header.type-response { background: #8b5cf6; }
.canvas-node-header.type-metrics { background: #6b7280; }

.canvas-node-badge.type-preprocess { background: #f3f4f6; color: #6b7280; }
.canvas-node-badge.type-triage { background: #fef3c7; color: #b45309; }
.canvas-node-badge.type-llm_call { background: #d1fae5; color: #065f46; }
.canvas-node-badge.type-handoff { background: #fee2e2; color: #b91c1c; }
.canvas-node-badge.type-response { background: #ede9fe; color: #6d28d9; }
.canvas-node-badge.type-metrics { background: #f3f4f6; color: #6b7280; }

/* ===== Connection Lines ===== */
.drawflow .connection .main-path {
  stroke: #9ca3af;
  stroke-width: 2;
  fill: none;
}

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

/* Conditional edge styling */
.drawflow .connection.conditional .main-path {
  stroke-dasharray: 6 3;
  stroke: #f59e0b;
}

/* ===== Input/Output Points ===== */
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 12px;
  height: 12px;
  border: 2px solid #9ca3af;
  background: white;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
  border-color: #0D9F6E;
  background: #d1fae5;
}

/* ===== Properties Panel ===== */
#canvas-properties-panel {
  transition: width 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
}

#canvas-properties-panel.collapsed {
  width: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0;
}

#canvas-properties-panel .prompt-editor {
  font-family: 'DM Sans', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 200px;
}

/* ===== Toolbar ===== */
#canvas-toolbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 4px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#canvas-toolbar button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
}

#canvas-toolbar button:hover {
  background: #f3f4f6;
  color: #111827;
}

#canvas-toolbar .separator {
  width: 1px;
  background: #e5e7eb;
  margin: 4px 2px;
}

/* ===== Zoom info ===== */
#canvas-zoom-info {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  font-size: 11px;
  color: #9ca3af;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 4px 10px;
}

/* ===== Minimap ===== */
#canvas-minimap {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 180px;
  height: 120px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ===== Edge Labels ===== */
.edge-label {
  position: absolute;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  color: #6b7280;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

/* ===== Prompt History ===== */
.prompt-history-item {
  padding: 8px 12px;
  border-left: 3px solid #e5e7eb;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.prompt-history-item:hover {
  border-color: #0D9F6E;
  background: #f0fdf4;
}

.prompt-history-item.active {
  border-color: #0D9F6E;
  background: #d1fae5;
}

/* ===== Intent Tags ===== */
.intent-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
}

.intent-tag.cat-agendamento { background: #d1fae5; color: #065f46; }
.intent-tag.cat-financeiro { background: #dbeafe; color: #1e40af; }
.intent-tag.cat-atendimento { background: #fef3c7; color: #b45309; }
.intent-tag.cat-geral { background: #f3f4f6; color: #4b5563; }
