/* Comparison Table Styles */
:root {
  /* Highlight colours at ~20% opacity */
  --highlight-1: rgba(255, 244, 179, 0.3);  /* Very light yellow - enterprise */
  --highlight-2: rgba(255, 205, 179, 0.35); /* Light orange-red */
  --highlight-3: rgba(255, 171, 145, 0.4);  /* Medium orange-red */
  --highlight-4: rgba(255, 138, 128, 0.45); /* Strong red-orange */
  --highlight-5: rgba(239, 83, 80, 0.5);    /* Intense red */

  /* Table cell max width - configurable */
  --table-cell-max-width: 300px;

  /* Positive highlight colour for Yes/True values */
  --highlight-positive: rgba(173, 216, 230, 0.6); /* Light blue - more visible */
}

/* Wide table - centered */
.wide-table {
  width: 95vw !important;
  max-width: 95vw !important;
  position: relative !important;
  left: 50% !important;
  right: 50% !important;
  margin-left: -47.5vw !important;
  margin-right: -47.5vw !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  margin-top: 2rem !important;
  margin-bottom: 2rem !important;
}

.comparison-table-wrapper {
  padding: 0 2rem;
  display: flex;
  justify-content: center;
}

.comparison-table {
  width: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
  background-color: white;
  margin: 0 auto;
  table-layout: auto;
}

.comparison-table th {
  background-color: #e3f2fd !important;
  padding: 0.75rem;
  text-align: center !important;
  vertical-align: middle !important;
  font-weight: 600;
  border: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: var(--table-cell-max-width);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Tool header colours - manually configured */
.comparison-table th.tool-avg-0 {
  background-color: rgba(173, 216, 230, 0.7) !important; /* Light blue - best */
}

.comparison-table th.tool-avg-1 {
  background-color: rgba(255, 244, 179, 0.7) !important; /* Light yellow */
}

.comparison-table th.tool-avg-2 {
  background-color: rgba(255, 205, 179, 0.7) !important; /* Light orange */
}

.comparison-table th.tool-avg-3 {
  background-color: rgba(255, 171, 145, 0.7) !important; /* Orange-red */
}

.comparison-table th.tool-avg-4 {
  background-color: rgba(255, 138, 128, 0.7) !important; /* Red-orange */
}

.comparison-table th.tool-avg-5 {
  background-color: rgba(239, 83, 80, 0.7) !important; /* Red - worst */
}

.comparison-table td {
  padding: 0.75rem;
  border: 1px solid #ddd;
  vertical-align: middle;
  background-color: white;
  max-width: var(--table-cell-max-width);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  text-align: center;
}

.comparison-table .feature-column {
  background-color: #f0f4f7 !important;
  font-weight: 500;
}

.comparison-table .feature-name {
  background-color: #f0f4f7 !important;
  font-weight: 500;
  min-width: 200px;
  position: sticky;
  left: 0;
  z-index: 5;
}

.comparison-table .category-row {
  background-color: white !important;
}

.comparison-table .category-name {
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  background-color: white !important;
}

/* Highlight levels - with !important to override theme styles */
.comparison-table td.highlight-0 {
  background-color: rgba(173, 216, 230, 0.5) !important; /* Light blue for positive/good */
}

.comparison-table td.highlight-1 {
  background-color: var(--highlight-1) !important;
}

.comparison-table td.highlight-2 {
  background-color: var(--highlight-2) !important;
}

.comparison-table td.highlight-3 {
  background-color: var(--highlight-3) !important;
}

.comparison-table td.highlight-4 {
  background-color: var(--highlight-4) !important;
}

.comparison-table td.highlight-5 {
  background-color: var(--highlight-5) !important;
}

/* Legend styles */
.comparison-legend {
  margin: 1rem auto 2rem auto;
  padding: 1rem;
  background-color: #f5f5f5;
  border-radius: 4px;
  max-width: 800px;
}

.comparison-legend h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
}

.comparison-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.comparison-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.legend-swatch {
  display: inline-block;
  width: 40px;
  height: 20px;
  border: 1px solid #ddd;
  border-radius: 2px;
}

.legend-swatch.highlight-1 {
  background-color: var(--highlight-1) !important;
}

.legend-swatch.highlight-2 {
  background-color: var(--highlight-2) !important;
}

.legend-swatch.highlight-3 {
  background-color: var(--highlight-3) !important;
}

.legend-swatch.highlight-4 {
  background-color: var(--highlight-4) !important;
}

.legend-swatch.highlight-5 {
  background-color: var(--highlight-5) !important;
}

/* Cell link styling */
.comparison-table td .cell-link {
  color: inherit;
  text-decoration: none;
  display: block;
  cursor: pointer !important;
  position: relative;
  z-index: 10;
  width: 100%;
}

.comparison-table td .cell-link:hover {
  text-decoration: underline;
}

/* Cells with links should have pointer cursor */
.comparison-table td.has-cell-link {
  cursor: pointer !important;
  padding: 0;
}

.comparison-table td.has-cell-link .cell-link {
  padding: 0.75rem;
  cursor: pointer !important;
}

/* Tooltip styling - tooltips are JavaScript-driven only */
.comparison-table td[data-tooltip] {
  position: relative;
}

/* Cell has tooltip but no link */
.comparison-table td.has-tooltip:not(.has-cell-link) {
  cursor: help;
}

/* Cell has both link and tooltip - link cursor takes precedence */
.comparison-table td.has-cell-link[data-tooltip] {
  cursor: pointer !important;
}

.comparison-table td.has-cell-link[data-tooltip] .cell-link {
  cursor: pointer !important;
}

@media (max-width: 768px) {
  .wide-table {
    padding: 0 1rem !important;
    margin-left: -47.5vw !important;
  }

  .comparison-table {
    font-size: 0.8rem;
  }

  .comparison-table td,
  .comparison-table th {
    padding: 0.5rem;
  }

  .comparison-table .feature-name {
    min-width: 150px;
  }

  /* Adjust tooltip size for mobile */
  .comparison-table td[data-tooltip]::after {
    max-width: 250px;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}

/* Interactive tooltips with clickable links */
.interactive-tooltip {
  position: fixed;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  max-width: 400px;
  width: auto;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.interactive-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Position is now handled by JavaScript for fixed positioning */

.tooltip-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.interactive-tooltip.top .tooltip-arrow {
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  border-top-color: rgba(0, 0, 0, 0.9);
  border-bottom: none;
}

.interactive-tooltip.bottom .tooltip-arrow {
  top: 0;
  transform: translateX(-50%) translateY(-100%);
  border-bottom-color: rgba(0, 0, 0, 0.9);
  border-top: none;
}

.tooltip-link {
  color: #66b3ff;
  text-decoration: underline;
  cursor: pointer;
  word-break: break-all;
}

.tooltip-link:hover {
  color: #99ccff;
}

/* Cells with interactive tooltips */
.comparison-table td.has-interactive-tooltip {
  cursor: help;
}

@media (max-width: 768px) {
  .interactive-tooltip {
    max-width: 250px;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}
