/* 
  Graph UI - Unified Information Hub (Viewport Locked)
  Prioritizes data accessibility with zero-scroll interaction.
*/

#graph-container {
  flex-grow: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background: transparent;
}

svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Persistent Info Panel (Side on Web, Bottom on Mobile) --- */
.nexus-info-side {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 380px;
  max-height: calc(100% - 2rem);
  background: var(--glass);
  backdrop-filter: blur(25px);
  border: 1px solid var(--p);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh);
  z-index: 2000;
  transform: translateX(450px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexus-info-side.show {
  transform: translateX(0);
}

.info-header {
  padding: 1.25rem 1.5rem;
  background: var(--p-soft);
  border-bottom: 1px solid var(--br);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  color: var(--tx);
}

.info-body h3 {
  color: var(--p);
  font-weight: 800;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.info-section {
  margin-bottom: 1.75rem;
}

.info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--p);
  font-weight: 900;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
  display: block;
}

.info-content {
  color: var(--tx-m);
  line-height: 1.6;
  font-size: 1rem;
}

.info-badge {
  display: inline-block;
  padding: 6px 12px;
  background: var(--s-2);
  border: 1px solid var(--br);
  border-radius: 10px;
  font-size: 0.85rem;
  margin: 0 6px 6px 0;
  color: var(--tx);
  transition: var(--trans);
}

.info-badge:hover {
  border-color: var(--p);
  background: var(--p-soft);
}

/* --- Intelligence Dashboard (Trending Tools) --- */
.nexus-dashboard {
  background: var(--bg);
  border-top: 1px solid var(--p);
  padding: 1.5rem 2rem;
  color: var(--tx);
  z-index: 100;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.dashboard-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--p);
  margin-bottom: 1rem;
  font-weight: 900;
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  align-items: center;
}

#dash-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  padding: 6px 12px;
  background: var(--s-2);
  border-radius: 8px;
  border: 1px solid var(--br);
}

.dashboard-item b {
  color: var(--p);
}

.expand-link {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--p);
  text-decoration: underline;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  margin-left: auto;
}

/* Modal for expanded intel */
.intel-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  max-width: 90%;
  max-height: 80%;
  background: var(--bg);
  border: 1px solid var(--p);
  border-radius: 24px;
  padding: 2.5rem;
  z-index: 3000;
  box-shadow: var(--sh);
  visibility: hidden;
  opacity: 0;
  transition: var(--trans);
  overflow-y: auto;
}

.intel-modal.show {
  visibility: visible;
  opacity: 1;
}

/* --- Path & Zoom Controls --- */
.path-selector {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: var(--glass);
  backdrop-filter: blur(15px);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--br);
  z-index: 110;
  color: var(--tx);
  box-shadow: var(--sh);
}

.zoom-controls {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 110;
}

.zoom-btn {
  width: 48px;
  height: 48px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--br);
  border-radius: 12px;
  color: var(--tx);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
}

.zoom-btn:hover {
  background: var(--p);
  color: white;
  border-color: var(--p);
}

/* --- Mobile Specific Optimization --- */
@media (max-width: 768px) {
  .nexus-info-side {
    top: auto;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 65vh;
    border-radius: 30px 30px 0 0;
    transform: translateY(100%);
  }

  .nexus-info-side.show {
    transform: translateY(0);
  }

  .nexus-dashboard {
    padding: 1rem;
  }

  #dash-list {
    gap: 0.5rem;
  }

  .dashboard-item {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .zoom-controls {
    top: 5.5rem;
    bottom: auto;
    left: 1rem;
    right: auto;
    flex-direction: column;
    z-index: 5000;
  }

  .jump-link-btn {
    bottom: 1.5rem;
    left: 1rem;
    transform: none;
    padding: 8px 16px;
    font-size: 0.75rem;
  }
}

/* --- High-Precision Jump Button --- */
.jump-link-btn {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  transform: none;
  z-index: 1500;
  background: var(--p);
  color: white;
  border-radius: 50px;
  padding: 12px 28px;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.jump-link-btn:hover {
  background: var(--p-v);
  transform: translateX(-50%) translateY(-5px);
  color: white;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.jump-link-btn i {
  font-size: 1.2rem;
}

/* --- SVG Visualization Styles --- */
.node rect {
  stroke-width: 2px;
  rx: 10px;
  ry: 10px;
  transition: 0.3s;
}

.node:hover rect {
  stroke-width: 4px;
  filter: drop-shadow(0 0 10px var(--p));
}

.node text {
  font-family: var(--f-h);
  font-weight: 700;
  fill: var(--tx);
  pointer-events: none;
}

.link {
  stroke-opacity: 0.15;
  stroke: var(--tx-m);
  transition: opacity 0.3s;
}

.link-pulse {
  stroke-dasharray: 5, 5;
  animation: flow 1s linear infinite;
  stroke-opacity: 0.6 !important;
  stroke: var(--p);
}

@keyframes flow {
  to {
    stroke-dashoffset: -10;
  }
}

.node.faded,
.link.faded {
  opacity: 0.05;
}

.node.path-member rect,
.link.path-member {
  stroke: #ffbd2e !important;
  stroke-opacity: 1;
  stroke-width: 3px;
}