/* FDRP Ontology Dashboard — Dark Mission Control Theme */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --card: #1a1a2e;
  --border: #2a2a3e;
  --text-primary: #e0e0e0;
  --text-secondary: #888;
  --accent: #00bfff;
  --critical: #ff0044;
  --high: #ff8800;
  --medium: #ffcc00;
  --low: #44ff88;
  --active: #00ff88;
  --design: #00bfff;
  --anti-pattern: #ff4444;
  --diagnosis: #ff00ff;
  --missing: #ff6600;
  --proposed: #bb88ff;
  --present: #00bfff;
  --partial: #ffcc00;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* === SIDEBAR === */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

#sidebar-header h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#sidebar-header .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

#sidebar-header .timestamp {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 8px;
  opacity: 0.6;
}

.nav-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.nav-section-title {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 16px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  color: var(--text-primary);
  gap: 10px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(0, 191, 255, 0.06);
  border-left-color: rgba(0, 191, 255, 0.3);
}

.nav-item.active {
  background: rgba(0, 191, 255, 0.1);
  border-left-color: var(--accent);
  color: var(--accent);
}

.nav-item .icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.8;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  color: var(--text-secondary);
}

/* Stats panel in sidebar */
#stats-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
}

.stat-label { color: var(--text-secondary); }
.stat-value { color: var(--text-primary); font-weight: 600; }

.stat-value.critical { color: var(--critical); }
.stat-value.high { color: var(--high); }

/* Severity legend */
#legend {
  padding: 16px;
  margin-top: auto;
}

.legend-title {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
  color: var(--text-secondary);
}

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

.legend-hex {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.legend-star {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.legend-diamond {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* === MAIN AREA === */
#main {
  margin-left: 280px;
  height: calc(100vh - 40px);
  margin-top: 40px;
  position: relative;
  overflow: hidden;
}

#graph-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
}

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

/* === DETAIL PANEL (right slide-out) === */
#detail-panel {
  position: fixed;
  right: -440px;
  top: 0; bottom: 0;
  width: 440px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

#detail-panel.open {
  right: 0;
}

#detail-close {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

#detail-close button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  transition: all 0.15s;
}

#detail-close button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#detail-close .type-badge {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 600;
}

#detail-content {
  padding: 20px;
}

#detail-content h2 {
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 16px;
  line-height: 1.3;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.detail-section-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.detail-section-body p { margin-bottom: 8px; }

.detail-section-body code {
  background: var(--card);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--accent);
}

.detail-section-body pre {
  background: var(--card);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
  border: 1px solid var(--border);
}

.detail-section-body h1, .detail-section-body h2, .detail-section-body h3,
.detail-section-body h4, .detail-section-body h5, .detail-section-body h6 {
  color: var(--accent);
  margin: 12px 0 6px;
}

.detail-section-body h1 { font-size: 18px; }
.detail-section-body h2 { font-size: 16px; }
.detail-section-body h3 { font-size: 14px; }

.detail-section-body ul, .detail-section-body ol {
  padding-left: 20px;
  margin-bottom: 8px;
}

.detail-section-body li { margin-bottom: 4px; }

.detail-section-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}

.detail-section-body strong { color: var(--accent); }
.detail-section-body em { color: var(--medium); font-style: italic; }

.detail-section-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.severity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.severity-badge.CRITICAL { background: rgba(255,0,68,0.2); color: var(--critical); border: 1px solid var(--critical); }
.severity-badge.HIGH { background: rgba(255,136,0,0.2); color: var(--high); border: 1px solid var(--high); }
.severity-badge.MEDIUM { background: rgba(255,204,0,0.2); color: var(--medium); border: 1px solid var(--medium); }
.severity-badge.LOW { background: rgba(68,255,136,0.2); color: var(--low); border: 1px solid var(--low); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-badge.PRESENT { background: rgba(0,191,255,0.15); color: var(--present); border: 1px solid var(--present); }
.status-badge.MISSING { background: rgba(255,102,0,0.15); color: var(--missing); border: 1px solid var(--missing); }
.status-badge.PARTIAL { background: rgba(255,204,0,0.15); color: var(--partial); border: 1px solid var(--partial); }
.status-badge.PROPOSED { background: rgba(187,136,255,0.15); color: var(--proposed); border: 1px solid var(--proposed); }

.method-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(0,191,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(0,191,255,0.3);
}

/* === CONTENT VIEWS (non-graph) === */
#content-view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: 24px 32px;
  display: none;
}

