/* Global styles */
body {
  font-family: Arial, sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
}

/* Map container */
#map {
  width: 80%; /* Reduced width to prevent map from dominating the screen */
  height: auto;
  margin: 0 auto;
  position: relative;
}

/* Responsive SVG */
svg {
  width: 100%;
  height: auto;
}

/* Controls container */
#controls {
  margin: 20px;
  display: flex;
  flex-direction: column; /* Ensures vertical stacking */
  gap: 15px; /* Adds space between each control group */
  align-items: center; /* Centers items horizontally */
}

/* Control Group Styling */
.control-group {
  display: flex;
  flex-direction: column; /* Stacks elements vertically within each group */
  width: 100%; /* Allows child elements to take full width */
  max-width: 400px; /* Optional: Limits the width for better readability */
}

/* Adjust elements within control groups */
.control-group label {
  margin-bottom: 5px; /* Adds space below labels */
}

.control-group select,
.control-group input[type="number"] {
  padding: 8px;
  font-size: 14px;
  width: 100%; /* Ensures selects and inputs take full width of their container */
}

.control-group button {
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 10px; /* Adds space above buttons */
  width: 100%; /* Ensures buttons take full width */
}

/* Optional: Style the buttons when grouped */
.control-group:last-child {
  flex-direction: row;
  gap: 10px;
}

.control-group:last-child button {
  width: 100%;
}

@media (max-width: 600px) {
  /* Ensure all control groups take full width on small screens */
  .control-group {
      max-width: none;
  }

  /* For the last control group (buttons), stack them vertically */
  .control-group:last-child {
      flex-direction: column;
      gap: 10px;
  }

  .control-group:last-child button {
      width: 100%;
  }
}

/* Tooltip styling */
.tooltip {
  position: absolute;
  text-align: left;
  width: auto;
  padding: 8px;
  font: 12px sans-serif;
  background: #fff;
  color: #000;
  border: 1px solid #ccc;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.7; /* 70% opacity */
  transition: opacity 0.3s;
}

/* Tables container */
#tables {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 20px;
}

/* Individual table containers */
.table-container {
  width: 50%; /* Occupies half the width on larger screens */
  margin-bottom: 20px;
}

.table-container table {
  width: 100%;
}

.table-container h3 {
  text-align: center;
  font-size: 16px;
}

/* Select elements styling */
select {
  width: auto;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

/* Zoom controls styling */
.zoom-controls {
  position: absolute;
  bottom: 10px;
  left: 10px;
}

.zoom-controls button {
  margin: 5px 0;
  padding: 5px 10px;
}

/* Suggestion and Reset button styling */
#suggestionButton, #resetButton {
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 10px;
}

/* Info box styling */
.info-box {
  position: fixed;
  top: 150px;
  left: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px;
  border-radius: 5px;
  max-width: 200px;
  display: none; /* Hidden by default */
}

/* Legend styling */
#legend {
  width: 100%;
  margin: 10px auto;
}

#legend svg {
  display: block;
  margin: 0 auto;
}

.legend text {
  fill: #000;
}

/* Legend background for readability */
.legend rect {
  fill: rgba(255, 255, 255, 0.7); /* 70% opacity */
  stroke: #ccc;
}

/* Table cell styling */
.table-container th, .table-container td {
  text-align: center;
  border: 1px solid #ccc;
  padding: 5px;
  font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #controls {
      flex-direction: column;
      align-items: center;
  }

  .table-container {
      width: 100%;
      max-width: 300px; /* Limit max width on smaller screens */
  }

  #map {
      width: 100%;
  }
}

/* Ensure controls stack vertically on small screens */
@media screen and (max-width: 600px) {
  #controls {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
  }
  
  .control-group {
      width: 100%;
      max-width: none;
  }
  
  .control-group label,
  .control-group select,
  .control-group input[type="number"],
  .control-group button {
      width: 100%;
  }
  
  /* Ensure buttons stack vertically */
  .control-group:last-child {
      flex-direction: column;
      gap: 10px;
  }
  
  .control-group:last-child button {
      width: 100%;
  }
}

/* Optional: Add background color to table headers */
.table-container th {
  background-color: #f2f2f2;
}

/* Loading indicator styling */
#loading {
  font-size: 18px;
  color: #555;
}
