
/* Hide every native <select> under #query-form the instant CSS loads --
   search.html's treeselect_placeholder macro renders a loading-shell stand-in
   for each one, so there's no gap between first paint and Treeselect mounting
   over it in JS (replacing the old approach of hiding a hardcoded id list,
   which only covered selects that existed when that list was last updated). */
#query-form select[multiple] {
  display: none;
}

.treeselect-shell--loading {
  opacity: 0.55;
  pointer-events: none;
}

.var-chip-scroll {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-height: 6.5rem;
  max-width: 100%;
  overflow: auto;
  padding: 0.15rem 0.1rem 0.15rem 0;
  scrollbar-width: thin;
}

.var-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 20ch;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  text-align: center;
  background: #e0f7f8;
  border: 1px solid #00aab5;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.76em;
  line-height: 1.25;
  color: #006b72;
  user-select: text;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

a.var-chip:hover {
  background: #00aab5;
  color: #ffffff;
  text-decoration: none;
}

.var-chip--variable {
  min-width: 20ch;
}

.var-chip--oi {
  min-width: 10ch;
}

.var-chip--matrix {
  min-width: 10ch;
}

.facility-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5ch;
  max-width: 30ch;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  text-align: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.76em;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

/* Clickable (links to a facility page) - styled like the table's other
   action buttons (e.g. Inspect), so it's obvious this chip is interactive.
   Hover colour matches Bootstrap's own .btn-primary:hover shade exactly. */
a.facility-chip {
  background: #00aab5;
  border: 1px solid #00aab5;
  color: #ffffff;
  font-weight: 700;
}

/* Non-clickable fallback (no facility id to link to) - kept visually flat/
   muted so it reads as a plain label, not something you can act on. */
span.facility-chip {
  background: #e0f7f8;
  border: 1px solid #00aab5;
  color: #006b72;
  font-weight: 500;
}

td:has(.facility-chip) {
  text-align: center;
  vertical-align: middle;
}

/* .product-type-bar itself stays in normal flow (not positioned), so its own
   box - the icon plus its padding - is what the table's auto-layout (and
   bootstrap-table's own column-width calculation) measures as this column's
   content. That's what drives the column width; no hardcoded width needed. */
.product-type-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: help;
}

/* The coloured background is a separate, absolutely positioned layer so it
   can bleed to fill the row's height without affecting layout width. Since
   .product-type-bar itself has no `position`, the browser skips it when
   resolving ::before's containing block and binds to the td instead (the
   nearest ancestor that IS positioned) - so this fills the cell, not just
   the bar's own icon-sized box. */
.product-type-bar::before {
  content: '';
  position: absolute;
  inset: 4px 0;
  background-color: var(--product-type-color, #898781);
  background-image: var(--timeliness-hatch, none);
  border-radius: 8px 0 0 8px;
  z-index: 0;
}

/* Wide diagonal hatch so scheduled (unshaded) stays visually distinct from
   nrt/rrt (not manually QC'ed) even on the shortest single-line bars; the
   two stripe directions are opposite so nrt and rrt aren't identical either. */
.product-type-bar.hatch-nrt {
  --timeliness-hatch: repeating-linear-gradient(
    45deg,
    transparent 0 8px,
    rgba(0, 0, 0, 0.22) 8px 16px
  );
}

.product-type-bar.hatch-rrt {
  --timeliness-hatch: repeating-linear-gradient(
    -45deg,
    transparent 0 8px,
    rgba(0, 0, 0, 0.22) 8px 16px
  );
}

.product-type-bar > i {
  position: relative;
  z-index: 1;
}

/* Restricted-access datasets stack a dark, low-opacity lock above the
   timeliness icon, at 0.8x its size, instead of showing the timeliness
   icon alone. */
.product-type-bar-stacked {
  flex-direction: column;
  gap: 6px;
  padding: 4px 8px;
}

.product-type-bar-stacked > i {
  line-height: 1;
}

/* Always opaque/white so it stays legible against any product-type colour
   or the darkened/selected-row background below - the old low-opacity
   black version (rgba(0,0,0,0.35)) could become nearly invisible on dark
   bar colours and on selected rows. */
.product-type-lock-icon {
  font-size: 0.8em;
  color: #ffffff;
  z-index: 2;
}

/* Selected row: tint the bar to indicate selection, but keep the icon
   legible (a plain brightness(0.6) darkening nearly hid the lock icon). */
tr.selected .product-type-bar::before {
  filter: grayscale(0.7) brightness(1.2);
}

td:has(.product-type-bar) {
  position: relative;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
}

/* Hide the bs-checkbox column entirely — the select-all input is moved
   into the product-type header cell by JS below. */
th.bs-checkbox,
td.bs-checkbox {
  display: none !important;
}

/* Select-all checkbox rendered inside the product-type header */
th.product-type-header {
  position: relative;
}
th.product-type-header input[type="checkbox"] {
  position: absolute;
  inset: 0;
  margin: auto;
  cursor: pointer;
}

/* bootstrap-table's default classes include .table-bordered, which puts the
   horizontal rules on <tr> (border-width: <width> 0), not on the cells. A
   per-cell border override can therefore never punch a hole in them, so move
   the rule down onto the cells and skip the indicator column. */
#table > :not(caption) > tr {
  border-top-width: 0;
  border-bottom-width: 0;
}

