/* Apply box-sizing globally */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Global Styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #eeeeee;
}

/* Header Styles */
h1 {
  margin-top: 20px;
  text-align: center;
}

/*  Global Table Theme */
.table-theme {
  background-color: #ffffff;
  border: 1px solid #2f5d62;
  color: #0e3e3e;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.table-theme thead {
  background-color: #4f8f8f;
  color: #ffffff;
  font-weight: bold;
  border-bottom: 2px solid #2f5d62;
}

.table-theme tbody tr:nth-child(even) {
  background-color: #dff3f2;
}

.table-theme th,
.table-theme td {
  border: 1px solid #c8e3e1;
}

.table-theme tr:last-child td {
  border-bottom: 1px solid #aacccc; /* border at bottom of table */
}

.centered-text {
  text-align: center !important;
}

/* Generic text container layout for centered headings  */
.text-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.text-container h2 {
  margin-bottom: 1rem;
}

.text-container p {
  font-size: 1rem;
  line-height: 1.5; /* More breathing room between lines */
  color: #333;
  max-width: 85ch; /* 85 characters per line */
  text-align: left;
  margin: 4rem auto;
}

/* Nav Bar */
.navbar {
  font-family: 'Inter', sans-serif;
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 30px;
  border-bottom: 1px solid #ccc;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-logo {
  height: 50px;
  margin-right: 25px; /* Space between logo and title */
}

.navbar-title {
  font-size: 19px;
  font-weight: bold;
  color: #333;
  margin-left: 6px;
  word-break: break-word;   /* Prevents overflow on tight screens */
}

.navbar-links a {
  margin-left: 20px;
  text-decoration: none;
  font-weight: bold;
  color: #333;
  transition: border-bottom 0.2s ease;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.3px;
}

.navbar-links a:hover {
  border-bottom: 3px solid #7ba9b6;
}

/* Start page button group which lets users choose between single and batch processing */
.button-group {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Terms and Conditions Page */
.terms {
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.2);
}

.terms-content {
  background-color: white;
  color: #0e3e3e;
  padding: 30px 40px;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.terms-content a {
  color: #0e3e3e;
  text-decoration: underline;
}

#agreeBtn {
  max-width: 80px;
}

.terms-header {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #0e3e3e;
}

/* Page Container */
.page-container {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two columns of equal width */
  gap: 20px; /* Space between columns */
  width: 90%;
  max-width: 1200px;
  margin: 20px auto;
  box-sizing: border-box; /* Ensures padding is included within width */
}

/* Form and Map Containers */
.form-container,
.map-container {
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
  box-sizing: border-box;
}

/* Map Container */
.map-container {
  position: sticky;
  top: 20px; /* Adjust as needed */
  height: 500px; /* Fixed height */
}

/* Map Styles */
#map {
  width: 100%;
  height: 100%;
}

/* Input Fields and Select */
input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Buttons */
.button,
button {
  padding: 10px;
  width: 100%;
  margin: 10px 0;
  border: none;
  background-color: #2f5d62;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 4px 6px rgba(47, 93, 98, 0.3);
}

.button:hover,
button:hover {
  background-color: #3a7874;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Buttons Container */
.buttons-container {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

/* Half-width Buttons */
.half-width-button {
  width: 48%;
}

/* Download Button Inside Batch Page */
#downloadBtn {
  width: auto !important;
  margin: 1.25rem auto; 
  padding: 1rem 2rem; 
  align-self: center;
}


/* Address Fields and Labels */
.from-to-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.from-to-wrapper label {
  margin-right: 5px;
}

.year {
  width: 60px;
}

/* Hidden and Visible Classes */
.hidden {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.visible {
  display: block;
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Form Group */
.form-group {
  margin-bottom: 15px;
}

/* Month Select and Year Input */
.month-select,
.year-input {
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.month-select {
  width: calc(20% - 20px);
}

.year-input {
  width: calc(20% - 10px);
}

/* Address Block */
.address-block {
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 20px;
}

/* Results Container */
#resultsContainer {
  display: none; /* Hidden by default */
  padding: 20px;
  width: 100%;
  width: 100%;
  margin: 20px auto;
  box-sizing: border-box;
  background-color: #fff; /* Optional: add a background color */
  border: 1px solid #ccc; /* Optional: add a border */
  border-radius: 8px; /* Optional: add border radius */

  /* Ensure the container can accommodate the back button */
  position: relative;
}

/* Add a scrollable container for the wide table */
.results-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fff;
  border-bottom: 1px solid #aacccc; /* base anchor */
}

/* Results Table */
.results-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: 15px;
  font-weight: 500;
}

.results-table th,
.results-table td {
  padding: 10px 12px !important;
  font-size: 15px !important;
  text-align: center;
}

.results-table th {
  font-weight: 600 !important;
}

/* Exposure Chart */
#exposureChart {
  width: 100%;
  height: auto;
  display: block; /* Ensure the canvas is displayed as a block element */
  max-height: 500px; /* Prevent chart from taking up full screen */
}

