/* MaxDiff Analyzer — tool-specific overrides only.
   Everything structural (cards, buttons, dropzone, workflow stepper, badges)
   comes from shared/css/main.css. */

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

.stat-card {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.stat-card__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--app-accent);
  line-height: 1.2;
}

.stat-card__label {
  font-size: 0.75rem;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
}

.chart-box {
  width: 100%;
  min-height: 380px;
  margin: 0.75rem 0 1.5rem;
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.results-table th,
.results-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--app-border);
  text-align: right;
  white-space: nowrap;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  text-align: left;
  white-space: normal;
  min-width: 200px;
}

.results-table thead th {
  background: var(--app-bg);
  font-weight: 600;
  border-bottom: 2px solid var(--app-border);
}

.results-table tbody tr:hover {
  background: var(--app-bg);
}

/* A row whose interval overlaps the row above it is not a distinguishable
   step down the ranking, and the table says so rather than leaving the reader
   to infer a difference from adjacency alone. */
.results-table tr.is-tied td {
  color: var(--app-muted);
}

.tie-flag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.5rem 0 0.75rem;
}

.mini-table th,
.mini-table td {
  border: 1px solid var(--app-border);
  padding: 0.35rem 0.55rem;
  text-align: left;
}

.mini-table thead th {
  background: var(--app-bg);
}

.diagnostic-panel {
  border: 1px solid var(--app-border);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.diagnostic-panel h4 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
}

.diagnostic-panel ul {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
}

.diagnostic-panel--ok {
  border-left-color: var(--app-success);
  background: #f2fbf6;
}

.diagnostic-panel--warn {
  border-left-color: var(--app-warning);
  background: #fffaf0;
}

.diagnostic-panel--bad {
  border-left-color: var(--app-danger);
  background: #fdf3f3;
}

.segmentation-controls {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.scenario-download-btn {
  margin-top: 0.75rem;
}

/* ── Case-study blocks ──────────────────────────────────────────────
   main.css already provides .scenario-description, .scenario-header,
   .scenario-icon, .scenario-badge, .scenario-variables, .context-grid,
   .context-item/.context-label/.context-value and .scenario-insights.
   Only the classes it lacks are defined here. */

.scenario-intro {
  font-size: 1rem;
  color: #475569;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid var(--app-accent);
}

.scenario-description h5 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.scenario-questions,
.scenario-tip {
  margin-top: 1.25rem;
}

.scenario-questions {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 1rem 1rem 1rem 0.75rem;
}

.scenario-questions h5 {
  color: #5b21b6;
  margin-left: 0.25rem;
}

.scenario-questions ol {
  margin: 0;
  padding-left: 1.4rem;
}

.scenario-questions li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.scenario-questions li:last-child {
  margin-bottom: 0;
}

.scenario-tip {
  background: #fffaf0;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #78350f;
}

.scenario-var-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.scenario-var-table caption {
  caption-side: top;
  text-align: left;
  color: var(--app-muted);
  font-size: 0.8rem;
  padding-bottom: 0.4rem;
}

.scenario-var-table th {
  text-align: left;
  font-weight: 600;
  padding: 0.35rem 0.5rem 0.35rem 0;
  border-bottom: 2px solid var(--app-border);
  color: var(--app-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.scenario-var-table td {
  padding: 0.5rem 0.5rem 0.5rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--app-border);
}

.scenario-var-table tr:last-child td {
  border-bottom: none;
}

.scenario-var-table td:first-child {
  width: 190px;
  white-space: nowrap;
}

.scenario-var-table code {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #0f172a;
}

.var-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.var-tag.id          { background: #ede9fe; color: #5b21b6; }
.var-tag.time        { background: #e0f2fe; color: #075985; }
.var-tag.categorical { background: #dbeafe; color: #1e40af; }
.var-tag.binary      { background: #fef3c7; color: #92400e; }
.var-tag.outcome     { background: #dcfce7; color: #166534; }
.var-tag.predictor   { background: #dbeafe; color: #1e40af; }

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .segmentation-controls {
    grid-template-columns: 1fr;
  }
  .chart-box {
    min-height: 460px;
  }
}
