:root {
  --group-column-width: 18%;
  --path-column-width: 40%;
  --substrate-column-width: 22%;
  --sample-column-width: 20%;
}

/* Table Container */
.table-container {
  margin: 1.5rem 0;
  overflow: auto;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Experiment Table Styles */
.experiment-table {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
  border-spacing: 0;
}

.experiment-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--neutral-2);
  font-weight: 600;
  padding: 0.9rem 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.experiment-table tbody tr {
  transition: background-color 0.2s;
}

/* Increase vertical spacing for better row separation */
.experiment-table tbody tr td {
    padding: 1.2rem 1.5rem;
}

/* Column specific styles */
.group-column {
  width: var(--group-column-width);
}

.path-column {
  width: var(--path-column-width);
}

.substrate-column {
  width: var(--substrate-column-width);
}

.sample-column {
  width: var(--sample-column-width);
  text-align: center;
}

.group-cell {
  vertical-align: top;
}

.group-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.path-cell {
  padding: 1rem;
  vertical-align: top;
}

.process-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  margin: 0.2rem 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-step-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.process-steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

.process-step-item {
  position: relative;
  margin-bottom: 0.2rem;
}

.process-step-item a {
  text-decoration: none;
  display: inline-block;
}

.substrate-cell {
  text-align: left;
}

.sample-cell {
  text-align: center;
}

.sample-link {
  font-weight: 500;
  text-decoration: none;
}

.sample-link:hover {
  text-decoration: underline;
}

.needs-sample {
  font-weight: 600;
}

/* Improved grouping visual cues */
.group-first-row td {
  border-top: 1px solid var(--gold-soft);
}

/* Add subtle row separator with alternating background */
.experiment-table tbody tr:nth-child(odd) {
  background-color: var(--neutral-1);
}

.experiment-table tbody tr:nth-child(even) {
  background-color: white;
}

/* Custom Process Step Tooltip Styles */
.process-step-tooltip {
  position: fixed;
  background: #1f2937;
  color: white;
  padding: 14px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  min-width: 320px;
  max-width: 600px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid #374151;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .process-step-tooltip {
    min-width: 250px;
    max-width: 95vw;
    font-size: 13px;
  }
}

.process-step-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.process-step-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}

/* Arrow pointing up (when tooltip is below the target) */
.process-step-tooltip.below::after {
  top: -12px;
  border-bottom-color: #1f2937;
}

/* Arrow pointing down (when tooltip is above the target) */
.process-step-tooltip.above::after {
  bottom: -12px;
  border-top-color: #1f2937;
}

.process-step-tooltip strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  color: #f9fafb;
}

.process-step-tooltip table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0;
  table-layout: fixed;
}

.process-step-tooltip td {
  padding: 2px 8px 2px 0;
  font-size: 13px;
  line-height: 1.3;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.process-step-tooltip td:first-child {
  font-weight: 500;
  color: #d1d5db;
  width: 65%;
  min-width: 80px;
  max-width: 160px;
  padding-right: 16px;
  text-overflow: ellipsis;
  overflow: hidden;
}

.process-step-tooltip td:last-child {
  color: #f3f4f6;
  width: 35%;
  word-break: break-word;
  hyphens: auto;
}

.process-step-tooltip .section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #374151;
}

.process-step-tooltip .section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* View Toggle */
.view-toggle-container {
  display: flex;
  gap: 8px;
  margin: 1rem 0;
}

.view-toggle {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle.active {
  background-color: var(--neutral-2);
  font-weight: 600;
}

.diff-view-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin: -0.35rem 0 0.9rem;
  font-size: 0.82rem;
  color: #475569;
}

.diff-view-legend[hidden] {
  display: none !important;
}

.diff-view-legend-label {
  font-weight: 600;
  color: #334155;
}

.diff-view-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.diff-view-legend-swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 2px;
  border-left: 4px solid transparent;
  background: #cbd5e1;
}

.diff-view-legend-swatch.diff-added {
  border-left-color: #16a34a;
  background: rgba(22, 163, 74, 0.3);
}

.diff-view-legend-swatch.diff-removed {
  border-left-color: #dc2626;
  background: rgba(220, 38, 38, 0.28);
}

.diff-view-legend-swatch.diff-changed {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.3);
}

/* Diff View Indicators */
.process-step-badge.diff-added,
.process-step-badge.diff-removed,
.process-step-badge.diff-changed {
  border-left-width: 12px;
  background-repeat: no-repeat;
  background-size: 64px 100%;
}

.process-step-badge.diff-added {
  border-left: 12px solid #16a34a;
  background-image: linear-gradient(
    to right,
    rgba(22,163,74,0.35) 0,
    rgba(22,163,74,0.16) 46px,
    transparent 64px
  );
}

.process-step-badge.diff-removed {
  border-left: 12px solid #dc2626;
  background-image: linear-gradient(
    to right,
    rgba(220,38,38,0.30) 0,
    rgba(220,38,38,0.14) 46px,
    transparent 64px
  );
  text-decoration: line-through;
  opacity: 0.7;
}

.process-step-badge.diff-changed {
  border-left: 12px solid #f59e0b;
  background-image: linear-gradient(
    to right,
    rgba(245,158,11,0.34) 0,
    rgba(245,158,11,0.16) 46px,
    transparent 64px
  );
}

.process-step-badge.diff-added::before {
  content: "+";
  margin-right: 6px;
  font-weight: 700;
}

.process-step-badge.diff-removed::before {
  content: "−";
  margin-right: 6px;
  font-weight: 700;
}

.process-step-badge.diff-changed::before {
  content: "~";
  margin-right: 6px;
  font-weight: 700;
}

.diff-no-changes {
  color: #6b7280;
  font-style: italic;
  padding: 0.5rem 0;
  font-size: 0.85rem;
}

.diff-baseline-label {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  background-color: var(--neutral-1);
  border-radius: 5px;
  display: inline-block;
}

/* Diff tooltip styles */
.process-step-tooltip .diff-header {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 6px;
  font-style: italic;
}

.process-step-tooltip .diff-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0;
}

.process-step-tooltip .diff-table th {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px 4px 0;
  border-bottom: 1px solid #374151;
  text-align: left;
  font-weight: 500;
}

.process-step-tooltip .diff-table td {
  padding: 2px 8px 2px 0;
  font-size: 13px;
  line-height: 1.3;
  vertical-align: top;
}

.process-step-tooltip .diff-table td:first-child {
  font-weight: 500;
  color: #d1d5db;
  min-width: 80px;
}

.process-step-tooltip .diff-value-variant {
  color: #86efac;
}

.process-step-tooltip .diff-value-baseline {
  color: #fca5a5;
}

.process-step-tooltip .diff-no-differences {
  color: #9ca3af;
  font-style: italic;
  padding: 4px 0;
}
