/* Interakt SPA — Chatbot Builder Stylesheet */

.chatbot-split {
  display: flex;
  height: calc(100vh - var(--header-height) - 128px);
  gap: 20px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* Palette Left Panel */
.chatbot-palette {
  width: 220px;
  border-right: 1px solid var(--border);
  background-color: var(--background);
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.chatbot-palette h5 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.palette-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.palette-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.palette-item span {
  font-size: 18px;
}

/* Node Graph Canvas Center */
.chatbot-canvas-container {
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #f3f4f6; /* Grid dot background */
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 20px 20px;
}

.chatbot-canvas-toolbar {
  height: 48px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.chatbot-canvas-toolbar .canvas-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.canvas-controls {
  display: flex;
  gap: 6px;
}
.btn-canvas-ctrl {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.btn-canvas-ctrl:hover {
  background-color: var(--border);
  color: var(--text-primary);
}

.chatbot-canvas {
  flex: 1;
  position: relative;
  overflow: auto;
}

/* Canvas Nodes */
.bot-node {
  position: absolute;
  width: 170px;
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  cursor: move;
  z-index: 20;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bot-node:hover {
  box-shadow: var(--shadow-lg);
}
.bot-node.active-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-lg);
}

.bot-node .node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.bot-node .node-header span {
  font-size: 14px;
}

.bot-node .node-body {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
  word-break: break-word;
}

.bot-node .node-ports {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
.node-port {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  border: 1.5px solid var(--surface);
  cursor: pointer;
}
.node-port:hover {
  background-color: var(--primary);
  transform: scale(1.3);
}

/* Specialized Node Styling Colors */
.bot-node.node-start { border-color: var(--accent); }
.bot-node.node-start .node-header { color: var(--accent); }
.bot-node.node-message { border-color: var(--primary); }
.bot-node.node-message .node-header { color: var(--primary-dark); }
.bot-node.node-question { border-color: var(--warning); }
.bot-node.node-question .node-header { color: var(--warning); }
.bot-node.node-condition { border-color: var(--accent); }
.bot-node.node-condition .node-header { color: var(--accent); }
.bot-node.node-webhook { border-color: var(--info); }
.bot-node.node-webhook .node-header { color: var(--info); }

/* SVG Connection Lines Rendering layer */
.bot-connector-lines-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* Right Chatbot Simulator Panel */
.chatbot-simulator-panel {
  width: 280px;
  border-left: 1px solid var(--border);
  background-color: #efeae2; /* Mobile mock chat wallpaper tone */
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.chatbot-simulator-panel h5 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.simulator-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sim-msg-row {
  display: flex;
  width: 100%;
}
.sim-msg-row.sent { justify-content: flex-end; }
.sim-msg-row.received { justify-content: flex-start; }

.sim-bubble {
  max-width: 80%;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}
.sim-msg-row.received .sim-bubble {
  background-color: var(--surface);
  color: var(--text-primary);
  border-top-left-radius: 0;
}
.sim-msg-row.sent .sim-bubble {
  background-color: #d9fdd3;
  color: var(--text-primary);
  border-top-right-radius: 0;
}

.sim-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.sim-btn-reply {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  color: var(--accent);
  transition: all 0.2s ease;
}
.sim-btn-reply:hover {
  background-color: var(--accent-light);
  border-color: var(--accent);
}
