/* ★ CRITICAL: Set dimensions on #graph-container BEFORE JS adds the class */
#graph-container {
  width: 100%;
  min-height: 600px;
  display: block;
  box-sizing: border-box;
}

/* Container */
.issue-graph-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* SVG */
.issue-graph-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}
.issue-graph-svg:active {
  cursor: grabbing;
}

/* Loading / Error overlays */
.issue-graph-loading,
.issue-graph-error {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #003975;
  z-index: 10;
  max-width: 280px;
}
.issue-graph-error {
  color: #a40000;
  border-color: #a40000;
}

/* Controls (top-right) */
.issue-graph-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 20;
}
.issue-graph-btn {
  background: #003975;
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.2;
  padding: 6px 8px;
  cursor: pointer;
}
.issue-graph-btn:hover,
.issue-graph-btn:focus {
  background: #0050a8;
}

/* Legend (bottom-left) */
.issue-graph-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(255,255,255,0.95);
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #1a1a1a;
  max-width: 250px;
  z-index: 20;
}
.issue-graph-legend .legend-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: #003975;
}
.issue-graph-legend .legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.issue-graph-legend .legend-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  border: 1px solid rgba(0,0,0,0.15);
}
.legend-org {
  background: #003975;
}
.legend-issue {
  background: #4a90e2;
}
.legend-response {
  background: #7fb800;
}
/* ★ NEW: legend swatch for no response */
.legend-noresponse {
  background: #d92d20;
}

.issue-graph-legend .legend-label {
  flex: 1 1 auto;
  color: #1a1a1a;
  line-height: 1.3;
}
.issue-graph-legend .legend-note {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  margin-top: 8px;
}

/* Tooltip */
.issue-graph-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(255,255,255,0.97);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  border: 1px solid #d9d9d9;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #1a1a1a;
  z-index: 1000;
  max-width: 260px;
}
.issue-graph-tooltip .tt-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #003975;
  font-size: 13px;
}
.issue-graph-tooltip .tt-desc {
  font-size: 13px;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.issue-graph-tooltip .tt-hint {
  font-size: 12px;
  color: #7a7a7a;
}

/* Links */
.issue-graph-link {
  stroke: #666;
  stroke-opacity: 0.8;
  stroke-width: 2px;
  fill: none;
}
.issue-graph-link.highlighted {
  stroke: #f56505;
  stroke-opacity: 1;
  stroke-width: 2.5px;
}
.issue-graph-link-arrow {
  fill: #666;
}

/* Arrowhead when highlighted */
.issue-graph-link.highlighted ~ path,
.issue-graph-link.highlighted + path {
  fill: #f56505;
}
.issue-graph-link.highlighted + .issue-graph-link-arrow,
.issue-graph-link.highlighted ~ .issue-graph-link-arrow {
  fill: #f56505;
}

/* Link label group */
.link-label-group {
  pointer-events: auto;
  cursor: pointer;
}
.link-label-bg {
  fill: #fff;
  stroke: #d9d9d9;
  stroke-width: 1px;
  opacity: 0.9;
}
.link-label-text {
  font-size: 11px;
  fill: #1a1a1a;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: auto;
  cursor: pointer;
}

/* Nodes */
.issue-graph-node {
  stroke: #fff;
  stroke-width: 1.5px;
  cursor: pointer;
  transition: stroke-width 0.15s, stroke 0.15s;
}
.issue-graph-node:hover {
  stroke-width: 2.5px;
  stroke: #f56505;
}

/* Colours by node type */
.node-org {
  fill: #003975;
}
.node-issue {
  fill: #4a90e2;
}
.node-response {
  fill: #7fb800;
}
/* ★ NEW: red node for no_response */
.node-noresponse {
  fill: #d92d20;
}
/* fallback */
.node-other {
  fill: #999999;
}

/* Node text (labels next to circles) */
/* Node text now sits ON the node */
.issue-graph-node-text {
  font-size: 12px;
  font-weight: 600;
  fill: #ffff00; /* was dark; now bright so it's legible on blue/green/red */
  pointer-events: none;
  text-shadow:
    0 0 2px rgba(0,0,0,0.6),
    0 0 4px rgba(0,0,0,0.6);
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .issue-graph-container {
    height: 480px;
  }

  #graph-container {
    min-height: 480px;
  }

  .issue-graph-btn {
    font-size: 12px;
    padding: 5px 7px;
  }

  .issue-graph-legend {
    font-size: 12px;
    max-width: 210px;
  }
  .issue-graph-legend .legend-title {
    font-size: 12px;
  }
  .issue-graph-legend .legend-note {
    font-size: 11px;
  }

  .issue-graph-node-text {
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .issue-graph-legend {
    display: none;
  }
  
  #graph-container {
    min-height: 400px;
  }
  
  .issue-graph-container {
    height: 400px;
  }
}
