/* ---------------------------------------------------------------------------
   Base theme. The maroon rgb(110, 39, 61) and Oxford blue #002147 are the IOI
   house colours; change them here to re-skin the whole app.
   --------------------------------------------------------------------------- */
:root {
  --help-callout-background: #f8f5f6;
}

@font-face {
  font-family: 'Franklin Gothic ATF';
  src: url('/static/assets/fonts/franklin-gothic-atf-regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

a { color: rgb(110, 39, 61); }
p { color: #002147; }
body {
  font-family: 'Franklin Gothic ATF', Arial, sans-serif;
  font-size: 20px;
}

/* Footer typography (used by the Ineos footer block in base.html) */
.address {
  color: #fff;
  font-size: 12px;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.social {
  color: #fff;
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.my-custom-bold {
  font-weight: 700;
  font-size: 14px;
  color: rgb(255, 255, 255);
}

/* ---------------------------------------------------------------------------
   Tooltip trigger icon (Bootstrap "info-circle"); pair with data-bs-toggle.
   --------------------------------------------------------------------------- */
.help-icon {
  color: rgb(110, 39, 61);
  cursor: help;
  margin-left: 0.35rem;
}

/* ---------------------------------------------------------------------------
   Collapsible "help callout" accordion — a click-to-expand explainer box.
   --------------------------------------------------------------------------- */
.help-callout {
  border-left: 4px solid rgb(110, 39, 61);
  background-color: var(--help-callout-background);
  margin: 1rem 0;
}

.help-callout-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: transparent;
  border: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 18px;
  color: rgb(110, 39, 61);
  text-align: left;
  cursor: pointer;
}

.help-callout-toggle:hover,
.help-callout-toggle:focus { background-color: #f1e9ec; }

.help-callout-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.help-callout-toggle[aria-expanded="true"] .help-callout-chevron { transform: rotate(180deg); }

.help-callout-content { padding: 0 1.25rem 1rem 1.25rem; }

.help-callout p,
.help-callout li { font-size: 18px; }

.help-callout ul { margin-bottom: 0; }

/* ---------------------------------------------------------------------------
   Colourful navigation buttons used on the results / waiting pages.
   --------------------------------------------------------------------------- */
.job-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.job-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgb(110, 39, 61);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  border: 2px solid #e7e7e7;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.job-nav-btn:hover,
.job-nav-btn:focus {
  background-color: #8a3550;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(110, 39, 61, 0.3);
}

.job-nav-btn i { font-size: 1.3rem; }

/* Waiting-page workflow cards. */
.waiting-info-box {
  border: 1px solid rgba(0, 33, 71, 0.15);
  padding: 24px;
  min-height: 100%;
  background: #fff;
}

.waiting-info-box > .d-flex > i {
  color: rgb(110, 39, 61);
  font-size: 2.5rem;
}

.waiting-info-title { color: rgb(110, 39, 61); }

/* Structured job details. */
.job-detail-table {
  max-width: 920px;
  border: 0;
  font-size: 1.05rem;
}

.job-detail-table th,
.job-detail-table td {
  border: 0 !important;
}

.job-detail-table th {
  width: 38%;
  color: #002147;
  background-color: #fff !important;
  font-weight: 700;
}

.job-detail-table th,
.job-detail-table td { padding: 0.7rem 1rem; }

/* Keep DataTables controls consistent with the app theme. */
.dt-container {
  color: #002147;
  font-size: 0.95rem;
}

.dt-container .dt-input {
  border: 1px solid rgba(0, 33, 71, 0.3);
  border-radius: 0.35rem;
  padding: 0.35rem 0.55rem;
  font: inherit;
}

.dt-container .dt-layout-row {
  align-items: center;
  gap: 0.75rem;
}

/* Large allele profile table with a frozen genome-name column. */
.results-table-container {
  height: auto !important;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  border: 1px solid rgba(0, 33, 71, 0.2);
  margin-bottom: 1.5rem;
}

.results-profile-table {
  width: max-content;
  min-width: 100%;
  font-size: 0.9rem;
}

.results-profile-table th,
.results-profile-table td {
  min-width: 105px;
  padding: 0.55rem 0.7rem;
  text-align: center;
  white-space: nowrap;
}

.results-profile-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #fff;
  background: rgb(110, 39, 61);
  border-color: rgba(255, 255, 255, 0.25);
}

.results-profile-table .genome-column {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  max-width: 280px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  background: #fff !important;
  color: #002147 !important;
  font-weight: 700;
  box-shadow: 3px 0 5px rgba(0, 33, 71, 0.12);
}

#qualityControlTable.table-striped > tbody > tr:nth-of-type(odd) > *,
#allelicProfileTable.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: var(--help-callout-background) !important;
}

.results-profile-table thead .genome-column {
  z-index: 3;
  color: #002147 !important;
  background: #fff !important;
}

.results-profile-table thead th:not(.genome-column) {
  position: sticky;
  top: 0;
  width: 54px;
  min-width: 54px;
  height: 125px;
  padding: 0;
  vertical-align: middle;
  color: #002147;
  background: #fff !important;
  border-color: rgba(0, 33, 71, 0.15);
}

.locus-info-trigger {
  width: 100%;
  height: 125px;
  padding: 0.35rem 0;
  color: #002147;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  cursor: pointer;
}

.locus-info-trigger:hover,
.locus-info-trigger:focus-visible {
  color: rgb(110, 39, 61);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.allele-call-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 0.85rem;
  color: #002147;
  background: #fff;
  border-bottom: 1px solid rgba(0, 33, 71, 0.15);
  font-size: 0.9rem;
}

.allele-call-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.allele-call {
  display: inline-block;
  min-width: 1.2em;
  color: #002147;
  font-weight: 700;
  text-align: center;
}

.allele-incomplete { color: rgb(110, 39, 61); }

.locus-modal-content { border-top: 5px solid rgb(110, 39, 61); }
.locus-detail-table th {
  width: 34%;
  color: #002147;
  font-weight: 700;
}
.locus-detail-table td { overflow-wrap: anywhere; }
.locus-modal-close {
  color: #fff;
  background: rgb(110, 39, 61);
}
.locus-modal-close:hover,
.locus-modal-close:focus { color: #fff; background: #8a3550; }

/* Interactive pairwise-distance explorer. */
.distance-explorer {
  border: 1px solid rgba(0, 33, 71, 0.18);
  background: #fbfafb;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.distance-explorer-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.distance-view-toggle {
  display: inline-flex;
  border: 1px solid rgb(110, 39, 61);
  border-radius: 6px;
  overflow: hidden;
}

.distance-view-button {
  border: 0;
  border-right: 1px solid rgb(110, 39, 61);
  padding: 0.5rem 0.9rem;
  color: rgb(110, 39, 61);
  background: #fff;
  font-size: 0.95rem;
}

.distance-view-button:last-child { border-right: 0; }
.distance-view-button:hover,
.distance-view-button:focus-visible { background: #f2e9ec; }
.distance-view-button.active {
  color: #fff;
  background: rgb(110, 39, 61);
}

.distance-genome-search {
  width: min(100%, 340px);
}

.distance-genome-search label {
  display: block;
  color: #002147;
  margin-bottom: 0.3rem;
}

.distance-pair-detail,
.distance-large-notice {
  border-left: 4px solid rgb(110, 39, 61);
  color: #002147;
  background: #f2e9ec;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.distance-matrix-wrapper {
  max-height: 68vh;
  overflow: auto;
  border: 1px solid rgba(0, 33, 71, 0.2);
  background: #fff;
}

.distance-matrix-wrapper[hidden],
.distance-visualization[hidden] { display: none !important; }

.distance-visualization {
  max-height: 72vh;
  overflow: auto;
  border: 1px solid rgba(0, 33, 71, 0.16);
  background: #fff;
}

.distance-heatmap {
  display: block;
  width: 100%;
  min-width: 0;
}

.distance-heatmap-svg {
  display: block;
  max-width: none;
  margin: 0;
  font-family: 'Franklin Gothic ATF', Arial, sans-serif;
}

.distance-genome-label {
  fill: #002147;
  font-size: 14px;
  cursor: pointer;
}

.distance-label-backgrounds rect {
  fill: transparent;
  pointer-events: none;
}

.distance-label-backgrounds rect.is-selected {
  fill: rgba(0, 33, 71, 0.12);
}

.distance-row-label { dominant-baseline: middle; }
.distance-genome-label:hover,
.distance-genome-label:focus {
  fill: rgb(110, 39, 61);
  text-decoration: underline;
  outline: none;
}

.distance-heatmap-cell {
  stroke: rgba(0, 33, 71, 0.12);
  stroke-width: 1px;
  cursor: pointer;
  transition: stroke 0.12s ease, opacity 0.12s ease;
}

.distance-heatmap-cell.is-selected-cell { stroke: #002147; stroke-width: 3px; }
.distance-heatmap-cell:hover,
.distance-heatmap-cell:focus { stroke: #002147; stroke-width: 3px; outline: none; }

.distance-cell-value {
  font-size: 13px;
  font-weight: 400;
  pointer-events: none;
}

.library-load-warning {
  border-left: 4px solid #a94442;
  padding: 0.6rem 0.85rem;
  color: #7b2f2d;
  background: #fdf1f0;
  font-size: 0.95rem;
}

.distance-matrix {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.9rem;
}

.distance-matrix th,
.distance-matrix td {
  padding: 0;
  border-right: 1px solid rgba(0, 33, 71, 0.12);
  border-bottom: 1px solid rgba(0, 33, 71, 0.12);
}

.distance-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 5;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  padding: 0.65rem !important;
  color: #002147;
  background: #fff;
  text-align: left;
}

.distance-column-axis {
  position: sticky;
  top: 0;
  z-index: 3;
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  height: 125px;
  color: #002147;
  background: #fff;
  vertical-align: bottom;
}

.distance-row-axis {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  color: #002147;
  background: #fff;
  text-align: left;
}

.distance-genome-trigger {
  width: 100%;
  height: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.distance-column-axis .distance-genome-trigger {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: left;
}

.distance-genome-trigger:hover,
.distance-genome-trigger:focus-visible {
  color: rgb(110, 39, 61);
  text-decoration: underline;
}

.distance-genome-trigger.is-selected {
  color: #002147;
  text-decoration: none;
  background: transparent;
}

.distance-axis.is-selected {
  background: rgba(0, 33, 71, 0.12);
}

.distance-cell {
  display: block;
  width: 54px;
  min-width: 54px;
  height: 42px;
  padding: 0;
  border: 0;
  color: var(--distance-text-color, #002147);
  background: rgba(110, 39, 61, var(--distance-strength, 0.05));
  font: inherit;
  text-align: center;
}

.distance-view-table .distance-cell {
  color: #002147;
  background: #fff;
}

.distance-cell:hover,
.distance-cell:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #002147;
  outline-offset: -3px;
}

.distance-cell.is-related { box-shadow: inset 0 0 0 2px #e1af31; }
.distance-cell.is-selected {
  position: relative;
  z-index: 2;
  outline: 4px solid #e1af31;
  outline-offset: -4px;
}

.distance-cell.distance-unavailable {
  color: #59636f;
  background: repeating-linear-gradient(135deg, #fff, #fff 5px, #edf0f3 5px, #edf0f3 10px);
}

.distance-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 1.25rem;
  color: #002147;
  font-size: 0.85rem;
}

.distance-legend-scale {
  display: block;
  width: min(260px, 45vw);
  height: 14px;
  border: 1px solid rgba(0, 33, 71, 0.2);
}

.distance-legend-label { margin-left: 0.4rem; }

.distance-nearest-panel {
  max-width: 680px;
  border-top: 1px solid rgba(0, 33, 71, 0.15);
  padding-top: 1rem;
}

.distance-nearest-panel h2 { color: rgb(110, 39, 61); }

@media (max-width: 576px) {
  .distance-explorer { padding: 0.8rem; }
  .dt-container .dt-layout-row { align-items: stretch; }
  .distance-view-toggle,
  .distance-view-button { width: 100%; }
  .distance-view-button { border-right: 0; border-bottom: 1px solid rgb(110, 39, 61); }
  .distance-view-button:last-child { border-bottom: 0; }
  .distance-corner,
  .distance-row-axis { width: 112px; min-width: 112px; max-width: 112px; }
}