#table > :not(caption) > tr > *:not(.product-type-header) {
  border-bottom-width: var(--bs-border-width);
}

#table > thead > tr:first-child > *:not(.product-type-header) {
  border-top-width: var(--bs-border-width);
}

#table > :not(caption) > tr > .product-type-header {
  border-left-width: 0;
  box-shadow: none;
}

/* Always-reachable horizontal scroll affordance, sitting right above the
   header row. Sticky to the viewport's top edge so it stays pinned there
   once you scroll past it - same mechanism a sticky header uses, just for
   this bar instead. This is deliberately "top", not "bottom": the bar's
   static position is near the top of the (possibly 1000-row) table, so
   scrolling down carries it toward/off the top edge, not the bottom one.
   data-sticky-header-offset-y on the table (below) must match this box's
   height so the frozen header row settles in just underneath it instead of
   overlapping. The box height itself stays constant even on hover/active -
   only the drawn scrollbar's thickness grows within it - so that offset
   never needs to change. */
#table-scrollbar {
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  background: #ffffff;
  border-bottom: 1px solid #dee2e6;
}

#table-scrollbar-inner {
  height: 1px;
}

/* Force a classic, always-rendered scrollbar rather than the OS/browser's
   auto-hiding overlay style — otherwise it fades out when idle and defeats
   the point of a persistent scroll affordance. Thin by default, full-width
   while hovered/dragged (mirrors how a native scrollbar thickens on
   interaction) - Firefox only offers "thin"/"auto" as a track width, not
   arbitrary px, hence the keyword swap rather than a size change. */
#table-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #adb5bd #e9ecef;
}

#table-scrollbar:hover,
#table-scrollbar:active {
  scrollbar-width: auto;
}

#table-scrollbar::-webkit-scrollbar {
  height: 10px;
  transition: height 0.15s ease;
}

#table-scrollbar:hover::-webkit-scrollbar,
#table-scrollbar:active::-webkit-scrollbar {
  height: 14px;
}

#table-scrollbar::-webkit-scrollbar-track {
  background: #e9ecef;
}

#table-scrollbar::-webkit-scrollbar-thumb {
  background: #adb5bd;
  border-radius: 5px;
}

.col-sticky-right {
  position: sticky !important;
  right: 0;
  background: #ffffff;
  z-index: 2;
  min-width: max-content;
  white-space: nowrap;
  /* inset box-shadow renders inside the element's own border-box and cannot
     be clipped by a parent overflow:auto/hidden container — unlike an outset
     shadow or a ::before pseudo-element, both of which get cut off when the
     horizontal scroll container clips its overflow. */
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}

.col-sticky-right--first {
  right: 92px !important;  /* fallback before first render */
}

/* The rightmost sticky column (Download) also needs a right border. */
.col-sticky-right:not(.col-sticky-right--first) {
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6),
              inset -1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}

/* Keep frozen header cells above frozen body cells */
thead .col-sticky-right {
  z-index: 3;
}

/* Selected rows: use opaque equivalent of rgba(0,0,0,0.075) over white so
   scrolled-behind cells don't bleed through and double the darkness.
   Also cancel Bootstrap's box-shadow overlay on the sticky cells. */
.bootstrap-table .fixed-table-container .table tbody tr.selected td.col-sticky-right {
  background-color: #ececec !important;
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}
.bootstrap-table .fixed-table-container .table tbody tr.selected td.col-sticky-right:not(.col-sticky-right--first) {
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6),
              inset -1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}
