/* ==========================================================================
   TPVS Operational Knowledge Fabric Portal - Master Stylesheet
   Designed with premium dark theme aesthetics, glassmorphism, & subtle glows.
   ========================================================================== */

:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Vibrant Semantic Accents */
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.15);
  --accent-teal: #14b8a6;
  --accent-teal-glow: rgba(20, 184, 166, 0.15);
  --accent-pink: #ec4899;
  
  /* Nodes Color Codes */
  --color-app: #3b82f6;
  --color-service: #8b5cf6;
  --color-division: #10b981;
  --color-database: #f59e0b;
  --color-middleware: #ec4899;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.25);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout Base */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   Sleek Horizontal Top Navigation & Persona Bar
   ========================================================================== */
.top-nav-bar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  height: 72px;
  width: 100%;
  flex-shrink: 0;
  z-index: 100;
}

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

.brand .logo-icon {
  font-size: 24px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
}

.brand-text h1 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-text span {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Horizontal Persona Selection */
.persona-nav-container {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
  max-width: 1100px;
}

.persona-nav-horizontal {
  width: 100%;
}

.persona-list-horizontal {
  list-style: none;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.persona-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background-color: rgba(255, 255, 255, 0.01);
  flex: 1;
  max-width: 190px;
}

.persona-btn .icon {
  font-size: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.persona-btn .btn-desc {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.persona-btn h4 {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.persona-btn span {
  font-size: 8px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Hover & Active States */
.persona-btn:hover {
  background-color: rgba(255, 255, 255, 0.02);
  border-color: var(--glass-border);
}

.persona-btn:hover h4 {
  color: var(--text-primary);
}

.persona-btn.active {
  background: linear-gradient(135deg, var(--accent-blue-glow), var(--accent-purple-glow));
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.06);
}

.persona-btn.active h4 {
  color: var(--text-primary);
}

.persona-btn.active .icon {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
}

/* Horizontal Top Status Indicators */
.status-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-header .status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.status-header .status-row .label {
  color: var(--text-muted);
  font-weight: 500;
}

.status-header .status-row .val {
  color: var(--text-secondary);
  font-weight: 600;
}

/* System status footer */
.status-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.status-row .label {
  color: var(--text-muted);
}

.status-row .val {
  color: var(--text-secondary);
  font-weight: 500;
}

.status-row .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-row .dot.green {
  background-color: var(--accent-teal);
  box-shadow: 0 0 6px var(--accent-teal);
}

.status-row .dot.orange {
  background-color: var(--color-database);
  box-shadow: 0 0 6px var(--color-database);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-header {
  height: 80px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title h2 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.25px;
}

.header-title p {
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: 500;
  margin-top: 2px;
}

/* Metric Cards */
.metrics-bar {
  display: flex;
  gap: 16px;
}

.metric-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 110px;
}

.metric-card .num {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric-card .label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Dashboard Central Grid (Flexible & Resizable)
   ========================================================================== */
.dashboard-grid {
  display: flex;
  flex-direction: row;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.qa-pane {
  flex: 0 0 450px; /* Default width of Q&A pane */
  min-width: 280px;
  border-right: none;
}

.graph-pane {
  flex: 1;
  min-width: 400px;
}

/* Vertical Drag Resize Splitter */
.resize-handle {
  width: 8px;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  cursor: col-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.resize-handle:hover,
.resize-handle:active {
  background-color: rgba(139, 92, 246, 0.2); /* accent-purple */
  border-left-color: var(--accent-purple);
  border-right-color: var(--accent-purple);
}

.resize-indicator {
  width: 2px;
  height: 24px;
  background-color: var(--text-muted);
  border-radius: 1px;
  transition: background-color 0.2s ease;
}

.resize-handle:hover .resize-indicator,
.resize-handle:active .resize-indicator {
  background-color: var(--accent-purple);
}

.interaction-hint {
  font-size: 10px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 12px;
}

.interaction-hint em {
  color: var(--accent-purple);
  font-style: normal;
  font-weight: 500;
}


.pane-header {
  height: 48px;
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.01);
}

.pane-header h3 {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.pane-header .badge {
  font-size: 10px;
  padding: 2px 8px;
  background-color: var(--accent-purple-glow);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 20px;
  font-weight: 600;
}

/* ==========================================================================
   Left Pane: GraphRAG Q&A Engine
   ========================================================================== */
.qa-pane {
  background-color: rgba(10, 15, 29, 0.4);
}

.search-box {
  padding: 24px;
  display: flex;
  gap: 12px;
}

.search-box input {
  flex: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
  height: 46px;
}

.search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.search-box button {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  height: 46px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.search-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.35);
}

/* Suggestions Cards */
.suggestions-container {
  padding: 0 24px 16px 24px;
}

.suggestions-container h4 {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.suggestion-card:hover {
  background-color: rgba(255, 255, 255, 0.02);
  border-color: var(--accent-blue);
  color: var(--text-primary);
  padding-left: 20px;
}

/* Idle / Loading state styling */
.idle-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.idle-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
}

.idle-state h4 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.idle-state p {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

/* Grounded Response Output styling */
.output-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.meta-response {
  display: flex;
  gap: 8px;
}

.meta-response .badge {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.meta-response .confidence {
  background-color: var(--accent-teal-glow);
  color: var(--accent-teal);
  border: 1px solid rgba(20, 184, 166, 0.15);
}

.meta-response .path-badge {
  background-color: var(--accent-blue-glow);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.direct-answer h4,
.graph-path-box h4,
.evidence-panel h4,
.recommendations-panel h4 {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.direct-answer p {
  font-size: 13px;
  line-height: 1.6;
  color: #e5e7eb;
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: 12px;
}

.graph-path-box code {
  display: block;
  background-color: #030712;
  border: 1px solid var(--glass-border);
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-purple);
  overflow-x: auto;
}

.evidence-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evidence-panel li {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.evidence-panel li span {
  color: var(--accent-teal);
  font-weight: 600;
}

.recommendations-panel .recs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.02), rgba(139, 92, 246, 0.02));
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rec-card .bullet {
  color: var(--accent-purple);
  font-weight: 700;
}

/* ==========================================================================
   Right Pane: Interactive Graph Canvas
   ========================================================================== */
.graph-pane {
  background-color: #05070e;
  position: relative;
}

.graph-controls button {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.graph-controls button:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
  border-color: var(--text-muted);
}

.canvas-container {
  flex: 1;
  position: relative;
}

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

/* D3 Graph Rendering Styles */
.node-circle {
  stroke-width: 1.5px;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.node-circle:hover {
  filter: brightness(1.2) drop-shadow(0 0 6px rgba(255,255,255,0.2));
}

.link-line {
  stroke-opacity: 0.45; /* Raised from 0.15 for high visibility */
  stroke-width: 1.2px;
  fill: none;
}

.link-label {
  font-size: 8px;
  font-weight: 500;
  fill: var(--text-secondary); /* Raised from muted to light gray */
  pointer-events: none;
}


.node-label-text {
  font-size: 9px;
  fill: var(--text-secondary);
  pointer-events: none;
}

/* Floating Node Detail Panel */
.node-detail-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  max-height: calc(100% - 32px);
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border-hover);
  border-radius: 12px;
  padding: 18px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.node-detail-panel .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.node-detail-panel h4 {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 15px;
}

.node-detail-panel .detail-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.node-detail-panel hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin-bottom: 12px;
}

.detail-scroll {
  overflow-y: auto;
  flex: 1;
}

.node-detail-panel p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.meta-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-item .label {
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
}

.meta-item .val {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Floating Graph Legend Styles */
.graph-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 90;
  pointer-events: none; /* Allows canvas dragging beneath if clicked */
}

.graph-legend h4 {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

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

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.app-dot { background-color: var(--color-app); }
.service-dot { background-color: var(--color-service); }
.division-dot { background-color: var(--color-division); }
.database-dot { background-color: var(--color-database); }
.middleware-dot { background-color: var(--color-middleware); }

/* Show Full Graph Button Style */
#show-full-graph-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--text-primary);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

#show-full-graph-btn:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Relationship type lines in Legend */
.legend-line {
  width: 14px;
  height: 3px;
  border-radius: 1.5px;
  display: inline-block;
  vertical-align: middle;
}

/* Phase 2 Representative Technical Schema CSS classes */
.tech-schema-container {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.tech-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b5cf6; /* accent-purple */
  margin-top: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tech-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.tech-section h6 {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-item-full {
  display: flex;
  flex-direction: column;
}

.meta-item-full .label {
  color: var(--text-muted);
  font-size: 8px;
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}

.meta-item-full .val {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Utility Helpers */
.font-mono {
  font-family: 'Fira Code', 'Courier New', Courier, monospace !important;
}
.text-xs { font-size: 10px !important; }
.break-all { word-break: break-all !important; }
.bg-slate-900\/60 { background-color: rgba(15, 23, 42, 0.5) !important; }
.p-1.5 { padding: 6px !important; }
.rounded { border-radius: 4px !important; }
.border { border: 1px solid !important; }
.border-slate-800\/80 { border-color: rgba(30, 41, 59, 0.6) !important; }
.text-teal-400 { color: #2dd4bf !important; }
.text-emerald-400 { color: #34d399 !important; }
.text-emerald-300 { color: #6ee7b7 !important; }
.text-blue-300 { color: #93c5fd !important; }
.text-cyan-400 { color: #22d3ee !important; }
.text-amber-400 { color: #fbbf24 !important; }
.text-amber-300 { color: #fcd34d !important; }
.text-orange-400 { color: #fb923c !important; }
.text-pink-400 { color: #f472b6 !important; }
.text-pink-300 { color: #f9a8d4 !important; }
.text-purple-400 { color: #c084fc !important; }
.text-indigo-300 { color: #a5b4fc !important; }
.text-slate-400 { color: #94a3b8 !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.font-semibold { font-weight: 600 !important; }


