/* Force table layout and prevent auto-sizing */
#benchmarksTable {
  table-layout: fixed !important;
  width: 100% !important;
}

/* Ensure cells respect width constraints */
#benchmarksTable th,
#benchmarksTable td {
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  padding: 8px !important;
  word-wrap: break-word;
}

/* Expandable cell base styles */
.cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4em;
  max-height: calc(var(--lines, 2) * 1.4em);
  cursor: pointer;
  transition: max-height 0.3s ease;
  word-break: break-word;
  position: relative;
}

.cell-clamp:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.cell-clamp.one-line {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  -webkit-line-clamp: 1;
  max-height: 1.4em;
  overflow-wrap: normal;
  word-break: normal;
}

.cell-clamp:not(.one-line) {
  -webkit-line-clamp: var(--lines, 2);
  white-space: normal;
}

/* Expanded state */
.cell-clamp.expanded {
  -webkit-line-clamp: unset;
  max-height: none;
  white-space: normal;
  background-color: rgba(0, 123, 255, 0.05);
}

/* Link styles within cells */
.cell-clamp a {
  color: #0066cc;
  text-decoration: underline;
}

.cell-clamp a:hover {
  color: #004499;
}

/* Name link styles */
.name-text {
  display: block;
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
}

.name-badges {
  display: block;
  margin-top: 0.35rem;
}

.name-link {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: inherit;
}

.name-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.55);
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.name-badge--detail { }
.name-badge--source {
  color: var(--md-primary-fg-color);
  border-color: color-mix(in srgb, var(--md-primary-fg-color) 30%, transparent);
  background: color-mix(in srgb, var(--md-primary-fg-color) 8%, white 92%);
}

.name-badge:hover,
.name-badge:focus {
  background: rgba(0,0,0,0.12);
  color: rgba(0,0,0,0.75);
}

.name-badge--source:hover,
.name-badge--source:focus {
  background: color-mix(in srgb, var(--md-primary-fg-color) 16%, white 84%);
  color: color-mix(in srgb, var(--md-primary-fg-color) 85%, black 15%);
}

.avg-rating-value {
  font-weight: 700;
}


/* Vertical header text - only affects the TH header, not TD cells */
th.has-vertical-text {
  height: 150px;
  white-space: nowrap;
  vertical-align: bottom !important;
  padding: 4px !important;
}

th.has-vertical-text .vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  display: inline-block;
  white-space: nowrap;
  padding: 8px 0;
}

/* Ensure body cells remain horizontal */
td {
  writing-mode: horizontal-tb !important;
  text-orientation: initial !important;
}

/* Copyable cells styling */
.js-copyable {
  cursor: copy !important;
  position: relative;
}

.js-copyable:hover {
  background-color: rgba(76, 175, 80, 0.1) !important;
  border: 1px dashed #4CAF50;
}

.js-copyable::before {
  content: '📋';
  position: absolute;
  right: 4px;
  top: 4px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.js-copyable:hover::before {
  opacity: 0.6;
}

/* DataTables wrapper adjustments */
.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
}

.dataTables_scrollBody {
  overflow-x: auto !important;
}

/* Fixed column styles */
.DTFC_LeftWrapper table {
  table-layout: fixed !important;
}

/* Center alignment for specific columns */

table.dataTable tbody td.dt-center,
table.dataTable tbody th.dt-center {
  text-align: center !important;
}

table.dataTable tbody td.dt-right,
table.dataTable tbody th.dt-right {
  text-align: right !important;
}

table.dataTable thead th.dt-center,
table.dataTable thead th.dt-right {
  text-align: left !important;
}

.dt-nowrap {
  white-space: nowrap !important;
}

/* Improve button toolbar */
.dt-buttons {
  margin-bottom: 10px;
}

.dt-button {
  margin-right: 5px;
  padding: 6px 12px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.dt-button:hover {
  background-color: #e9ecef;
}

.dt-button-collection {
  max-height: 320px;
  overflow-y: auto !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.dt-button-collection .dt-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.dt-button-collection .dt-button span.dt-column-title {
  flex: 1;
  text-align: left;
}

.dt-button-collection .dt-button span.dt-button-check {
  margin-left: 0.75rem;
}

/* Search box styling */
.dataTables_filter input {
  padding: 6px 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-left: 8px;
}

/* Layout: make the table page span full width */
.md-main:has(#benchmarksTable) .md-sidebar,
.md-main:has(#benchmarksTable) .md-sidebar--primary,
.md-main:has(#benchmarksTable) .md-sidebar--secondary {
  display: none !important;
}

.md-main:has(#benchmarksTable) .md-main__inner {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 100vw !important;
  width: 100% !important;
  padding: 0 !important;
}

.md-main:has(#benchmarksTable) .md-content,
.md-main:has(#benchmarksTable) .md-content__inner,
.md-main:has(#benchmarksTable) .md-typeset {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
}

.md-main:has(#benchmarksTable) .md-content__inner {
  padding: 0 1.5rem 1.5rem !important; /* add subtle horizontal gutter */
}

.md-typeset:has(#benchmarksTable) table {
  table-layout: fixed;     /* let column widths apply and wrap inside cells */
  width: 100%;
}

.md-typeset:has(#benchmarksTable) table th,
.md-typeset:has(#benchmarksTable) table td {
  /* Wrapping behavior */
  white-space: normal;        /* allow line breaks */
  word-break: normal;         /* do NOT split words by default */
  overflow-wrap: break-word;  /* only break very long tokens if they overflow */
  hyphens: auto;              /* soft hyphenation (needs html[lang] set, e.g. en) */
  line-height: 1.25;
  padding-top: .5em;
  padding-bottom: .5em;
}
