/* =============================================================================
   Coverage plot + Evidence QC UI (icons, modals, table cells)
   ============================================================================= */

.ms-qc-plot-td {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.ms-qc-plot-btn,
.seq-coverage-plot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #ffffff;
  color: #07554f;
  cursor: pointer;
}

.ms-qc-plot-btn:hover,
.seq-coverage-plot-btn:hover {
  background: #f2f4f7;
  border-color: #07554f;
}

.ms-qc-coverage-card {
  position: relative;
  display: inline-block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: help;
}

.ms-qc-coverage-card .seq-borat-qc-tile {
  cursor: help;
}

.ms-qc-coverage-th {
  white-space: nowrap;
}

.ms-qc-coverage-th .ms-qc-coverage-info,
.ms-qc-coverage-th .seq-coverage-info-btn {
  margin-left: 6px;
  vertical-align: middle;
}

.seq-food-species-table tbody tr.ms-qc-coverage-row {
  cursor: default;
}

.modal:has(.ms-qc-coverage-modal) {
  padding: 0 !important;
}

.modal:has(.ms-qc-coverage-modal) .modal-dialog {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh;
  margin: 0;
}

.modal:has(.ms-qc-coverage-modal) .modal-content,
.metacache-coverage-modal .modal-content {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal:has(.ms-qc-coverage-modal) .modal-header,
.metacache-coverage-modal .modal-header {
  position: relative;
  padding-right: 58px !important;
  flex: 0 0 auto;
}

.modal:has(.ms-qc-coverage-modal) .modal-footer {
  flex: 0 0 auto;
}

.seq-modal-close {
  position: absolute;
  top: 11px;
  right: 13px;
  z-index: 30;
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(7, 85, 79, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #667085;
  font-family: Arial, sans-serif;
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.06);
}

.seq-modal-close span {
  display: block;
  transform: translateY(-1px);
}

.seq-modal-close:hover,
.seq-modal-close:focus {
  color: #07554f;
  border-color: rgba(7, 85, 79, 0.32);
  background: rgba(7, 85, 79, 0.045);
  box-shadow: 0 3px 8px rgba(7, 85, 79, 0.1);
  outline: none;
}

/* Keep × pinned to the header even when Shiny wraps the title in h4 */
.modal:has(.ms-qc-coverage-modal) .modal-header .seq-modal-close,
.modal:has(.ms-qc-coverage-modal) .modal-title .seq-modal-close {
  position: absolute;
  top: 11px;
  right: 13px;
}

.modal:has(.ms-qc-coverage-modal) .modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 0.75rem;
  max-height: none;
}

.ms-qc-coverage-modal {
  font-size: 15px;
  line-height: 1.45;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ms-qc-coverage-modal-lead {
  font-size: 15px;
  line-height: 1.55;
  color: #475467;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.ms-qc-coverage-plot-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(26rem, 1fr);
  gap: 1rem 1.35rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
}

.ms-qc-coverage-plot-cell {
  display: flex;
  flex-direction: column;
  min-width: 26rem;
  min-height: 0;
  padding: 8px 10px 10px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #ffffff;
}

.ms-qc-coverage-plot-heading {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.ms-qc-coverage-plot-accession {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.ms-qc-coverage-plot-caption {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #344054;
}

.ms-qc-coverage-plot-cell .shiny-plot-output {
  flex: 1;
  min-height: 0;
  height: 24vh !important;
}

.ms-qc-coverage-plot-cell .shiny-plot-output img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.ms-qc-coverage-plot-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
}

.ms-qc-coverage-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  flex: 0 0 auto;
}

.ms-qc-coverage-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafb;
}

.ms-qc-coverage-chip-label {
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.ms-qc-coverage-chip-value {
  color: #182230;
  font-size: 17px;
  font-weight: 700;
}

.ms-qc-help-lead {
  margin: 0 0 16px;
  color: #475467;
  line-height: 1.45;
}

.ms-qc-help-metric {
  margin: 0 0 18px;
}

.ms-qc-help-metric h4 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 750;
}

