/* ==========================================================================
   Elevation Finder (AU) - Tool-Specific Styles

   Capped-sidebar-with-internal-scroll pattern (standing rule since Dark Sky
   Finder AU): the cap lives on the .tool-sidebar grid ITEM with
   min-height: 0 to let it actually shrink below content size, not on
   .tool-container (global.css's grid container has no height cap, and
   capping the container itself fights the grid rather than the sidebar -
   see dark-sky-finder-au.css's header comment for the full explanation).
   626px matches .map-container's own measured height (600px #map + box
   model), the same value already established site-wide for this pattern.
   ========================================================================== */

.tool-container {
  background-color: var(--bg);
}

.tool-sidebar {
  width: 380px;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-height: 626px;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-content {
  padding: 20px;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-content label:first-of-type {
  margin-top: 0;
}

.tool-section {
  margin-bottom: 28px;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card) 100%);
  margin: -20px -20px 0 -20px;
  padding: 20px;
  border-radius: 12px 12px 0 0;
}

.input-with-suggestions {
  position: relative;
}

.suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

.suggestions .item:last-child {
  border-bottom: none;
}

.suggestions .item:hover {
  background: var(--hover-bg);
}

.item-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 6px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.click-hint {
  display: none;
  font-size: 0.82rem;
  color: var(--primary);
  background: var(--glass);
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-top: 10px;
}

#map.click-armed {
  cursor: crosshair;
}

/* --------------------------------------------------------------------------
   Result display
   -------------------------------------------------------------------------- */
.unit-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.unit-toggle .btn {
  flex: 1;
  padding: 6px;
  font-size: 0.82rem;
}

.result-box {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.result-elevation {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.result-elevation .unit {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.result-feet {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.coverage-note {
  display: none;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}

/* --------------------------------------------------------------------------
   About / attribution + related tools
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 8px;
}

.tool-info p:last-child {
  margin-bottom: 0;
}

.related-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.related-link {
  display: block;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  text-decoration: none;
}

.related-link strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 2px;
}

.related-link span {
  color: var(--text-muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Map container + mobile FAB
   -------------------------------------------------------------------------- */
.map-container {
  position: relative;
  overflow: hidden;
  height: 626px;
  align-self: start;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

.fab {
  display: none;
  width: 56px;
  height: 56px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  /* No .tool-container override here - global.css's own mobile rule
     (grid-template-columns: 1fr) already stacks sidebar above map, and a
     max-height/overflow-y:auto override at this breakpoint causes the same
     grid-vs-cap conflict documented above .tool-container in
     dark-sky-finder-au.css. */

  .tool-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    overflow-y: visible;
  }

  .tool-sidebar.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .map-container {
    height: 400px;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
  }

  .result-elevation {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .input-section {
    margin: -16px -16px 0 -16px;
    padding: 16px;
  }
}