/* Responsive Design */
@media (max-width: 1200px) {
  #exposureChart {
    height: 300px;
  }

  .map-container {
    height: 400px; /* Adjust height for smaller screens */
  }
}

@media (max-width: 768px) {
  .page-container {
    grid-template-columns: 1fr; /* Stack columns */
  }

  .map-container {
    position: static; /* Remove sticky positioning on small screens */
    margin-top: 20px;
    height: 300px; /* Adjust height for smaller screens */
  }

  #exposureChart {
    height: 300px;
    margin: 20px auto;
  }
}

/* Optional: Adjust heading styling */
#resultsContainer h2 {
  font-size: 24px; /* Increase heading font size */
  margin-bottom: 20px;
}

/* Ensure the container can handle the larger chart */
.results-table-container {
  position: relative;
  width: 100%;
  overflow: hidden; /* Prevent child elements from overflowing */
}

/* Adjust canvas sizing within the container */
.results-table-container canvas {
  width: 100% !important;
  height: 400px !important; /* Match the #exposureChart height */
}

.address-table-wrapper {
  margin-top: 20px;
  overflow-x: auto; /* Allow horizontal scroll for wide tables */
  border-radius: 8px;
}

/* Address Table */
.address-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 5px;
}

.address-table th,
.address-table td {
  padding: 10px 12px;
  font-size: 15px;
  text-align: left;
}

.address-table th {
  font-weight: 600 !important;
}

/* Back Button Styles */
#backButton {
  padding: 10px 20px;
  background-color: #7a5f87;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  font-size: 16px;
  margin-top: 20px;
}

#backButton:hover {
  background-color: #6f5376;
}

/* Responsive Buttons */
.button,
#backButton {
  width: 100%; /* Ensures buttons span full width of container */
  max-width: 300px; /* Optional: Limit maximum width */
  margin: 10px auto; /* Center the button if max-width is set */
  display: block; /* Ensures block display */
}

/* Prevent Horizontal Overflow */
img,
video,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
}

.container,
.form-container,
.map-container,
#resultsContainer {
  max-width: 100%;
  overflow: visible;
}

.footer {
  border-top: 1px solid #ccc;
  position: relative;
  font-family: 'Inter', sans-serif;
  font-size: 0.9em;
}

.footer-content {
  background-color: #2f5d62;
  padding: 32px 16px; 
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.footer-center-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  margin: 0;
}

.footer-content-extra {
  border-top: 1px solid #29494b;
  background-color: #1e3a3e;
  color: #a0bcbc;
  padding: 6px 16px; 
  text-align:center;
  justify-content: center;
  display: flex;
  line-height: 2.2;
}

/* Back to top text */
.footer a {
  color: #d3f4f1;
  text-decoration: none;
}

.footer a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Footer BC Cancer Logo */
.footer-logo {
  margin-left: 5px;
  height: 60px;
}

/* Footer sticks to bottom when content is short */
html,
body {
  height: 100%;
  margin: 0;
}

/* Flex layout to push footer down */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Letting main content grow to fill available space */
.main-content {
  flex: 1;
  align-content: center;
}

