@tailwind base;
@tailwind components;
@tailwind utilities;

/* Version marker in footer – confirms which build is deployed */
.app-version {
  font-size: 0.75rem;
  color: #6b7280;
  margin-left: 1rem;
}

/* Default marker: shown on first paint until the app finishes loading */
.app-loading-placeholder {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f0f4f8;
  border-left: 4px solid #26374a;
  font-size: 1rem;
  color: #26374a;
}
#tableHeadersRow > th {
  font-size: 18px !important;
}

tbody > tr > td {
font-size: 16px !important;
}

.app-loading-placeholder[hidden],
.app-loading-placeholder.app-loaded {
  display: none !important;
}

/* Custom styles for WET-BOEW autocomplete */
.wet-boew-autocomplete .autocomplete__input {
  /* Override any styles here */
}

.wet-boew-autocomplete .autocomplete__menu {
  /* Override menu styles */
}

.wet-boew-autocomplete .autocomplete__option {
  /* Override option styles */
}

/* DPD (Data Presentation Dropdown) Styles */
.dpd-section-group {
  margin-bottom: 15px;
  width: 100%;
  /* Let the grid system handle the width */
}

.dpd-label {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

/* Biomarker label row: label and reset button on same line */
#biomarkerSelect .dpd-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

#biomarkerSelect .dpd-label-row .dpd-label {
  margin-bottom: 0;
}

#filters-sidebar .filter-legend {
  margin-bottom: 0px !important;
}

/* Reset button: icon nearly fills the button (override .btn min 36px from theme) */
#biomarkerSelect #reset-selections-btn {
  width: 27px;
  height: 27px;
  min-width: 27px;
  min-height: 27px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #666666;
  box-sizing: border-box;
}

#biomarkerSelect #reset-selections-btn:hover {
  border-color: #333333;
}

#biomarkerSelect #reset-selections-btn:focus {
  outline: 3px solid #26374a;
  outline-offset: 2px;
}

#biomarkerSelect #reset-selections-btn:focus:not(:focus-visible) {
  outline: none;
}

#biomarkerSelect #reset-selections-btn:focus-visible {
  outline: 3px solid #26374a;
  outline-offset: 2px;
}

#biomarkerSelect #reset-selections-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Specific line-height for chemical select labels */
#chemicalGroupSelect-dpd-label,
#chemicalCASSelect-dpd-label {
  line-height: 1.35 !important;
}

/* Make the radio group legend match the dropdown label style */
.gc-chckbxrdio legend {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
  font-size: 16px;
  float: none;
  width: 100%;
  border-bottom: none;
  padding: 0;
}

/* Minimal radio button contrast improvements - just make borders darker */
.gc-chckbxrdio input[type="radio"]+label::before {
  border-color: #666 !important;
}

.gc-chckbxrdio input[type="radio"]+label {
  color: #000 !important;
}

.dpd-accessible-selector {
  position: relative;
  width: 100%;
}



span.legend-text {
  font-size: 18px !important;
}

#biomarker-highlights>div>details {
  margin-top: 1rem;
}

.dpd-combo {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  color: #333;
  font-family: Lato, sans-serif;
  font-size: 16px;
  height: 44px;
  padding: 8px 33px 8px 12px;
  width: 100%;
  transition: border-color 0.2s ease-out;
}

/* Text overflow ellipsis for specific dropdowns */
#biomarkerSelect .dpd-combo,
#chemicalSelect .dpd-combo,
#chemicalGroupSelect .dpd-combo,
#chemicalCASSelect .dpd-combo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dpd-combo:focus {
  outline: 4px solid #1c578a;
  outline-offset: -2px;
  border-color: #000;
}

.dpd-listbox {
  margin-top: -1px;
  border-top: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  display: none;
  left: 0;
  max-height: 342px;
  overflow-y: auto;
  overflow-x: hidden;
  position: absolute;
  top: 100%;
  width: 100%;
  z-index: 100;
  box-sizing: border-box;
}

.dpd-listbox[aria-expanded="true"] {
  display: block;
}

.dpd-option {
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  padding: 6px 12px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

.dpd-option:last-child {
  border-bottom: none;
}

.dpd-option:hover,
.dpd-option.dpd-focused {
  background-color: #335075;
  color: #fff;
}

/* Add dropdown arrow */
.dpd-combo::after {
  content: "";
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #333;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}


#bar-chart-download-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0px;
  margin-bottom: 5px;
}

/* Text-description DataTable under bar chart: highlight sorted header */
#bar-chart-container details table.dataTable thead .sorting_asc,
#bar-chart-container details table.dataTable thead .sorting_desc {
  background-color: #26374a !important;
  color: #ffffff !important;
}



.bar-chart-heading-row {
  position: relative;
}
#bar-chart-container details table.dataTable thead th:nth-child(1),
#bar-chart-container details table.dataTable tbody td:nth-child(1) {
  width: 70px !important;
  max-width: 70px !important;
}

