/* === Analysis View === */

#view-analysis {
  padding: 0;
  overflow: hidden;
}

.analysis-view-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ana-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-height: 0;
}

.ana-header {
  padding: 1.5rem 2rem 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
  flex-shrink: 0;
}
.ana-header h1 {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}
.ana-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.ana-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.7rem 2rem;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ana-tab {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 120ms ease;
}
.ana-tab:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}
.ana-tab.active {
  background: var(--primary-accent);
  color: white;
  border-color: var(--primary-accent);
}

.ana-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 2rem 2rem;
}

.ana-section {
  max-width: 1200px;
  margin: 0 auto;
}

.ana-section h2 {
  font-size: 1.3rem;
  margin: 1.4rem 0 0.8rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--secondary-accent);
  display: inline-block;
  color: var(--text-primary);
}
.ana-section h2:first-child {
  margin-top: 0;
}
.ana-section h3 {
  font-size: 1.05rem;
  margin: 1.2rem 0 0.5rem 0;
  color: var(--text-primary);
}
.ana-section p,
.ana-section li {
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.55;
}
.ana-section ul,
.ana-section ol {
  padding-left: 1.4rem;
  margin: 0.4rem 0 0.8rem 0;
}
.ana-section ul li,
.ana-section ol li {
  margin-bottom: 0.45rem;
}

.ana-section code,
.ana-natural,
.ana-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--hover-bg);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  color: var(--text-primary);
}
.ana-natural {
  display: inline-block;
  word-break: break-all;
  font-size: 0.8rem;
}
.ana-code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--hover-bg);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  word-break: break-all;
  white-space: pre-wrap;
  margin: 0.5rem 0 0.8rem 0;
}

