/* FreeFlow toolbar — injected into the Node-RED editor via editorTheme. */
#freeflow-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #11121a;
  color: #e8e8ee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  border-bottom: 1px solid #2a2b3a;
  z-index: 1000000;
  user-select: none;
}

/* Shift the whole Node-RED editor down so nothing hides behind the bar. */
#red-ui-editor { top: 40px !important; }

#freeflow-toolbar .ff-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: #e8e8ee;
}
#freeflow-toolbar .ff-brand:hover { background: #20222e; }
#freeflow-toolbar .ff-arrow { font-size: 15px; line-height: 1; }

#freeflow-toolbar .ff-sep { width: 1px; height: 20px; background: #2a2b3a; }

#freeflow-toolbar .ff-name { font-weight: 500; }

#freeflow-toolbar .ff-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #9a9bb0;
  font-size: 12px;
}
#freeflow-toolbar .ff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b6c80;
}
#freeflow-toolbar .ff-dot.running { background: #34d399; }
#freeflow-toolbar .ff-dot.error { background: #f87171; }
#freeflow-toolbar .ff-dot.starting,
#freeflow-toolbar .ff-dot.stopping { background: #fbbf24; }

#freeflow-toolbar .ff-meter {
  color: #9a9bb0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#freeflow-toolbar .ff-spacer { flex: 1; }

#freeflow-toolbar button.ff-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #20222e;
  color: #e8e8ee;
  border: 1px solid #2f3142;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
#freeflow-toolbar button.ff-btn:hover { background: #2a2c3b; }
#freeflow-toolbar button.ff-btn:disabled { opacity: 0.45; cursor: default; }
#freeflow-toolbar button.ff-btn.ff-danger { color: #fca5a5; border-color: #4a2530; }
#freeflow-toolbar button.ff-btn.ff-danger:hover { background: #2e1c22; }

#freeflow-toast {
  position: fixed;
  top: 50px;
  right: 14px;
  background: #20222e;
  color: #e8e8ee;
  border: 1px solid #2f3142;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  z-index: 1000001;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
#freeflow-toast.show { opacity: 1; transform: translateY(0); }
#freeflow-toast.ff-err { border-color: #4a2530; color: #fca5a5; }

/* --- FreeFlow Assistant --------------------------------------------------- */
#freeflow-toolbar button.ff-btn.ff-ai-btn {
  background: #2b2150;
  border-color: #4b3a86;
  color: #d6ccff;
}
#freeflow-toolbar button.ff-btn.ff-ai-btn:hover { background: #362a63; }

#freeflow-ai {
  position: fixed;
  top: 40px;
  right: 0;
  bottom: 0;
  width: 380px;
  display: none;
  flex-direction: column;
  background: #15161f;
  border-left: 1px solid #2a2b3a;
  color: #e8e8ee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  z-index: 1000000;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}
#freeflow-ai.ff-open { display: flex; }

#freeflow-ai .ff-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 600;
  color: #d6ccff;
  border-bottom: 1px solid #2a2b3a;
}
#freeflow-ai .ff-ai-close {
  background: none;
  border: none;
  color: #9a9bb0;
  cursor: pointer;
  font-size: 14px;
}
#freeflow-ai .ff-ai-close:hover { color: #e8e8ee; }

#freeflow-ai .ff-ai-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#freeflow-ai .ff-ai-hint { color: #9a9bb0; font-size: 12px; line-height: 1.5; }
#freeflow-ai .ff-ai-eg { color: #b8a8ff; margin-top: 4px; font-style: italic; }

#freeflow-ai .ff-ai-msg {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  padding: 8px 11px;
  border-radius: 9px;
  max-width: 92%;
}
#freeflow-ai .ff-ai-user {
  align-self: flex-end;
  background: #2b2150;
  color: #e6e0ff;
}
#freeflow-ai .ff-ai-assistant {
  align-self: flex-start;
  background: #20222e;
  color: #e8e8ee;
}
#freeflow-ai .ff-ai-streaming { opacity: 0.92; }
#freeflow-ai .ff-ai-flow {
  align-self: flex-start;
  font-size: 12px;
  color: #b8a8ff;
}

#freeflow-ai .ff-ai-foot {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #2a2b3a;
}
#freeflow-ai .ff-ai-input {
  flex: 1;
  resize: none;
  background: #20222e;
  color: #e8e8ee;
  border: 1px solid #2f3142;
  border-radius: 6px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
}
#freeflow-ai .ff-ai-input:focus { outline: none; border-color: #4b3a86; }
#freeflow-ai button.ff-ai-send { align-self: stretch; }
