/* ============================================================
   ИСКБ — стили D3-графа (расширенный)
   ============================================================ */

.graph-d3 {
  position: relative;
  width: 100%;
  min-height: 480px;
  background:
    radial-gradient(ellipse at center, rgba(0,229,255,0.04), transparent 70%),
    rgba(3, 6, 15, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.20);
  border-radius: 8px;
  overflow: hidden;
}

.graph-d3__svg {
  display: block;
  width: 100%;
}

/* ---------- Toolbar ---------- */
.graph-d3__toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(10, 22, 40, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.30);
  border-radius: 6px;
  padding: 4px 6px;
  z-index: 5;
  backdrop-filter: blur(6px);
}
.graph-d3__toolbar button {
  background: transparent;
  color: #d6ecf5;
  border: 1px solid rgba(0, 229, 255, 0.30);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: 0.15s;
}
.graph-d3__toolbar button:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 8px rgba(0,229,255,0.35);
}

/* ---------- Legend ---------- */
.graph-d3__legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(10, 22, 40, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: #d6ecf5;
  z-index: 4;
  backdrop-filter: blur(6px);
  max-width: 220px;
}
.graph-d3__legend .lg-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: #00e5ff;
  margin-bottom: 6px;
}
.graph-d3__legend .lg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.graph-d3__legend .lg-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
}
.graph-d3__legend .lg-line {
  display: inline-block;
  width: 18px; height: 2px;
  flex: 0 0 18px;
}
.graph-d3__legend .lg-line--dash {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%) !important;
  background-size: 6px 2px !important;
}
.graph-d3__legend hr {
  border: 0;
  border-top: 1px solid rgba(0, 229, 255, 0.18);
  margin: 6px 0;
}

/* ---------- Tooltip ---------- */
.graph-d3__tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(3, 6, 15, 0.92);
  border: 1px solid #00e5ff;
  color: #d6ecf5;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 240px;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
  z-index: 10;
}
.graph-d3__tooltip code {
  background: rgba(0,229,255,0.12);
  padding: 0 4px;
  border-radius: 2px;
}

/* ---------- Pulse animation ---------- */
@keyframes graph-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px #ff2d55); }
  50%      { filter: drop-shadow(0 0 14px #ff2d55); }
}
.node--pulse circle { animation: graph-pulse 1.6s ease-in-out infinite; }

.node__label {
  font-family: 'Rajdhani', sans-serif;
  text-shadow: 0 0 4px rgba(0,0,0,0.9);
}

/* ============================================================
   Расширенный анализ (scan-tab) — verdict, чеки, скоринг
   ============================================================ */

.verdict-badge {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 6px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.25em;
  font-size: 18px;
  text-transform: uppercase;
  border: 2px solid currentColor;
}
.verdict-badge--approve { color: #00e676; background: rgba(0,230,118,0.10); box-shadow: 0 0 16px rgba(0,230,118,0.35); }
.verdict-badge--review  { color: #ffb300; background: rgba(255,179,0,0.10);  box-shadow: 0 0 16px rgba(255,179,0,0.35);  }
.verdict-badge--reject  { color: #ff2d55; background: rgba(255,45,85,0.10);  box-shadow: 0 0 16px rgba(255,45,85,0.45);  }

.dd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.dd-table th, .dd-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(0,229,255,0.10);
}
.dd-table th { color: #7d99b0; font-weight: 600; }
.dd-table .dd-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dd-status--passed  { background: rgba(0,230,118,0.15); color: #00e676; }
.dd-status--warning { background: rgba(255,179,0,0.15); color: #ffb300; }
.dd-status--failed  { background: rgba(255,45,85,0.15); color: #ff2d55; }

.positive-signs li { color: #00e676; }
.recommended-actions li { color: #ffb300; }

.scoring-breakdown {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}
.sb-row {
  display: grid;
  grid-template-columns: 200px 1fr 48px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.sb-row__label { color: #d6ecf5; }
.sb-row__bar {
  position: relative;
  height: 8px;
  background: rgba(0,229,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.sb-row__fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #00e676, #ffb300, #ff2d55);
}
.sb-row__fill--neg { background: linear-gradient(90deg, #00e676, #00b85c); }
.sb-row__pts { text-align: right; font-family: 'JetBrains Mono', monospace; color: #00e5ff; }
.sb-row__pts--neg { color: #00e676; }

.llm-full-toggle {
  cursor: pointer;
  color: #00e5ff;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  user-select: none;
}
.llm-full-toggle:hover { text-shadow: 0 0 6px #00e5ff; }
.llm-full-pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,229,255,0.18);
  padding: 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #d6ecf5;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================
   RESPONSIVE — мобильная адаптация графа
   ============================================================ */
@media (max-width: 768px) {
  .graph-d3 { min-height: 360px; }

  .graph-d3__toolbar {
    top: 6px;
    left: 6px;
    right: 6px;
    transform: none;
    flex-wrap: wrap;
    justify-content: space-around;
    padding: 3px 4px;
    gap: 4px;
  }
  .graph-d3__toolbar button {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 38px;
    min-height: 36px;
  }

  /* На мобильных легенду делаем сворачиваемой через graph.js,
     по умолчанию — компактная */
  .graph-d3__legend {
    max-width: 60vw;
    font-size: 10px;
    padding: 6px 8px;
  }
  .graph-d3__legend .lg-title { font-size: 9px; letter-spacing: 0.18em; }

  .graph-d3__tooltip {
    font-size: 13px;
    padding: 10px 12px;
    max-width: 80vw;
    line-height: 1.45;
  }

  .verdict-badge { font-size: 14px; padding: 8px 16px; letter-spacing: 0.18em; }

  .sb-row { grid-template-columns: 140px 1fr 40px; font-size: 11px; }
  .dd-table { font-size: 12px; }
}

@media (max-width: 480px) {
  .graph-d3 { min-height: 300px; }
  .sb-row { grid-template-columns: 110px 1fr 36px; font-size: 10px; gap: 6px; }
  .verdict-badge { font-size: 13px; padding: 7px 14px; }
  .graph-d3__legend { max-width: 70vw; }
}
