/* arthashield-graph.js — embeddable intelligence graph modeler
   Framework-free. Mounts an SVG edge layer + HTML node layer into a container. */

.asg-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  overflow: hidden;
  background-color: #ffffff;
  background-image: radial-gradient(circle at 1px 1px, rgba(100, 116, 139, 0.18) 1px, transparent 0);
  background-size: 22px 22px;
  touch-action: none;
  cursor: grab;
}
.asg-wrap:active { cursor: grabbing; }

.asg-viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.asg-edges {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
}

.asg-pad {
  position: absolute;
  display: none;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.4);
  transform: translate(-50%, -100%);
  z-index: 30;
}
.asg-pad.show { display: flex; }
.asg-pad button {
  border: 0;
  background: transparent;
  color: #fff;
  font: 600 11px Inter, system-ui, sans-serif;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.asg-pad button:hover { background: rgba(255, 255, 255, 0.16); }

.asg-edge {
  stroke: #94a3b8;
  stroke-width: 2;
  fill: none;
  transition: stroke 0.15s;
}
.asg-edge.dashed { stroke: #c7d2fe; stroke-dasharray: 6 6; }
.asg-edge.selected { stroke: #4f46e5; stroke-width: 3; }
.asg-edge-hit { stroke: transparent; stroke-width: 14; fill: none; cursor: pointer; }

.asg-node {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.08);
  font: 600 13px/1.2 Inter, system-ui, -apple-system, sans-serif;
  color: #0f172a;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
}
.asg-node:active { cursor: grabbing; }
.asg-node .asg-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.asg-node.selected { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25); }
.asg-node.source   { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4); }
.asg-wrap.connect .asg-node:hover { border-color: #2563eb; }
.asg-wrap.connect { cursor: crosshair; }

@media (prefers-color-scheme: dark) {
  .asg-wrap {
    background-color: #0f172a;
    background-image: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.22) 1px, transparent 0);
  }
  .asg-node {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
  .asg-edge { stroke: #64748b; }
  .asg-edge.dashed { stroke: #475569; }
}