/* Dropzone appearance */
.dropzone {
  width: 95%;           /* 95% of the parent container's width */
  height: 95%;          /* 95% of the parent container's height */
  margin: auto;         /* centers it horizontally and vertically */
  border: 2px solid #2f5d62;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f7f7f7;
  color: #0e3e3e;
  text-align: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dropzone.dragover {
  background-color: #e0f0f0;
}

.dropzone.file-selected {
  background-color: #e0f0f0;
  border-color: #0e3e3e;
}

/* Dropzone Remove File Icon */
#removeFileIcon {
  margin-left: 8px;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

#removeFileIcon:hover {
  transform: scale(1.2);
}

#dropzoneText {
  white-space: pre-line;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top: 4px solid #2f5d62;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto 10px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Instructions page example tables */
.example-table-container {
  max-width: 100%;
  font-size: 14px;
  color: #0e3e3e;
  padding: 16px;
  border-radius: 8px;
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 6px;
  overflow: hidden;
}

.example-table th,
.example-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

/* Scrollable table container */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #eef4f5;
  border-left: 4px solid #2f5d62;
  border-radius: 8px;
}

/* Instructions Page Styling */
.documentation {
  padding: 60px;
  margin: 50px;
  color: #0e3e3e;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.05);
}

.documentation h2,
.documentation h3 {
  color: #6f5376;
}


.documentation h2 {
  margin-top: 45px;
}

.documentation h3 {
  margin-top: 20px;
}

.documentation a {
  color: #00c0cf;
}

/* Faq Heading Styles */
.faq h3 {
  color: #a88bb1;
}

/* Instructions Page Note */
.note {
  background-color: #e6e6fa;
  border-left: 4px solid #00c0cf;
  padding: 10px;
  margin-top: 10px;
  border-radius: 8px;
}

/* Page Title Header Styles */
.header {
  margin-top: 25px; 
  background-color: #2f5d62;
  color:#ffffff;
  padding: 60px 20px 40px 20px;
  text-align: center;
  border-bottom: 8px solid #ccccee;
  border-top: 5px solid #00c0cf;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.header h1 {
  font-size: 2rem;
  letter-spacing: 1px;
}

/* White card container on which to place content */
.white-card-container {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.05);
  max-width: 1100px;
  margin: 20px auto 20px;

  /* vertical centering */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Info icon wrapper */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
  margin-left: 8px;
}

/* Info icon */
.tooltip-icon {
  color: #3e6b6e;
  font-size: 1.2em;
  cursor: pointer;
}

/* Info icon text */
.tooltip-text {
  visibility: hidden;
  width: 250px;
  background-color: #6fb1ab;
  color: #ffffff;
  text-align: center;
  padding: 18px;
  border-radius: 8px;
  position: absolute;
  z-index: 1;
  bottom: 130%; /* Show above the icon */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 0.85em;
  pointer-events: none;
}

/* Info hover */
.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Info icon hover */
.tooltip-icon:hover {
  color: #20b2aa;
}

/* Arrow shape below info text box */
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #6fb1ab transparent transparent transparent;
}


/* Development Team Styling */
.investigator-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.investigator-list li {
  margin-bottom: 20px;
  line-height: 1.5;
}

#datasetDropdown {
  color: #0e3e3e;
  text-align: center;
  margin-bottom: 5px;
}

/* === Batch Page Specific Overrides === */
.batch-page .page-container {
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1000px;
}

/* Make both panels shorter */
.batch-page .form-container,
.batch-page .map-container {
  height: 350px; 
  background-color: #f9f9f9;
  overflow: visible;
  display: flex; 
  flex-direction: column;
}

/* Make the form element fill the height of the container */
.batch-page #dataForm {
  display: flex;
  flex-direction: column;
  flex-grow: 1; 
}

.submit-wrapper {
  margin-top: auto; /* Push the element to the bottom of the flex form */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .batch-page .page-container {
    grid-template-columns: 1fr; /* Stack vertically on small screens */
  }

  .batch-page .map-container {
    margin-top: 20px;
  }
}

/* Center post submission batch page output */
#batchResultsContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
}