/* Transcriptome result presentation.
 * The table selectors are intentionally scoped and specific because the
 * shared orchid-tables.css file is loaded after page-level styles.
 */

body.site-shell.transcriptome-page .transcriptome-results {
  --transcriptome-primary: #8f2248;
  --transcriptome-accent: #c4477f;
  --transcriptome-ink: #3f2932;
  --transcriptome-muted: #7d6871;
  --transcriptome-border: #ecd5df;
  --transcriptome-soft: #fff7fa;
  margin-top: 8px;
}

body.site-shell.transcriptome-page .transcriptome-results .section-divider {
  height: 1px;
  margin: 40px 0 30px;
  border: 0;
  background: linear-gradient(
    90deg,
    rgba(196, 71, 127, 0),
    rgba(196, 71, 127, 0.5) 16%,
    rgba(196, 71, 127, 0.5) 84%,
    rgba(196, 71, 127, 0)
  );
}

body.site-shell.transcriptome-page .result-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

body.site-shell.transcriptome-page .result-title {
  margin: 0;
  color: var(--transcriptome-primary);
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1.2;
}

body.site-shell.transcriptome-page .result-title::before {
  display: none;
}

body.site-shell.transcriptome-page .result-summary {
  margin: 7px 0 0;
  color: var(--transcriptome-muted);
  font-size: 0.9rem;
}

body.site-shell.transcriptome-page .result-summary.is-stale {
  color: #9b3158;
  font-weight: 650;
}

body.site-shell.transcriptome-page .transcriptome-results .stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

body.site-shell.transcriptome-page .transcriptome-results .stat-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 15px 18px;
  border: 1px solid var(--transcriptome-border);
  border-radius: 11px;
  background: linear-gradient(145deg, #ffffff 0%, #fff9fb 100%);
  box-shadow: 0 5px 16px rgba(97, 30, 57, 0.045);
  text-align: left;
}

body.site-shell.transcriptome-page .transcriptome-results .stat-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 54px;
  border-radius: 0 0 0 54px;
  background: radial-gradient(circle at top right, rgba(196, 71, 127, 0.14), transparent 68%);
  content: "";
  pointer-events: none;
}

body.site-shell.transcriptome-page .transcriptome-results .stat-number {
  color: var(--transcriptome-primary);
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.1;
}

body.site-shell.transcriptome-page .transcriptome-results .stat-label {
  margin-top: 5px;
  color: #8b747d;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

/* Heatmap card */
body.site-shell.transcriptome-page .expression-heatmap-card {
  margin-bottom: 26px;
  overflow: hidden;
  border: 1px solid var(--transcriptome-border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 9px 26px rgba(95, 28, 55, 0.065);
}

body.site-shell.transcriptome-page .heatmap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  border-bottom: 1px solid #efd9e2;
  background:
    radial-gradient(circle at 94% 10%, rgba(196, 71, 127, 0.12), transparent 34%),
    linear-gradient(135deg, #fffafd 0%, #fff5f8 100%);
}

body.site-shell.transcriptome-page .heatmap-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

body.site-shell.transcriptome-page .heatmap-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #9e2852, #c4477f);
  box-shadow: 0 6px 14px rgba(143, 34, 72, 0.2);
  color: #ffffff;
  font-size: 1rem;
}

body.site-shell.transcriptome-page .heatmap-icon i {
  display: none;
}

body.site-shell.transcriptome-page .heatmap-icon::before {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: #ffffff;
  box-shadow:
    6px 0 #ffffff,
    12px 0 #ffffff,
    0 6px #ffffff,
    6px 6px #ffffff,
    12px 6px #ffffff,
    0 12px #ffffff,
    6px 12px #ffffff,
    12px 12px #ffffff;
  content: "";
  transform: translate(-6px, -6px);
}

body.site-shell.transcriptome-page .heatmap-heading h3 {
  margin: 0;
  color: var(--transcriptome-primary);
  font-size: 1.12rem;
  font-weight: 750;
}

body.site-shell.transcriptome-page .heatmap-heading p {
  margin: 4px 0 0;
  color: var(--transcriptome-muted);
  font-size: 0.82rem;
}

body.site-shell.transcriptome-page .heatmap-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

body.site-shell.transcriptome-page .heatmap-meta span {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid #e9cbd7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #765361;
  font-size: 0.76rem;
  font-weight: 650;
  white-space: nowrap;
}

body.site-shell.transcriptome-page .heatmap-meta strong,
body.site-shell.transcriptome-page #heatmapIndexBadge {
  color: var(--transcriptome-primary);
  font-weight: 800;
}

