/* LLM Psychographic Behavior Analysis Dashboard — Stylesheet (light mode) */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f1f5f9; color: #1e293b; line-height: 1.6; }
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; color: #0f172a; }
h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 12px; color: #334155; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: #475569; }
.subtitle { color: #64748b; font-size: 0.95rem; margin-bottom: 24px; }
.grid { display: grid; gap: 20px; margin-bottom: 24px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.card { background: #ffffff; border-radius: 12px; padding: 20px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat { text-align: center; padding: 16px; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-top: 4px; }
.stat-sub { font-size: 0.75rem; color: #94a3b8; }
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100% !important; }
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; transition: all 0.2s; }
.tab:hover { background: #e2e8f0; }
.tab.active { background: #3b82f6; color: white; border-color: #3b82f6; }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 0.8rem; table-layout: fixed; }
.heatmap th { padding: 8px 6px; text-align: center; color: #475569; font-weight: 600; font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heatmap th:first-child { text-align: left; width: 100px; }
.heatmap td { padding: 0; text-align: center; font-weight: 600; }
.hm-cell { display: flex; align-items: center; justify-content: center; padding: 10px 4px; border-radius: 6px; font-size: 0.82rem; letter-spacing: 0.02em; transition: transform 0.12s, box-shadow 0.12s; min-height: 40px; }
.hm-cell:hover { transform: scale(1.06); z-index: 2; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.hm-wrap { background: #f8fafc; border-radius: 12px; padding: 20px; border: 1px solid #e2e8f0; }
.hm-wrap .heatmap .row-label { color: #334155; }
.hm-wrap .heatmap th { color: #64748b; }
.toggle-group { display: inline-flex; border-radius: 8px; overflow: hidden; border: 1px solid #d1d5db; }
.toggle-btn { padding: 5px 14px; font-size: 0.8rem; cursor: pointer; background: #f8fafc; color: #64748b; border: none; transition: all 0.15s; }
.toggle-btn:hover { background: #f1f5f9; }
.toggle-btn.active { background: #3b82f6; color: white; }
.radar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.radar-grid-item { background: #f8fafc; border-radius: 10px; padding: 12px; border: 1px solid #e2e8f0; }
.radar-grid-item h4 { text-align: center; font-size: 0.85rem; margin-bottom: 6px; }
.heatmap tr:hover .hm-cell { filter: brightness(0.97); }
.heatmap .row-label { text-align: left; color: #334155; font-weight: 600; white-space: nowrap; padding: 8px 6px; }
.legend { display: flex; gap: 16px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: #64748b; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-high { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-med { background: rgba(245, 158, 11, 0.1); color: #b45309; }
.badge-low { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
select { background: #ffffff; color: #1e293b; border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 12px; font-size: 0.85rem; cursor: pointer; }
select:focus { outline: 2px solid #3b82f6; }
.quadrant-label { position: absolute; font-size: 0.7rem; color: #94a3b8; font-weight: 600; pointer-events: none; }
.section { margin-bottom: 32px; }
.insight { background: #eff6ff; border-left: 3px solid #3b82f6; padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 12px 0; font-size: 0.85rem; color: #1d4ed8; }
.bar-mini { display: inline-block; height: 8px; border-radius: 4px; }
.model-color-0 { color: #3b82f6; }
.model-color-1 { color: #f59e0b; }
.model-color-2 { color: #10b981; }
.model-color-3 { color: #ef4444; }
.model-color-4 { color: #8b5cf6; }
.model-color-5 { color: #ec4899; }
.persona-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; }
.persona-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.persona-meta { font-size: 0.8rem; color: #64748b; }
.scroll-x { overflow-x: auto; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { margin: 0; }
.page-header .subtitle { margin: 4px 0 0; }
.page-header-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.nav { display: flex; flex-direction: column; gap: 0; margin-bottom: 24px; }
.nav-row { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 2px solid #e2e8f0; }
.nav-row-primary { background: #ffffff; }
.nav-row-secondary { background: #f8fafc; border-top: 1px solid #e2e8f0; }
.nav-sep { width: 1px; background: #e2e8f0; margin: 6px 4px; align-self: stretch; flex-shrink: 0; }
.nav-btn { padding: 10px 18px; cursor: pointer; font-size: 0.85rem; font-weight: 600; background: transparent; color: #475569; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.nav-btn:hover { color: #1e293b; background: #f1f5f9; }
.nav-btn.active { color: #3b82f6; border-bottom-color: #3b82f6; }
/* Overview home button */
.nav-home { color: #94a3b8; font-size: 0.82rem; letter-spacing: 0.02em; }
.nav-home:hover { color: #475569; }
.nav-home.active { color: #334155; border-bottom-color: #94a3b8; }
/* Analytical tabs — distinct accent colors in primary tier */
.nav-analytical[data-panel="primetric"] { color: #d97706; }
.nav-analytical[data-panel="primetric"]:hover { color: #b45309; background: #fffbeb; }
.nav-analytical[data-panel="primetric"].active { color: #b45309; border-bottom-color: #d97706; background: #fffbeb; }
.nav-analytical[data-panel="psi"] { color: #6366f1; }
.nav-analytical[data-panel="psi"]:hover { color: #4f46e5; background: #eef2ff; }
.nav-analytical[data-panel="psi"].active { color: #4f46e5; border-bottom-color: #6366f1; background: #eef2ff; }
.nav-analytical[data-panel="comparison"] { color: #059669; }
.nav-analytical[data-panel="comparison"]:hover { color: #047857; background: #ecfdf5; }
.nav-analytical[data-panel="comparison"].active { color: #047857; border-bottom-color: #059669; background: #ecfdf5; }
/* Secondary tier — slightly smaller */
.nav-row-secondary .nav-btn { font-size: 0.8rem; padding: 8px 15px; color: #64748b; }
.nav-row-secondary .nav-btn:hover { color: #334155; background: #f1f5f9; }
.nav-row-secondary .nav-btn.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.panel { display: none; }
.panel.active { display: block; }
.tooltip-custom { position: absolute; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px; font-size: 0.8rem; color: #334155; z-index: 100; pointer-events: none; max-width: 300px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Chart info links (🔍 and 🛟) */
.chart-info-link { cursor: pointer; font-size: 0.85rem; margin-left: 8px; opacity: 0.6; transition: opacity 0.15s; text-decoration: none; }
.chart-info-link:hover { opacity: 1; }

/* Sortable table headers */
.heatmap th.sortable { cursor: pointer; user-select: none; }
.heatmap th.sortable:hover { color: #334155; }
.heatmap th.sortable::after { content: ' \2195'; font-size: 0.65rem; opacity: 0.4; }
.heatmap th.sort-asc::after { content: ' \2191'; opacity: 1; }
.heatmap th.sort-desc::after { content: ' \2193'; opacity: 1; }

/* Comparison table */
.comp-table { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 0.82rem; }
.comp-table th { padding: 10px 8px; text-align: center; font-weight: 600; font-size: 0.8rem; white-space: nowrap; color: #475569; }
.comp-table td { padding: 0; text-align: center; }
.comp-table td:first-child { text-align: left; color: #334155; font-weight: 600; padding: 8px 10px; white-space: nowrap; }
.comp-cell { display: flex; align-items: center; justify-content: center; padding: 8px 6px; border-radius: 4px; min-height: 36px; background: #f8fafc; color: #334155; font-weight: 500; font-variant-numeric: tabular-nums; }
.comp-cell-light { background: #fff; color: #334155; }
.comp-heatmap .comp-cell { border-radius: 4px; font-weight: 600; }
.comp-arch { font-size: 0.78rem; color: #64748b; font-weight: 500; }
.comp-section td { padding: 14px 10px 6px; font-weight: 700; font-size: 0.85rem; color: #1e293b; border-bottom: 1px solid #e2e8f0; background: none; }
.comp-subrow { padding-left: 24px !important; color: #64748b !important; font-weight: 500 !important; }
/* Primetric Pair Breakdown: white-background heatmap context overrides */
.hm-wrap .comp-table th { color: #475569; }
.hm-wrap .comp-table td:first-child { color: #334155; }
.hm-wrap .comp-section td { color: #64748b !important; font-size: 0.8rem; border-bottom-color: #e2e8f0; }
.hm-wrap .comp-subrow { color: #64748b !important; }

/* Loading spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }

/* === PRIMAL BIAS CHART === */
.pb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .pb-grid { grid-template-columns: 1fr; }
}
.pb-model-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}
.pb-model-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pb-model-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pb-model-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}
.pb-model-meta {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-left: auto;
  white-space: nowrap;
}
/* Side-by-side CxP | PxC columns within each model panel */
.pb-panel-cols {
  display: flex;
  gap: 0;
}
.pb-condition-col {
  flex: 1;
  min-width: 0;
  padding: 6px 10px 10px;
}
.pb-net-card {
  text-align: center;
  margin-bottom: 8px;
}
.pb-net-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.pb-net-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.pb-net-sublabel {
  font-size: 0.62rem;
  color: #94a3b8;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 1px;
}
.pb-net-positive { color: #10b981; }
.pb-net-negative { color: #ef4444; }
.pb-net-neutral  { color: #94a3b8; }

/* Model selector checkboxes */
.pb-model-check {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #64748b;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}
.pb-model-check.selected {
  color: #1e293b;
  border-color: #d1d5db;
}
.pb-model-check input[type="checkbox"] {
  accent-color: var(--model-color, #3b82f6);
  width: 13px;
  height: 13px;
}

/* Primal bias table — vertical layout (models as rows, white background via hm-wrap) */
.pb-table-v {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.82rem;
}
.pb-table-v th {
  padding: 7px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: #475569;
  white-space: nowrap;
  background: #f8fafc;
}
.pb-table-v th:first-child { text-align: left; }
.pb-table-v td {
  padding: 6px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: #fff;
}

/* Legend for primal bias */
.pb-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  justify-content: center;
}
.pb-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #64748b;
}
.pb-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
