/* Pattern Graph — full page and local widget styles */

/* Full-page graph container */
#pattern-graph-container {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: 1px solid var(--sidebar-bg, #e0e0e0);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: var(--bg, #fff);
}

#pattern-graph-container svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#pattern-graph-container svg:active {
  cursor: grabbing;
}

/* Graph legend */
.graph-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--bg, #fff);
  border: 1px solid var(--sidebar-bg, #e0e0e0);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  z-index: 10;
  pointer-events: none;
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}

.graph-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Graph controls */
.graph-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.graph-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--sidebar-bg, #e0e0e0);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--fg, #333);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-controls button:hover {
  background: var(--sidebar-bg, #f0f0f0);
}

/* Graph search */
.graph-search {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.graph-search input {
  flex: 1;
  max-width: 300px;
  padding: 6px 10px;
  border: 1px solid var(--sidebar-bg, #e0e0e0);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--fg, #333);
  font-size: 13px;
}

.graph-search input::placeholder {
  color: var(--sidebar-fg, #999);
}

/* Node styles */
.graph-node {
  cursor: pointer;
}

.graph-node circle {
  stroke: var(--bg, #fff);
  stroke-width: 1.5px;
  transition: r 0.15s ease;
}

.graph-node.dimmed circle {
  opacity: 0.15;
}

.graph-node.dimmed text {
  opacity: 0.08;
}

.graph-node.highlighted circle {
  stroke-width: 2.5px;
  stroke: var(--fg, #333);
}

.graph-node text {
  font-size: 10px;
  fill: var(--fg, #333);
  pointer-events: none;
  text-anchor: middle;
}

/* Edge styles */
.graph-edge {
  stroke: #666;
  stroke-opacity: 0.35;
  stroke-width: 1px;
}

.graph-edge.dimmed {
  stroke-opacity: 0.05;
}

.graph-edge.highlighted {
  stroke-opacity: 0.8;
  stroke-width: 1.5px;
}

/* Local graph widget */
.local-graph-widget {
  width: 100%;
  height: 280px;
  border: 1px solid var(--sidebar-bg, #e0e0e0);
  border-radius: 4px;
  margin: 1em 0;
  overflow: hidden;
  position: relative;
  background: var(--bg, #fff);
}

.local-graph-widget svg {
  width: 100%;
  height: 100%;
}

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

.local-graph-widget .graph-edge {
  stroke-opacity: 0.45;
}

.local-graph-widget .graph-edge-label {
  font-size: 9px;
  pointer-events: none;
}

.local-graph-title {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 12px;
  color: var(--sidebar-fg, #999);
  pointer-events: none;
}

.local-graph-expand {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 11px;
  color: var(--links, #4183c4);
  text-decoration: none;
  cursor: pointer;
}

.local-graph-expand:hover {
  text-decoration: underline;
}
