/**
 * ============================================================================
 * X-RAY ORGANISATION - STYLES V2
 * NÅ“uds HTML style workflow + Cytoscape pour edges
 * ============================================================================
 */

/* ==================== VARIABLES ==================== */
:root {
  --xray-danger: #ef4444;
  --xray-danger-glow: rgba(239, 68, 68, 0.4);
  --xray-warning: #eab308;
  --xray-warning-glow: rgba(234, 179, 8, 0.4);
  --xray-success: #10b981;
  --xray-success-glow: rgba(16, 185, 129, 0.4);
  --xray-normal: #3b82f6;
  --xray-normal-glow: rgba(59, 130, 246, 0.4);
  --xray-center: #a855f7;
  --xray-center-glow: rgba(168, 85, 247, 0.5);
}

/* ==================== PAGE LAYOUT ==================== */
.xray-page {
  min-height: 100vh;
  background: var(--bg);
}

.xray-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==================== HERO ==================== */
.xray-hero {
  text-align: center;
  padding: 120px 0 60px;
  background: radial-gradient(circle at 30% 20%, rgba(168, 85, 247, 0.08), transparent 40%),
              linear-gradient(180deg, var(--bg-alt, #0f172a), var(--bg, #0a0f1a));
}

.xray-hero .container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.xray-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--xray-center);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.xray-hero .hero-badge svg {
  width: 16px;
  height: 16px;
}

.xray-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.2;
}

.xray-hero .hero-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

.xray-hero .back-link {
  margin-top: 32px;
}

/* ==================== PIPELINE STATUS BAR ==================== */
.pipeline-status {
  background: rgba(10, 26, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 32px;
}

.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pipeline-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

.status-text {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pipeline-stats {
  display: flex;
  gap: 32px;
}

.pipeline-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pipeline-stats .stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pipeline-stats .stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pipeline-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}

.source-chip svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.source-chip.connected {
  border-color: rgba(16, 185, 129, 0.3);
}

.source-chip.connected svg {
  color: var(--gold);
  opacity: 1;
}

.source-chip .chip-status {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  margin-left: 4px;
}

.source-chip.connected .chip-status {
  animation: pulse-chip 3s ease-in-out infinite;
}

@keyframes pulse-chip {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==================== DOMAIN SELECTOR ==================== */
.domain-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  width: 100%;
}

.domain-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.domain-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.domain-btn.active {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text);
}

.domain-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.domain-icon svg {
  width: 24px;
  height: 24px;
}

.domain-label {
  font-size: 14px;
  font-weight: 600;
}

.domain-desc {
  font-size: 11px;
  opacity: 0.7;
}

/* ==================== ENTITY SELECTOR ==================== */
.entity-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 14px;
  color: var(--muted);
}

.entity-select {
  min-width: 300px;
  padding: 12px 16px;
  background: rgba(10, 26, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.entity-select:focus {
  outline: none;
  border-color: var(--gold);
}

.analyze-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--gold), var(--gold-600));
  border: none;
  border-radius: 8px;
  color: #0b0b0b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.analyze-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--gold-glow);
}

/* ==================== GRAPH CANVAS ==================== */
.graph-section {
  margin-bottom: 40px;
}

.graph-canvas {
  position: relative;
  height: 500px;
  background: 
    linear-gradient(90deg, rgba(168, 85, 247, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(168, 85, 247, 0.03) 1px, transparent 1px),
    rgba(10, 15, 26, 0.95);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  overflow: hidden;
  overflow: hidden;
}

/* Canvas placeholder */
.canvas-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--muted);
}

.canvas-placeholder svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.canvas-placeholder p {
  font-size: 16px;
}

/* Cytoscape container (for edges and layout engine) */
#cy-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* HTML Overlay container (for sexy nodes) */
#overlay-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#overlay-container .xray-node {
  pointer-events: auto;
}

/* Click hint */
.click-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(168, 85, 247, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.click-hint.visible {
  opacity: 1;
}

/* ==================== HTML NODES ==================== */
.xray-node {
  position: absolute;
  cursor: pointer;
  z-index: 10;
  transform-origin: center center;
  /* NO transition on position - must follow Cytoscape instantly */
}

/* Center Node */
.xray-node.center-node {
  z-index: 20;
}

.xray-node.center-node .node-inner {
  width: 140px;
  height: 140px;
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(168, 85, 247, 0.5);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s ease;
}

.xray-node.center-node:hover .node-inner {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.center-icon {
  display: none;
}

.center-icon svg {
  display: none;
}

.center-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  max-width: 110px;
}

.center-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}