#content-view.visible {
  display: block;
}

.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 4px;
}

.view-header .desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Card grid for methods */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.method-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.method-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.1);
  transform: translateY(-1px);
}

.method-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.method-card .card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.method-card .card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.method-card .card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
}

.method-card .meta-tag {
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-secondary);
}

.method-card .recursive-tag {
  background: rgba(255,0,255,0.15);
  color: var(--diagnosis);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Findings table */
.findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.findings-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.findings-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.findings-table tbody tr:hover {
  background: rgba(0, 191, 255, 0.05);
}

.findings-table td {
  padding: 10px 12px;
  vertical-align: top;
}

.findings-table .col-severity { width: 80px; }
.findings-table .col-name { width: 200px; font-weight: 600; }
.findings-table .col-source { width: 160px; color: var(--text-secondary); }
.findings-table .col-value { color: var(--text-secondary); }

/* Diagnosis view */
.diagnosis-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px 32px;
  line-height: 1.7;
  font-size: 14px;
  max-width: 900px;
}

.diagnosis-content h1, .diagnosis-content h2, .diagnosis-content h3 {
  color: var(--accent);
  margin: 20px 0 10px;
}

.diagnosis-content h3 { font-size: 16px; }

.diagnosis-content strong {
  color: var(--diagnosis);
}

.diagnosis-content ul, .diagnosis-content ol {
  padding-left: 24px;
  margin: 8px 0;
}

.diagnosis-content li { margin-bottom: 6px; }

.diagnosis-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.diagnosis-content em {
  color: var(--medium);
}

/* Topology view */
.topology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

.topology-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.topology-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0,191,255,0.1);
}

.topology-card .topo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.topology-card .topo-name {
  font-size: 14px;
  font-weight: 700;
}

.topology-card .topo-type {
  font-size: 10px;
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 3px;
  color: var(--text-secondary);
}

.topology-card .topo-where {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.topology-card .topo-analog {
  font-size: 11px;
  color: var(--medium);
  font-style: italic;
  margin-bottom: 8px;
}

.topology-card .topo-sw {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
}

.topology-card .topo-sw > div {
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
}

.topology-card .topo-sw .label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.topology-card .sw-strengths { border-left: 2px solid var(--active); }
.topology-card .sw-weaknesses { border-left: 2px solid var(--critical); }

/* Graph tooltip */
.graph-tooltip {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 11px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 300;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.graph-tooltip.visible { opacity: 1; }

.graph-tooltip .tt-name {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}

.graph-tooltip .tt-type {
  font-size: 10px;
  color: var(--text-secondary);
}

/* SVG graph styles */
.node-label {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 10px;
  fill: var(--text-primary);
  pointer-events: none;
  text-anchor: middle;
}

.link {
  stroke-opacity: 0.4;
}

.link:hover {
  stroke-opacity: 0.8;
}

/* Graph controls */
#graph-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  gap: 8px;
  z-index: 50;
}

.graph-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  transition: all 0.15s;
}

.graph-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.graph-btn.active {
  background: rgba(0,191,255,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Filter controls */
#filter-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 50;
}

.filter-chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 12px;
  font-family: inherit;
  font-size: 10px;
  transition: all 0.15s;
  user-select: none;
}

.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,191,255,0.1);
}

.filter-chip:hover {
  border-color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Selection highlight on graph */
.node-highlight {
  stroke: var(--accent);
  stroke-width: 3px;
  stroke-opacity: 0.8;
}
