* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  height: 100vh;
  width: 100vw;
  overflow: hidden auto;
}

svg {
  display: block;
  margin: auto;
  background-color: white;
  width: 100%;
  height: 100%;
}

#map-container path:hover {
  cursor: pointer;
}

/* Layout containers */
#main-container {
  display: grid;
  min-height: 100vh;
  min-width: 100vw;
}

#map-container {
  position: relative;
  overflow: hidden;
  grid-area: map;
}

#controls-container {
  grid-area: controls;
}

#chart-container {
  grid-area: chart;
  position: relative;
}

#chart-container-inner {
  width: 100%;
  height: 100%;
}

/* Tooltips */
.chart-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  font-size: 1.1rem;
  padding: 2px 8px;
}

#chart-tooltip {
  position: absolute;
  z-index: 1;
  background: #fff;
  padding: 4px 8px;
  border: 1px solid #999;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  opacity: 0;
}

#map-tooltip {
  z-index: 1;
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid #ccc;
  padding: 5px;
  font-size: 0.8rem;
  border-radius: 4px;
  display: none;
}

#controls-tooltip {
  padding: 10px;
  border: 5px solid red;
  border-radius: 20px;
  margin-top: 10px;
}

/* Map info panel */
#info-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255);
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
  max-width: 180px;
}

#info-title {
  font-weight: bold;
}

#color-legend {
  margin-top: 10px;
}
#time-slider-container {
  margin-top: 12px;
}

#info-description {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 200px; /* show beside info-panel */
  background: rgba(255, 255, 255);
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
}

#info-help {
  background-color: #0077cc;
  color: white;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

/* Controls layout */
#controls-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background-color: #f8f8f8;
  border: 1px solid #aaa;
  overflow: auto;
}

/* Control panel styling */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  margin: 0.2rem;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.control-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.25rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group label {
  font-size: 0.8rem;
  color: #555;
}

.control-group select {
  max-width: 200px;
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #f9f9f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s ease;
}

.control-group select:focus {
  border-color: #4a90e2;
  outline: none;
  background-color: #fff;
}

.control-panel option {
  white-space: normal;
}

#edit-metadata-button {
  max-width: 120px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: #333;
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#edit-metadata-button:hover {
  background-color: #e6e6e6;
  border-color: #999;
}

#edit-metadata-button:focus {
  outline: none;
  border-color: #4a90e2;
  background-color: #fff;
}

/* Responsive layouts */
/* Desktop */
@media (min-width: 768px) {
  #main-container {
    height: 100vh;
    grid-template-columns: 60% 40%;
    grid-template-rows: 30% 70%;
    grid-template-areas:
      "map controls"
      "map chart";
  }

  #chart-container {
    overflow: hidden;
    display: block;
  }
}

/* Mobile */
@media (max-width: 767px) {
  #main-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "controls"
      "map";
  }

  #map-container {
    width: 100vw;
    height: 95vh;
  }

  #controls-container {
    overflow: auto;
  }

  #chart-container {
    display: none;
  }
}

/* Helper classes */
.strike {
  text-decoration: line-through;
}

.noselect {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version, currently
                              supported by Chrome, Edge, Opera and Firefox */
}

.hidden {
  display: none;
}

.inline-block {
  display: inline-block;
}
