/* Base */
html,
body,
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #f6f7fa;
  font-family: system-ui, sans-serif;
}

.temp-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-wrapper {
  flex: 1;
}
.codes-selector {
  display: flex;
  gap: 3px;
}

/* Layout */
.container {
  display: flex;
  height: 100vh;
  width: 100vw;
}
.map-section {
  flex: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9eef6;
}
#map {
  position: relative;
  height: 90vh;
  width: 95%;
  max-width: 1200px;
  margin: auto;
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}
.search-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 5px 24px 0 18px;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.04);
  min-width: 240px;
}

/* Search */
#search-label {
  font-size: 1.2rem;
  margin-bottom: 14px;
  color: #222;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  margin-bottom: 12px;
  width: 100%;
}
#search {
  flex: 1;
  min-width: 0;
  padding: 10px 36px 10px 14px;
  font-size: 1rem;
  border: 1px solid #bbb;
  border-radius: 7px;
  background: #fafbfe;
}
#search-clear {
  display: none;
  position: absolute;
  top: 50%;
  right: 98px;
  transform: translateY(-50%);
  font-size: 1.1em;
  color: #aaa;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 6px;
  z-index: 10;
  transition: color 0.2s;
}
#search-clear:hover {
  color: #e44;
}
#search-btn {
  flex: 0 0 auto;
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 7px;
  background: #4876ec;
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}
#search-btn:hover {
  background: #365dc6;
}

#search-results {
  /* fill remaining vertical space even when empty */
  width: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  background-color: #f6f7fa;
  flex: 1 1 auto;
  min-height: 0; /* allow flex to size it correctly */
  width: 100%;
  overflow-y: auto;

  /* pale grey background */
  background-color: #f5f5f5;
  padding: 8px; /* optional padding for content */
  border-radius: 6px; /* optional rounded corners */
}

/* Highlight animation */
.highlight-marker {
  animation: bounce 0.6s;
  filter: drop-shadow(0 0 7px #fc0);
}
@keyframes bounce {
  0%,
  50%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-18px);
  }
  70% {
    transform: translateY(-8px);
  }
}

/* Legend */
.map-legend {
  position: absolute;
  bottom: 18px;
  left: 18px;
  width: 240px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #b5bdd6;
  border-radius: 8px;
  overflow: hidden;
  max-height: 400px;
  transition: max-height 0.3s ease;
  z-index: 1200;
}
.map-legend.collapsed {
  max-height: 36px;
}
.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 36px;
  padding: 0 8px;
  background: rgba(230, 230, 250, 0.3);
}
.legend-title {
  font-weight: 700;
  color: #365dc6;
}
.legend-toggle {
  cursor: pointer;
  font-size: 1em;
  user-select: none;
  /* transition: transform 0.3s; */
}
.map-legend.collapsed .legend-toggle {
  transform: rotate(-90deg);
}
.legend-content {
  padding: 8px 12px 12px;
  font-size: 0.82em;
  line-height: 1.4;
  color: #1e2335;
}

/* Temp filter */
.temp-filter {
  margin-top: 5px;
  font-size: 1em;
  color: #333;
}
/* First row: °F/°C + W/H/B */
.unit-codes-row {
  display: flex;
    font-size: 0.8rem;
  justify-content: space-between;
  align-items: center;
  width: 100%;      /* ensure it fills its container */
  margin-bottom: 8px;
}

.unit-selector label,
.codes-selector label {
  white-space: nowrap;
}
#temp-reset-btn {
  /* smaller size */
  padding: 4px 10px;
  font-size: 0.8em;

  /* similar shape, new color */
  background: #bbb;
  color: #222;
  border: none;
  border-radius: 7px;

  cursor: pointer;
  transition: background 0.2s;
}

#temp-reset-btn:hover {
  background: #999;
}

/* Second row: slider & reset on one line */
.slider-reset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.slider-wrapper {
  flex: 1;
}

/* Reset button styling inherited from #temp-reset-btn */
.actions {
  flex-shrink: 0;
}

/* Range label underneath */
.slider-label {
  font-size: 0.9em;
  margin-bottom: 12px;
}

/* GitHub link */
.github-link-container {
  margin-top: auto;
  width: 100%;
  text-align: center;
  padding-bottom: 8px;
}
.github-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.9em;
  color: #365dc6;
  text-decoration: none;
}
.github-link img {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

/* Mobile tweaks */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }
  .map-section {
    flex: 1;
    width: 100vw;
    max-width: 100vw;
  }
  #map {
    width: 100vw;
    height: 48vh;
    max-width: 100vw;
  }
  .search-section {
    padding: 24px 12px;
  }
  .map-legend {
    position: static;
    margin: 10px auto 0;
    max-width: 99vw;
    font-size: 0.93em;
  }
  .search-row {
    gap: 8px;
  }
  #search-clear {
    right: 18px;
  }
  #search-btn {
    padding: 8px 12px;
    font-size: 0.95em;
    white-space: nowrap;
  }
}
