/* ═══════════════════════════════════════════════════════════════════════════
   Neurocircuit editor CSS — scope sous .pistachio-window pour pas polluer le
   reste de l'OS. Port de pistachio-circuit/editor.html avec préfixe .pist-nc-
   ═══════════════════════════════════════════════════════════════════════════ */

.pistachio-window .pist-nc {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  position: relative;
}

/* Toolbar */
.pistachio-window .pist-nc-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #0d1117, #161b22);
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.pistachio-window .pist-nc-name {
  background: transparent;
  border: 1px solid transparent;
  color: #e6edf3;
  font-size: 0.85rem; font-weight: 600;
  padding: 4px 8px; border-radius: 4px;
  font-family: inherit;
  min-width: 140px;
}
.pistachio-window .pist-nc-name:focus {
  border-color: #93c47d; outline: none; background: #0d1117;
}
.pistachio-window .pist-nc-status {
  font-size: 0.7rem; color: #8b949e; margin-left: 4px;
}
.pistachio-window .pist-nc-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pistachio-window .pist-nc-btn:hover {
  border-color: #93c47d; color: #93c47d;
}
.pistachio-window .pist-nc-btn-save {
  background: linear-gradient(135deg, #93c47d, #6fa35e);
  color: #0d1117; font-weight: 600; border-color: #93c47d;
}
.pistachio-window .pist-nc-btn-save:hover { box-shadow: 0 2px 10px rgba(147,196,125,0.3); }
.pistachio-window .pist-nc-zoom { font-size: 0.75rem; color: #8b949e; min-width: 38px; text-align: center; }

/* Canvas wrap */
.pistachio-window .pist-nc-canvas-wrap {
  flex: 1; position: relative; overflow: hidden;
  background-color: #0d1117;
  background-image: radial-gradient(circle, #21262d 1px, transparent 1px);
  background-size: 24px 24px;
}
.pistachio-window .pist-nc-cables {
  position: absolute; top: 0; left: 0;
}
.pistachio-window .pist-nc-nodes {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
}

/* Node */
.pistachio-window .pist-nc-node {
  position: absolute;
  min-width: 180px;
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  user-select: none;
}
.pistachio-window .pist-nc-node:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
.pistachio-window .pist-nc-node.selected { border-color: #58a6ff; box-shadow: 0 0 16px rgba(88,166,255,0.3); }
.pistachio-window .pist-nc-node-header {
  padding: 6px 10px; border-radius: 6px 6px 0 0;
  font-size: 0.78rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  cursor: grab;
  display: flex; align-items: center; justify-content: space-between;
  letter-spacing: 0.3px;
}
.pistachio-window .pist-nc-node-header:active { cursor: grabbing; }
.pistachio-window .pist-nc-node-body { padding: 6px 0; }
.pistachio-window .pist-nc-node-delete {
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.2); border: none; color: rgba(0,0,0,0.5);
  font-size: 0.75rem; cursor: pointer; display: none;
  align-items: center; justify-content: center; line-height: 1;
}
.pistachio-window .pist-nc-node:hover .pist-nc-node-delete { display: flex; }
.pistachio-window .pist-nc-node-delete:hover { background: rgba(248,81,73,0.6); color: #fff; }

/* Catégories : couleur du header */
.pistachio-window .pist-nc-cat-io     .pist-nc-node-header { background: linear-gradient(135deg, #d97706, #b45309); }
.pistachio-window .pist-nc-cat-sec    .pist-nc-node-header { background: linear-gradient(135deg, #93c47d, #6fa35e); color:#0d1117 !important; text-shadow:none; }
.pistachio-window .pist-nc-cat-nlp    .pist-nc-node-header { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.pistachio-window .pist-nc-cat-plugin .pist-nc-node-header { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.pistachio-window .pist-nc-cat-logic  .pist-nc-node-header { background: linear-gradient(135deg, #6b7280, #374151); }

/* Ports */
.pistachio-window .pist-nc-port-row {
  display: flex; align-items: center; padding: 3px 10px;
  font-size: 0.72rem; color: #c9d1d9; position: relative;
}
.pistachio-window .pist-nc-port-row.pist-nc-port-in  { justify-content: flex-start; }
.pistachio-window .pist-nc-port-row.pist-nc-port-out { justify-content: flex-end; }
.pistachio-window .pist-nc-port-circle {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid; cursor: crosshair;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.pistachio-window .pist-nc-port-circle:hover { transform: scale(1.3); box-shadow: 0 0 8px currentColor; }
.pistachio-window .pist-nc-port-label { padding: 0 6px; opacity: 0.85; }

/* Sidebar (palette) */
.pistachio-window .pist-nc-sidebar {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 230px; background: rgba(13,17,23,0.95);
  border-left: 1px solid #30363d;
  padding: 10px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  z-index: 10;
}
.pistachio-window .pist-nc-sidebar.open { transform: translateX(0); }
.pistachio-window .pist-nc-sidebar h3 {
  font-size: 0.85rem; color: #93c47d;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid #30363d;
}
.pistachio-window .pist-nc-lib-cat { margin-bottom: 14px; }
.pistachio-window .pist-nc-lib-cat-title {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.pistachio-window .pist-nc-lib-item {
  background: #161b22;
  border: 1px solid #30363d;
  padding: 6px 10px;
  margin-bottom: 3px;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.12s;
}
.pistachio-window .pist-nc-lib-item:hover {
  border-color: #93c47d; background: #1a2026; transform: translateX(-2px);
}

/* Minimap */
.pistachio-window .pist-nc-minimap {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(13,17,23,0.85);
  border: 1px solid #30363d;
  border-radius: 4px;
  z-index: 5;
}

/* Project select */
.pistachio-window .pist-nc-project-select {
  background: #0e1612; color: #93c47d;
  border: 1px solid #243a2e;
  padding: 4px 8px; border-radius: 4px;
  font-size: 0.78rem; font-family: inherit;
  cursor: pointer;
}

/* Toast */
.pistachio-window .pist-nc-toast {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: #93c47d; color: #0d1117;
  padding: 8px 16px; border-radius: 4px;
  font-size: 0.78rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 0; transition: all 0.2s ease-out;
  z-index: 30;
}
.pistachio-window .pist-nc-toast.show {
  transform: translateX(-50%) translateY(0); opacity: 1;
}