/* Metric Nodes */
.xray-node.metric-node .node-inner {
  width: 180px;
  min-height: 100px;
  background: rgba(10, 26, 42, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Left border accent based on status */
.xray-node.metric-node.status-danger .node-inner {
  border-left: 3px solid var(--xray-danger);
}

.xray-node.metric-node.status-warning .node-inner {
  border-left: 3px solid var(--xray-warning);
}

.xray-node.metric-node.status-success .node-inner {
  border-left: 3px solid var(--xray-success);
}

.xray-node.metric-node.status-normal .node-inner {
  border-left: 3px solid var(--xray-normal);
}

.xray-node.metric-node:hover .node-inner {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Simplified hover - no glow */
.xray-node.metric-node.status-danger:hover .node-inner,
.xray-node.metric-node.status-warning:hover .node-inner,
.xray-node.metric-node.status-success:hover .node-inner,
.xray-node.metric-node.status-normal:hover .node-inner {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Metric Header */
.metric-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.metric-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.metric-status.danger { background: var(--xray-danger); }
.metric-status.warning { background: var(--xray-warning); }
.metric-status.success { background: var(--xray-success); }
.metric-status.normal { background: var(--xray-normal); }

.metric-info {
  flex: 1;
  min-width: 0;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.metric-badge {
  padding: 4px 8px;
  background: rgba(239, 68, 68, 0.2);
  color: var(--xray-danger);
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Metric Body */
.metric-body {
  padding: 10px 16px 14px;
  font-size: 11px;
  color: var(--muted);
}

.metric-body .source-count {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-body .source-count svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* Status left border */
.xray-node.metric-node.status-danger .node-inner { border-left: 3px solid var(--xray-danger); }
.xray-node.metric-node.status-warning .node-inner { border-left: 3px solid var(--xray-warning); }
.xray-node.metric-node.status-success .node-inner { border-left: 3px solid var(--xray-success); }
.xray-node.metric-node.status-normal .node-inner { border-left: 3px solid var(--xray-normal); }

/* Expanded metric - use status color */
.xray-node.metric-node.expanded.status-danger .node-inner {
  border-color: var(--xray-danger) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px var(--xray-danger-glow);
}

.xray-node.metric-node.expanded.status-warning .node-inner {
  border-color: var(--xray-warning) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px var(--xray-warning-glow);
}

.xray-node.metric-node.expanded.status-success .node-inner {
  border-color: var(--xray-success) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px var(--xray-success-glow);
}

.xray-node.metric-node.expanded.status-normal .node-inner {
  border-color: var(--xray-normal) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px var(--xray-normal-glow);
}

/* Dimmed state */
.xray-node.dimmed {
  opacity: 0.25;
  filter: grayscale(0.6);
  pointer-events: none;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Source Nodes - Simplified */
.xray-node.source-node .node-inner {
  position: relative;
  width: 120px;
  min-height: 70px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.xray-node.source-node:hover .node-inner {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.source-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-icon svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.source-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.source-status {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

/* Source with metadata - clickable */
.xray-node.source-node.has-meta {
  cursor: pointer;
}

.xray-node.source-node.has-meta:hover .node-inner {
  border-color: rgba(168, 85, 247, 0.6);
}

.xray-node.source-node.popup-open .node-inner {
  border-color: rgba(168, 85, 247, 0.7);
  background: rgba(168, 85, 247, 0.1);
}

.source-meta-indicator {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: rgba(168, 85, 247, 0.8);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: none; /* Hidden - cleaner look */
  align-items: center;
  justify-content: center;
}

.source-meta-indicator.conflict {
  display: none;
}

@keyframes pulse-conflict {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ==================== POPUP NODE ==================== */
.xray-node.popup-node {
  position: absolute;
  pointer-events: auto;
  z-index: 25;
  transform-origin: center center;
}

.xray-node.popup-node .node-inner {
  width: 220px;
  min-height: 120px;
  max-height: 200px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.xray-node.popup-node.has-conflict .node-inner {
  border-color: rgba(239, 68, 68, 0.5);
}

/* Popup header - draggable */
.popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
}

.popup-header:active {
  cursor: grabbing;
}

.xray-node.popup-node.has-conflict .popup-header {
  background: rgba(239, 68, 68, 0.1);
}

.popup-status {
  font-size: 10px;
}

.popup-status.status-danger { color: var(--xray-danger); }
.popup-status.status-warning { color: var(--xray-warning); }
.popup-status.status-success { color: var(--xray-success); }
.popup-status.status-normal { color: var(--xray-normal); }

.popup-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.popup-header .conflict-badge {
  font-size: 8px;
  font-weight: 700;
  color: var(--xray-danger);
  background: rgba(239, 68, 68, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Popup content */
.popup-content {
  padding: 8px 12px 12px;
  overflow-y: auto;
  flex: 1;
}

.popup-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-row:last-child {
  border-bottom: none;
}

.popup-row.conflict {
  background: rgba(239, 68, 68, 0.08);
  margin: 0 -12px;
  padding: 6px 12px;
  border-left: 3px solid var(--xray-danger);
}

.popup-key {
  display: block;
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.popup-value {
  display: block;
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}

/* Conflict info in popup */
.popup-conflict-info {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(239, 68, 68, 0.3);
}

.popup-conflict-info .conflict-icon {
  color: var(--xray-danger);
  font-size: 10px;
}

.popup-conflict-info .conflict-detail {
  font-size: 9px;
  color: var(--muted);
}

.popup-conflict-info .conflict-detail strong {
  color: var(--xray-danger);
  font-weight: 700;
}

/* ==================== DUAL POPUP SYSTEM ==================== */

/* Popup index badge - simple numbering */
.popup-index-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border: none;
}

/* Popup close button */
.popup-close-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  transition: all 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Source node highlight when popup is open - subtle */
.xray-node.source-node.popup-open .node-inner {
  border-color: rgba(168, 85, 247, 0.5);
}

/* Close All button */
.close-all-popups-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.close-all-popups-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
}

.close-all-popups-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
}

/* ==================== RESULTS PANEL ==================== */
.results-panel {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}

.results-panel.visible {
  display: grid;
}

.result-card {
  background: rgba(10, 26, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.result-header svg {
  width: 20px;
  height: 20px;
  color: var(--gold);
}

.result-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.result-body {
  padding: 20px;
}

/* Risk badge */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.risk-badge.high {
  background: rgba(239, 68, 68, 0.2);
  color: var(--xray-danger);
}

.risk-badge.medium {
  background: rgba(234, 179, 8, 0.2);
  color: var(--xray-warning);
}

.risk-badge.low {
  background: rgba(16, 185, 129, 0.2);
  color: var(--xray-success);
}

/* Impact list */
.impact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.impact-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.impact-list li:last-child {
  border-bottom: none;
}

.impact-list li::before {
  content: 'â€¢';
  color: var(--gold);
  font-weight: bold;
}

/* Recommendations */
.reco-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: reco;
}

.reco-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.reco-list li:last-child {
  border-bottom: none;
}

.reco-list li::before {
  counter-increment: reco;
  content: counter(reco);
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--gold), var(--gold-600));
  color: #0b0b0b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.reco-content {
  flex: 1;
}

.reco-text {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.reco-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
}

.reco-priority {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.reco-priority.urgent {
  background: rgba(239, 68, 68, 0.2);
  color: var(--xray-danger);
}

.reco-priority.high {
  background: rgba(234, 179, 8, 0.2);
  color: var(--xray-warning);
}

.reco-priority.normal {
  background: rgba(59, 130, 246, 0.2);
  color: var(--xray-normal);
}

.reco-delay {
  color: var(--muted);
}

/* ==================== CTA ==================== */
.xray-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 80px;
  padding: 60px 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.xray-cta .cta-content {
  flex: 1;
}

.xray-cta h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.xray-cta p {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.xray-cta .btn {
  flex-shrink: 0;
  padding: 16px 32px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .domain-btn {
    padding: 14px 10px;
  }
  
  .graph-canvas {
    min-height: 450px;
  }
  
  .results-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .xray-hero {
    padding: 100px 0 40px;
  }
  
  .xray-hero h1 {
    font-size: 1.8rem;
  }
  
  .domain-selector {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .domain-btn {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    padding: 12px 8px;
  }
  
  .domain-icon {
    width: 28px;
    height: 28px;
  }
  
  .domain-label {
    font-size: 12px;
  }
  
  .domain-desc {
    display: none;
  }
  
  .entity-selector {
    flex-direction: column;
    gap: 12px;
  }
  
  .entity-select {
    width: 100%;
    min-width: unset;
  }
  
  .analyze-btn {
    width: 100%;
  }
  
  .graph-canvas {
    min-height: 400px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Node sizes kept same as desktop for edge alignment */
  
  .pipeline-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .pipeline-stats {
    width: 100%;
    justify-content: space-around;
  }
  
  .pipeline-sources {
    gap: 8px;
  }
  
  .source-chip {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .source-chip svg {
    width: 12px;
    height: 12px;
  }
  
  .xray-cta {
    flex-direction: column;
    text-align: center;
    gap: 24px;
    padding: 40px 0;
  }
}

@media (max-width: 480px) {
  .domain-btn {
    flex: 1 1 calc(50% - 4px);
    padding: 10px 6px;
  }
  
  .domain-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .domain-label {
    font-size: 10px;
  }
  
  .graph-canvas {
    min-height: 350px;
  }
  
  /* On mobile, we don't change node sizes to keep edge alignment */
}

/* ==================== ANIMATIONS ==================== */
/* Animation via opacity only - no transform interference */
@keyframes nodeAppear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.xray-node .node-inner {
  animation: nodeAppear 0.4s ease-out backwards;
}

.xray-node:nth-child(1) .node-inner { animation-delay: 0s; }
.xray-node:nth-child(2) .node-inner { animation-delay: 0.08s; }
.xray-node:nth-child(3) .node-inner { animation-delay: 0.16s; }
.xray-node:nth-child(4) .node-inner { animation-delay: 0.24s; }
.xray-node:nth-child(5) .node-inner { animation-delay: 0.32s; }
.xray-node:nth-child(6) .node-inner { animation-delay: 0.4s; }

@keyframes edgeDraw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

/* ==================== PRINT ==================== */
@media print {
  .domain-selector,
  .entity-selector,
  .xray-cta {
    display: none;
  }
  
  .graph-canvas {
    border: 1px solid #ccc;
  }
}