/* Hovering over a selected sticky cell — one shade darker, still opaque. */
.bootstrap-table .fixed-table-container .table tbody tr.selected:hover td.col-sticky-right {
  background-color: #e0e0e0 !important;
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}
.bootstrap-table .fixed-table-container .table tbody tr.selected:hover td.col-sticky-right:not(.col-sticky-right--first) {
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6),
              inset -1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}
/* Hovering a non-selected sticky cell — match the table-hover shade. */
.bootstrap-table .fixed-table-container .table tbody tr:not(.selected):hover td.col-sticky-right {
  background-color: #f5f5f5 !important;
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}
.bootstrap-table .fixed-table-container .table tbody tr:not(.selected):hover td.col-sticky-right:not(.col-sticky-right--first) {
  box-shadow: inset 1px 0 0 0 var(--bs-border-color, #dee2e6),
              inset -1px 0 0 0 var(--bs-border-color, #dee2e6) !important;
}

/* min-width for the inspect column is injected by JS (search.html) from
   INSPECT_COL_WIDTH so there is only one place to change the value. */

td[data-field="id"],
td[data-field="download_url"] {
  text-align: center !important;
  vertical-align: middle !important;
}

a.facility-chip:hover {
  background: var(--actris-hover-default);
  border-color: var(--actris-hover-default);
  color: #ffffff;
  text-decoration: none;
}

li.select2-results__option strong.select2-results__group:hover {
    background-color: #ddd;
    cursor: pointer;
  }

  .scrollable-form {
    height: 150px;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
  }

  .scrollable-form fieldset {
    margin-bottom: 20px;
    border: none;
  }

  .scrollable-form legend {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
  }

  .scrollable-form input[type="checkbox"] {
    margin-right: 5px;
  }

  .scrollable-form label {
    font-size: 1rem;
  }

  .option-checkbox {
    margin-left: 30px;
}

.form-group label {
  margin-bottom: 10px;
  margin-top: 10px;
}

a.vocab-tooltip {
  color: var(--actris-info-default);
}

a.vocab-tooltip:hover {
  color: var(--actris-info-hover);
}

/* Single source of truth for the facility map's colours - marker fills below
   and the map legend swatches (templates/search.html) both reference these,
   so the two can never drift out of sync and there's one place to change a
   colour. */
:root {
  --facility-colour-other: #878A8B;
  --facility-colour-nf: #00AAB5;
  --facility-colour-labelled: #2C347F;
  --facility-colour-selected: #E8B832;
}

/* Facility map markers - a single inline SVG per marker (see search-map.js),
   not raster images or a stacked icon-font trick. The pin body (fill), its
   centre hole (a real <circle>, painted on top of the body - not a
   transparency cutout), and the "selected" outline (an SVG `stroke` on the
   body) are three parts of the SAME shape sharing one coordinate system, so
   nothing can drift out of alignment as sizes change. */
.facility-marker-icon {
  position: relative;
}

.facility-marker-icon .facility-marker-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: visible; /* selected outline's stroke can extend past the viewBox edge */
}

.facility-marker-body {
  stroke: none;
  stroke-width: 2.4;
  paint-order: stroke fill;
}

.facility-marker-hole {
  fill: #ffffff;
}

.facility-marker-icon.other-marker .facility-marker-body {
  fill: var(--facility-colour-other);
}

.facility-marker-icon.nf-marker .facility-marker-body {
  fill: var(--facility-colour-nf);
}

.facility-marker-icon.labelled-marker .facility-marker-body {
  fill: var(--facility-colour-labelled);
}

/* Selected: category fill above is untouched, so it stays readable. */
.facility-marker-icon.facility-selected .facility-marker-body {
  stroke: var(--facility-colour-selected);
}

.facility-marker-icon.facility-selected .facility-marker-hole {
  fill: var(--facility-colour-selected);
}

/* Map legend swatches (templates/search.html) - same colours as the markers
   above, via the same variables. */
.legend-icon--other {
  background-color: var(--facility-colour-other);
}

.legend-icon--nf {
  background-color: var(--facility-colour-nf);
}

.legend-icon--labelled {
  background-color: var(--facility-colour-labelled);
}

.legend-icon--selected {
  background-color: var(--facility-colour-selected);
}

.treeselect-input__operators {
  top: 7px;
}