body.site-shell.transcriptome-page .heatmap-note {
  margin: 14px 18px 0;
  padding: 10px 13px;
  border: 1px solid #efd0dc;
  border-radius: 8px;
  background: #fff7fa;
  color: #7a3a53;
  font-size: 0.8rem;
  line-height: 1.45;
}

body.site-shell.transcriptome-page .heatmap-note i {
  margin-right: 6px;
  color: var(--transcriptome-accent);
}

body.site-shell.transcriptome-page .heatmap-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 14px 8px 20px;
  border-bottom: 1px solid #f2e2e8;
  background: #fffdfd;
  color: #846b75;
  font-size: 0.75rem;
}

body.site-shell.transcriptome-page .heatmap-scale-guide {
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}

body.site-shell.transcriptome-page .heatmap-scale-guide i {
  margin-right: 5px;
  color: var(--transcriptome-accent);
}

body.site-shell.transcriptome-page .heatmap-guide-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

body.site-shell.transcriptome-page .heatmap-interaction-hint {
  color: #907983;
  line-height: 1.35;
  text-align: right;
}

body.site-shell.transcriptome-page .heatmap-toolbar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #ead1dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(95, 28, 55, 0.055);
}

body.site-shell.transcriptome-page .heatmap-tool {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #775664;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

body.site-shell.transcriptome-page .heatmap-tool i {
  margin: 0;
  color: inherit;
  font-size: 0.76rem;
}

body.site-shell.transcriptome-page .heatmap-tool:hover:not(:disabled),
body.site-shell.transcriptome-page .heatmap-tool:focus-visible {
  border-color: #e5bdcd;
  outline: none;
  background: #fff4f8;
  color: var(--transcriptome-primary);
  box-shadow: 0 0 0 2px rgba(196, 71, 127, 0.1);
}

body.site-shell.transcriptome-page .heatmap-tool.is-active {
  border-color: var(--transcriptome-primary);
  background: var(--transcriptome-primary);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(143, 34, 72, 0.16);
}

body.site-shell.transcriptome-page .heatmap-tool--download {
  border-color: #e4bdcd;
  color: var(--transcriptome-primary);
}

body.site-shell.transcriptome-page .heatmap-tool:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

body.site-shell.transcriptome-page .heatmap-tool.is-busy {
  cursor: wait;
}

body.site-shell.transcriptome-page .heatmap-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px;
  padding: 14px 16px;
  border: 1px solid #e9c5d3;
  border-radius: 9px;
  background: #fff8fa;
  color: #76515f;
}

body.site-shell.transcriptome-page .heatmap-error > i {
  margin-top: 2px;
  color: var(--transcriptome-accent);
}

body.site-shell.transcriptome-page .heatmap-error strong,
body.site-shell.transcriptome-page .heatmap-error span {
  display: block;
}

body.site-shell.transcriptome-page .heatmap-error strong {
  margin-bottom: 3px;
  color: var(--transcriptome-primary);
  font-size: 0.88rem;
}

body.site-shell.transcriptome-page .heatmap-error span {
  font-size: 0.8rem;
  line-height: 1.45;
}

body.site-shell.transcriptome-page .heatmap-plot-shell {
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 12px 10px;
  scrollbar-color: #d48aa9 #f9edf2;
  scrollbar-width: thin;
}

body.site-shell.transcriptome-page .heatmap-plot-shell::-webkit-scrollbar {
  height: 10px;
}

body.site-shell.transcriptome-page .heatmap-plot-shell::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #f9edf2;
}

body.site-shell.transcriptome-page .heatmap-plot-shell::-webkit-scrollbar-thumb {
  border: 2px solid #f9edf2;
  border-radius: 999px;
  background: #d48aa9;
}

body.site-shell.transcriptome-page #heatmapContainer {
  width: 100%;
  min-width: 650px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Expression table */