.ms-qc-help-detail {
  margin: 0 0 6px;
  color: #667085;
  font-size: 13px;
  line-height: 1.4;
}

.ms-qc-help-situation {
  margin: 0 0 8px;
  font-weight: 650;
  color: #102d35;
}

.ms-qc-help-metric.is-good .ms-qc-help-situation {
  color: #2f6b38;
}

.ms-qc-help-metric.is-warn .ms-qc-help-situation {
  color: #8a5a12;
}

.ms-qc-help-metric.is-bad .ms-qc-help-situation {
  color: #8a2e35;
}

.ms-qc-help-scale-wrap {
  position: relative;
  margin: 4px 0 8px;
}

.ms-qc-help-scale {
  position: relative;
  height: 12px;
  overflow: visible;
}

.ms-qc-help-scale-track {
  display: flex;
  height: 100%;
  overflow: hidden;
  border-radius: 6px;
}

.ms-qc-help-scale-seg {
  display: block;
  min-width: 0;
  height: 100%;
}

.ms-qc-help-scale-seg.is-good {
  background: #5b9c61;
}

.ms-qc-help-scale-seg.is-warn {
  background: #e7a63e;
}

.ms-qc-help-scale-seg.is-bad {
  background: #c95a61;
}

.ms-qc-help-scale-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 4px;
  background: #102d35;
  border: 1px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #102d35, 0 1px 2px rgba(16, 45, 53, 0.35);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

.ms-qc-help-scale-marker::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  background: #102d35;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #102d35;
}

.ms-qc-help-scale-ticks {
  position: relative;
  height: 16px;
  margin-top: 4px;
  color: #667085;
  font-size: 11px;
}

.ms-qc-help-scale-tick {
  position: absolute;
  transform: translateX(-50%);
}

.ms-qc-help-scale-tick:first-child {
  transform: none;
}

.ms-qc-help-scale-tick:last-child {
  transform: translateX(-100%);
}

.ms-qc-coverage-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 64px;
  max-width: 96px;
}

.ms-qc-coverage-card:has(.ms-qc-coverage-mini) {
  display: flex;
  width: 100%;
  min-width: 0;
}

.ms-qc-coverage-mini-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0;
}

.ms-qc-coverage-mini-label {
  flex: 0 0 11px;
  width: 11px;
  color: #07554f;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.ms-qc-coverage-mini .ms-qc-help-scale-wrap,
.ms-qc-coverage-mini .ms-qc-help-scale-wrap.is-mini {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.ms-qc-coverage-mini .ms-qc-help-scale {
  height: 5px;
  overflow: visible;
}

.ms-qc-coverage-mini .ms-qc-help-scale-track {
  border-radius: 3px;
}

.ms-qc-coverage-mini .ms-qc-help-scale-marker {
  top: -2px;
  bottom: -2px;
  width: 1.5px;
  background: #111;
  border: 0;
  border-radius: 1px;
  box-shadow: none;
}

.ms-qc-coverage-mini .ms-qc-help-scale-marker::after {
  top: -3px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: #111;
  border: 0;
  box-shadow: none;
}

.ms-qc-help-list {
  padding-left: 1.1rem;
}

.ms-qc-help-list p {
  margin: 4px 0 12px;
  color: #475467;
}

.ms-qc-help-swatch {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ms-qc-help-swatch.is-good {
  background: #eaf4ed;
  color: #39734b;
}

.ms-qc-help-swatch.is-warn {
  background: #fbf3df;
  color: #8a6116;
}

.ms-qc-help-swatch.is-bad {
  background: #f9eaea;
  color: #9d3737;
}

.ms-qc-coverage-ncbi-links {
  margin: 0 0 10px;
}

.ms-qc-coverage-ncbi-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ms-qc-coverage-ncbi-list li {
  margin: 0;
}