.ana-section-intro {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* --- Cards --- */
.ana-cards,
.ana-joint-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin: 0.8rem 0 1.2rem 0;
}
.ana-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.ana-card-large {
  padding: 1rem 1.2rem;
}
.ana-card-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.ana-card-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-accent);
  line-height: 1.1;
}
.ana-card-foot {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

/* --- Key findings --- */
.ana-key-findings {
  counter-reset: findings;
  list-style: none;
  padding-left: 0;
}
.ana-key-findings > li {
  position: relative;
  padding: 0.6rem 0.8rem 0.6rem 2.6rem;
  margin-bottom: 0.6rem;
  background: var(--surface-color);
  border-left: 4px solid var(--secondary-accent);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  border-left-width: 4px;
}
.ana-key-findings > li::before {
  counter-increment: findings;
  content: counter(findings);
  position: absolute;
  left: 0.7rem;
  top: 0.6rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--secondary-accent);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Tables --- */
.ana-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.7rem 0;
}
#ana-feature-filter {
  flex: 1;
  max-width: 320px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface-color);
  color: var(--text-primary);
}
.ana-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.ana-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.5rem 0 1.2rem 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.ana-table thead th {
  background: var(--bg-color);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ana-table tbody tr {
  border-bottom: 1px solid var(--border-color);
}
.ana-table tbody tr:last-child {
  border-bottom: none;
}
.ana-table tbody tr:hover {
  background: var(--hover-bg);
}
.ana-table tbody td {
  padding: 0.55rem 0.8rem;
  vertical-align: top;
}
.ana-feature-name {
  font-weight: 500;
  font-size: 0.9rem;
}
.ana-table .ana-num {
  font-family: var(--font-mono);
}
.ana-table .ana-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.ana-empty td {
  color: var(--text-secondary);
  font-style: italic;
}
.ana-concat {
  color: var(--primary-accent);
  font-weight: 600;
}

/* --- p-value badges --- */
.ana-p-badge {
  display: inline-flex;
  align-items: baseline;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--hover-bg);
  color: var(--text-primary);
}
.ana-p-badge strong {
  font-weight: 700;
}
.ana-p-common  { background: #e2e8f0; color: #334155; }
.ana-p-mild    { background: #fef3c7; color: #92400e; }
.ana-p-moderate{ background: #fed7aa; color: #9a3412; }
.ana-p-strong  { background: #fecaca; color: #991b1b; }
.ana-p-extreme { background: #b91c1c; color: white; }

.ana-table tr.ana-p-common  td:first-child { border-left: 3px solid #cbd5e1; }
.ana-table tr.ana-p-mild    td:first-child { border-left: 3px solid #fbbf24; }
.ana-table tr.ana-p-moderate td:first-child { border-left: 3px solid #fb923c; }
.ana-table tr.ana-p-strong  td:first-child { border-left: 3px solid #f87171; }
.ana-table tr.ana-p-extreme td:first-child { border-left: 3px solid #b91c1c; }

/* --- Section summary --- */
.ana-section-summary {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-top: 1rem;
}
.ana-section-summary h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* --- Special tests --- */
.ana-special-group {
  margin-bottom: 1.4rem;
}
.ana-special-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.ana-special-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  user-select: none;
  background: var(--surface-color);
  transition: background 120ms;
}
.ana-special-head:hover {
  background: var(--hover-bg);
}
.ana-special-icon {
  color: var(--text-secondary);
  font-size: 0.85rem;
  width: 1rem;
}
.ana-special-name {
  font-weight: 500;
  font-size: 0.92rem;
  flex: 1;
}
.ana-special-body {
  padding: 0.6rem 1rem 0.9rem 2.4rem;
  font-size: 0.88rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
}
.ana-special-card.ana-open .ana-special-icon {
  color: var(--primary-accent);
}
.ana-claim,
.ana-result,
.ana-verified,
.ana-extra,
.ana-discussion {
  margin-bottom: 0.4rem;
}
.ana-discussion {
  color: var(--text-secondary);
  line-height: 1.55;
  border-left: 3px solid var(--border-color);
  padding-left: 0.8rem;
  margin-top: 0.5rem;
}
.ana-true  { color: var(--success-color); font-weight: 700; }
.ana-false { color: #dc2626; font-weight: 700; }

/* --- Conclusion --- */
.ana-conclusion ul {
  list-style: none;
  padding-left: 0;
}
.ana-conclusion ul.ana-good > li,
.ana-conclusion ul.ana-neutral > li,
.ana-conclusion ul.ana-warn > li,
.ana-conclusion ul.ana-final > li {
  position: relative;
  padding: 0.5rem 0.7rem 0.5rem 2rem;
  margin-bottom: 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}
.ana-conclusion ul.ana-good > li {
  background: rgba(16,185,129,0.06);
  border-left: 4px solid #10b981;
}
.ana-conclusion ul.ana-good > li::before {
  content: '✓';
  position: absolute;
  left: 0.6rem;
  top: 0.5rem;
  color: #10b981;
  font-weight: 700;
  font-size: 1.05rem;
}
.ana-conclusion ul.ana-neutral > li {
  background: rgba(100,116,139,0.06);
  border-left: 4px solid #64748b;
}
.ana-conclusion ul.ana-neutral > li::before {
  content: '•';
  position: absolute;
  left: 0.7rem;
  top: 0.4rem;
  color: #64748b;
  font-size: 1.4rem;
}
.ana-conclusion ul.ana-warn > li {
  background: rgba(234,179,8,0.07);
  border-left: 4px solid #eab308;
}
.ana-conclusion ul.ana-warn > li::before {
  content: '⚠';
  position: absolute;
  left: 0.55rem;
  top: 0.5rem;
  color: #ca8a04;
}
.ana-conclusion ul.ana-final > li {
  background: rgba(37,99,235,0.06);
  border-left: 4px solid var(--primary-accent);
}
.ana-conclusion ul.ana-final > li::before {
  content: '→';
  position: absolute;
  left: 0.6rem;
  top: 0.5rem;
  color: var(--primary-accent);
  font-weight: 700;
}

.ana-final-quote {
  margin: 1rem 0;
  padding: 1rem 1.2rem;
  background: var(--surface-color);
  border-left: 5px solid var(--primary-accent);
  border-radius: 6px;
  font-style: italic;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.ana-final-quote p { margin: 0; line-height: 1.6; }

/* --- Histogram bars (Symmetry tab) --- */
.ana-histogram td:last-child { width: 50%; }
.ana-bar {
  height: 14px;
  background: linear-gradient(90deg, var(--secondary-accent), var(--primary-accent));
  border-radius: 3px;
  display: block;
}

/* --- Loading & error --- */
.ana-loading,
.ana-error {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}
.ana-error {
  color: #dc2626;
}

/* --- Responsive --- */
@media (max-width: 760px) {
  .ana-header { padding: 1rem; }
  .ana-tabs   { padding: 0.5rem 1rem; }
  .ana-body   { padding: 1rem; }
  .ana-tab    { font-size: 0.78rem; padding: 0.35rem 0.7rem; }
  .ana-table  { font-size: 0.78rem; }
  .ana-table thead th { padding: 0.4rem 0.5rem; }
  .ana-table tbody td { padding: 0.4rem 0.5rem; }
}