body.site-shell.transcriptome-page #expressionResultsTableCard {
  margin-top: 0;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-title {
  justify-content: space-between;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-title-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-count {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid #e8cbd6;
  border-radius: 999px;
  background: #fff7fa;
  color: #8f2248;
  font-size: 0.72rem;
  font-weight: 750;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-action-bar {
  align-items: center;
}

body.site-shell.transcriptome-page .expression-table-context {
  margin: 0;
  color: var(--transcriptome-muted);
  font-size: 0.83rem;
}

body.site-shell.transcriptome-page #expressionResultsTableCard > .transcriptome-table-frame {
  overflow: visible;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .dataTables_wrapper {
  width: 100%;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .dataTables_scroll {
  overflow: hidden;
  border: 1px solid var(--transcriptome-border);
  border-radius: 9px;
  background: #ffffff;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .dataTables_scrollBody {
  overflow-x: auto !important;
  border-bottom: 0 !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable thead th {
  padding: 11px 22px 11px 10px !important;
  border-top: 0 !important;
  border-right: 1px solid #f0dce4;
  border-bottom: 2px solid var(--transcriptome-accent) !important;
  background: #fff0f5 !important;
  color: var(--transcriptome-primary) !important;
  font-size: 0.78rem !important;
  font-weight: 750 !important;
  line-height: 1.25 !important;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

/* DataTables keeps a sizing-only header inside the scroll body. Do not let
 * the visible header padding rules turn that clone into an empty second row. */
body.site-shell.transcriptome-page #expressionResultsTableCard .dataTables_scrollBody table.dataTable thead th {
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .dataTables_scrollBody table.dataTable thead th > .dataTables_sizing {
  height: 0 !important;
  overflow: hidden !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable tbody td {
  padding: 10px 12px !important;
  border-top: 0 !important;
  border-right: 1px solid #f3e5ea;
  border-bottom: 1px solid #f1e1e7;
  color: #4c3941;
  font-size: 0.8rem;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable tbody tr:nth-child(even) {
  background: #fcfafb;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable tbody tr:hover {
  background: #fff5f8 !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable th:first-child,
body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable td:first-child {
  width: 76px !important;
  min-width: 76px !important;
  padding-right: 10px !important;
  padding-left: 10px !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable th:nth-child(2),
body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable td:nth-child(2) {
  min-width: 150px !important;
  text-align: left !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable th:nth-child(3),
body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable td:nth-child(3) {
  min-width: 82px !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable th:nth-child(n + 4),
body.site-shell.transcriptome-page #expressionResultsTableCard table.dataTable td:nth-child(n + 4) {
  min-width: 94px !important;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .row-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--transcriptome-primary);
  cursor: pointer;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .gene-link {
  color: var(--transcriptome-primary);
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 0.79rem;
  font-weight: 700;
}

body.site-shell.transcriptome-page #expressionResultsTableCard .index-badge {
  padding: 3px 9px;
  border: 1px solid #e6bdce;
  border-radius: 999px;
  background: #fff3f7;
  color: var(--transcriptome-primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}

body.site-shell.transcriptome-page .transcriptome-results .no-results {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  margin-top: 22px;
  padding: 32px;
  border: 1px dashed #dfb9c8;
  border-radius: 12px;
  background: #fffafd;
  color: #826874;
  font-size: 0.88rem;
}

body.site-shell.transcriptome-page .transcriptome-results .no-results i {
  margin-bottom: 4px;
  color: var(--transcriptome-accent);
  font-size: 1.4rem;
}

body.site-shell.transcriptome-page .transcriptome-results .no-results strong {
  color: var(--transcriptome-primary);
  font-size: 1rem;
}

body.site-shell.transcriptome-page .species-chip.has-data:focus-visible {
  outline: 2px solid #c4477f;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  body.site-shell.transcriptome-page .transcriptome-shell {
    padding-right: 18px;
    padding-left: 18px;
  }

  body.site-shell.transcriptome-page .transcriptome-results .stats-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  body.site-shell.transcriptome-page .heatmap-card-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 17px;
  }

  body.site-shell.transcriptome-page .heatmap-meta {
    justify-content: flex-start;
  }

  body.site-shell.transcriptome-page .heatmap-guide {
    align-items: flex-start;
    flex-direction: column;
    padding-right: 16px;
    padding-left: 16px;
  }

  body.site-shell.transcriptome-page .heatmap-guide-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  body.site-shell.transcriptome-page .heatmap-interaction-hint {
    text-align: left;
  }

  body.site-shell.transcriptome-page .heatmap-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  body.site-shell.transcriptome-page .heatmap-tool {
    width: 100%;
  }

  body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-action-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  body.site-shell.transcriptome-page #expressionResultsTableCard .orchid-table-action {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.site-shell.transcriptome-page .orchid-table-action,
  body.site-shell.transcriptome-page .species-chip {
    transition: none;
  }
}
