/* Admin blog interlink map (force-directed graph, rendered by the
   interlink_graph Stimulus controller with d3). */

.interlink-graph-card .card-body {
  position: relative;
  min-height: 640px;
}

/* Mobile: extra breathing room at the page edges. */
@media (max-width: 767.98px) {
  .interlinks-page {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}
@media (max-width: 575.98px) {
  .interlinks-page {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
}

.interlink-graph {
  position: relative;
  height: 620px;
  width: 100%;
  background: #fafaf7;
  border-radius: 0.5rem;
  overflow: hidden;
}

.interlink-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.interlink-svg:active {
  cursor: grabbing;
}

.interlink-node {
  stroke: #ffffff;
  stroke-width: 1.5px;
  cursor: pointer;
}

/* Green: post contains offsite (absolute http(s)) links. */
.interlink-node--has-external {
  fill: #2f6f4e;
}

/* Red: no external links. */
.interlink-node--no-external {
  fill: #b0442f;
}

.interlink-node:hover {
  stroke: var(--primary-color, #6a4d8a);
  stroke-width: 2px;
}

/* Orphan posts (no internal links) render hollow, keeping their color. */
.interlink-node--orphan {
  fill: transparent;
}

.interlink-node--orphan.interlink-node--has-external {
  stroke: #2f6f4e;
}

.interlink-node--orphan.interlink-node--no-external {
  stroke: #b0442f;
}

.interlink-node--orphan:hover {
  stroke-width: 2px;
}

.interlink-edge {
  stroke: #8aa694;
  stroke-opacity: 0.55;
  marker-end: url(#interlink-arrow);
}

.interlink-edge--hot {
  stroke: #2f6f4e;
  stroke-opacity: 1;
}

.interlink-edge--dim {
  stroke: #d7ddd8;
  stroke-opacity: 0.4;
}

/* Hovering an edge directly turns it green (same green as a "hot" edge),
   no matter whether it was dimmed by node hover. CSS wins over the
   per-element stroke-width attribute so hovered edges also thicken. */
.interlink-edge:hover,
.interlink-edge--dim:hover,
.interlink-edge--hot:hover {
  stroke: #2f6f4e;
  stroke-opacity: 1;
  stroke-width: 3px;
}

.interlink-arrow {
  fill: #8aa694;
}

.interlink-label {
  font-size: 11px;
  fill: #4a5550;
  paint-order: stroke;
  stroke: #fafaf7;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.interlink-label--hot {
  fill: #1c3527;
  font-weight: 600;
}

.interlink-label--dim {
  fill: #b7c2bc;
}

.interlink-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2f6f4e;
  border: 1.5px solid #ffffff;
}

.interlink-legend-dot--orphan {
  background: transparent;
  border: 1.5px solid #b0442f;
}

.interlink-legend-dot--green {
  background: #2f6f4e;
}

.interlink-legend-dot--red {
  background: #b0442f;
}

.interlink-legend-line {
  display: inline-block;
  width: 36px;
  height: 2px;
  background: #8aa694;
  position: relative;
}

.interlink-legend-line::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  border-left: 7px solid #8aa694;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.interlink-tooltip {
  position: absolute;
  display: none;
  max-width: 260px;
  padding: 8px 10px;
  background: #1c3527;
  color: #ffffff;
  font-size: 12px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1050;
  line-height: 1.4;
}

.interlink-tooltip--visible {
  display: block;
}

.interlink-tooltip-orphan {
  margin-top: 2px;
  font-style: italic;
  color: #f0c896;
}

/* --- AI interlink advisor panel ------------------------------------------- */

.interlink-audit-commentary {
  max-height: 220px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px 12px;
}

.interlink-audit-recommendations {
  display: grid;
  gap: 12px;
}

.interlink-audit-rec {
  border: 1px solid #dee2e6;
  border-left: 4px solid #0d6efd;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.interlink-audit-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  color: #fff;
  background: #6c757d;
}

.interlink-audit-badge--orphan { background: #dc3545; }
.interlink-audit-badge--bridge { background: #0d6efd; }
.interlink-audit-badge--cluster { background: #6f42c1; }
.interlink-audit-badge--hub { background: #198754; }
.interlink-audit-badge--external { background: #fd7e14; }

.interlink-audit-route {
  font-size: 0.9rem;
  font-weight: 600;
}

.interlink-audit-route-arrow {
  color: #0d6efd;
}

.interlink-audit-rec--link {
  border-left-color: #198754;
}

.interlink-audit-revision-preview {
  border: 1px dashed #adb5bd;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.interlink-audit-revision-preview a {
  font-weight: 600;
}

.interlink-audit-rec--applied {
  border-left-color: #6c757d;
  opacity: 0.55;
}