#bar-chart-container details table.dataTable thead th { 
  font-size: 18px !important;
  /* max-width: 150px !important; */
}
#bar-chart-container details table.dataTable thead th:nth-child(2),
#bar-chart-container details table.dataTable tbody td:nth-child(2) {
  width: 80px !important;
  max-width: 80px !important;
}
#bar-chart-container details table.dataTable thead th:nth-child(3),
#bar-chart-container details table.dataTable tbody td:nth-child(3) {
  width: 60px !important;
  max-width: 60px !important;
}
/* Text-description table: narrow GM level column, wider 95% CI column */
#bar-chart-container details table.dataTable thead th:nth-child(4),
#bar-chart-container details table.dataTable tbody td:nth-child(4) {
  width: 50px !important;
  max-width: 50px !important;
}
#bar-chart-container details table.dataTable thead th:nth-child(5),
#bar-chart-container details table.dataTable tbody td:nth-child(5) {
  width: 80px !important;
  min-width: 80px !important;
  max-width: 140px !important;
}
#bar-chart-container details table.dataTable thead th:nth-child(6),
#bar-chart-container details table.dataTable tbody td:nth-child(6) {
  width: 50px !important;
  max-width: 50px !important;
}
#bar-chart-container details table.dataTable thead th:nth-child(7),
#bar-chart-container details table.dataTable tbody td:nth-child(7) {
  width: 70px !important;
  /* max-width: 70px !important; */
}

/* Vertical position of bar chart ? button only; percentiles keep default positioning */
.bar-chart-heading-row .chart-legend-help {
  position: absolute;
  top: 4em;
  right: 0;
}

label {
  font-weight: unset;
}

/* Chart Title Styles */
.chart-title-container h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: bold;
  font-family: sans-serif;
}

/* Loading Overlay Styles */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  display: none;
}

#no-chemical-message {
  font-size: 25px !important;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Metadata Row Styles */
.metadata-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
}

.metadata-cell {
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metadata-cell.group {
  white-space: normal;
}

/* Header Row Styles */
.header-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  padding: 8px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.header-cell {
  padding: 8px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio input[type="radio"]+label {
  width: 80%;
}

.gc-chckbxrdio input[type="radio"]+label {
  margin-right: 20px;
}

.sort-icon {
  visibility: hidden;
  margin-left: 4px;
}

/* Remove margin-bottom from form-groups and dpd-section-groups in percentiles chart container */
#percentiles-chart-container .form-group {
  margin-bottom: 0;
}

#percentiles-chart-container .dpd-section-group {
  margin-bottom: 0;
}

/* Parent container of thumbnail alert needs position relative for centering */
.chart-thumbnail>div {
  position: relative;
  min-height: auto;
}



@media (max-width: 768px) {
  .bar-chart-thumbnail-alert  {
    margin-top: 34px !important;
  }
}

@media (max-width: 500px) {
  .bar-chart-thumbnail-alert  {
    margin-top: 15px !important;
  }
}
/* Thumbnail alerts (Collection period, Age group, Sex at birth) - icon-only compact alert */
.bar-chart-thumbnail-alert {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: absolute !important;
  top: 30% !important;
  left: 0 !important;
  right: 0 !important;
  transform: translateY(-50%) !important;
  margin-left: auto;
  margin-right: auto;
  
  padding: 10px !important;
  width: fit-content !important;
  height: auto !important;
  cursor: help;
  background: transparent !important;
  border: none !important;
}

/* Hide the theme's ::before icon since we use inline SVG */
.bar-chart-thumbnail-alert::before {
  display: none !important;
  content: none !important;
}

/* Ensure the icon (SVG or img) is visible */
.bar-chart-thumbnail-alert svg,
.bar-chart-thumbnail-alert img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Prevent PNG icon from stretching - keep square aspect ratio */
.bar-chart-thumbnail-alert img {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  object-fit: contain !important;
  object-position: center !important;
  flex-shrink: 0 !important;
  align-self: center !important;
}

/* Biomarker Highlights Section */
.biomarker-highlights-section {
  background-color: #ffffff;
}
#tableHeadersRow th {
  text-align: left !important;
}

.biomarker-highlights-title {
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  margin-top: 0;
}

.biomarker-highlights-content {
  display: flex;
  flex-direction: column;
}

.highlights-boxes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.highlight-box {
  flex: 1;
  min-width: 200px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  text-align: left;
}

.highlight-header {
  font-weight: bold;
  color: #333;
  padding: 8px 12px;
  margin: -15px -15px 5px -15px;
  border-radius: 6px 6px 0 0;
  font-size: 21px;
  text-align: center;
}

.highlight-value {
  font-size: 40px;
  font-weight: bold;
  color: #333;
  text-align: center;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.highlight-icon {
  width: 75px;
  /* Increased to 40px */
  height: 75px;
  /* Increased to 40px */
  margin-right: 15px;
  object-fit: contain;
}

.highlight-description {
  font-size: 16px;
  text-align: center;
  line-height: 1.4;
}

/* Responsive Highlights */
@media (max-width: 768px) {
  .highlights-boxes {
    flex-direction: column;
  }

  .highlight-box {
    min-width: auto;
  }

  .biomarker-highlights-title {
    font-size: 20px;
  }

  .highlight-value {
    font-size: 28px;
  }
}