/* ==========================================================================
   Drive Time Map Tool (Australia) - Tool-Specific Styles
   Only styles unique to this tool
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tool Container Layout - capped-sidebar pattern (grid-correct): .tool-sidebar
   and .map-container get the SAME literal pixel value on height/max-height,
   sidebar additionally needs min-height: 0 as a grid child for the cap to
   engage. Do not set display/max-height on .tool-container itself - global.css
   already sets it to grid, and redeclaring flex here is exactly the mismatch
   that broke dark-sky-finder-au's sidebar and (undetected until now, latent)
   map-radius-au's. No height set here at all deliberately.
   -------------------------------------------------------------------------- */

.tool-sidebar {
  max-height: 650px;
  min-height: 0;
  overflow-y: auto;
}

.map-container {
  height: 650px;
}

.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;
}

.tool-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

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

/* --------------------------------------------------------------------------
   Search Suggestions
   -------------------------------------------------------------------------- */
.suggestions {
  position: relative;
  background-color: var(--card);
  border: 1px solid var(--border);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  display: none;
  box-shadow: var(--shadow);
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background-color 0.2s ease;
}

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

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

/* --------------------------------------------------------------------------
   Address Autocomplete (appears once a postcode with an address shard is
   entered; hidden by default so a postcode with no shard degrades to
   postcode-only behaviour with no empty/dead field on screen)
   -------------------------------------------------------------------------- */
.input-with-suggestions {
  position: relative;
}

.address-field {
  display: none;
  margin-top: 8px;
}

.address-field.show {
  display: block;
}

.suggestions .item .item-sub {
  color: var(--text-muted);
  font-size: 12px;
  display: block;
}

/* Verbatim G-NAF/Overture attribution block (au-address-cook/PROVENANCE.md)
   - same card look as .tool-info, kept as its own class since the markup
   is copied verbatim per the EULA rather than rebuilt with this page's
   own class names. */
.data-attribution {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.data-attribution p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 10px;
}

.data-attribution p:last-child {
  margin-bottom: 0;
}

.data-attribution a {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Segmented toggles - shared shape for mode toggle, duration steps, speed
   presets. Mode toggle's "Drive Time" side gets a .disabled state (see
   .seg-btn.disabled below) rather than being removed from the DOM, so the
   "coming soon" messaging is visible rather than the option looking like it
   never existed.
   -------------------------------------------------------------------------- */
.seg-toggle {
  display: flex;
  gap: 0;
  margin: 12px 0;
  background-color: var(--hover-bg);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.seg-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.seg-btn.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.seg-btn.disabled:hover {
  background: transparent;
}

.coming-soon-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.mode-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin: 8px 0 4px;
  line-height: 1.5;
}

/* Duration and speed rows wrap on narrow sidebars instead of squashing */
.duration-steps,
.speed-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.duration-steps .seg-btn,
.speed-presets .seg-btn {
  flex: 0 0 auto;
  padding: 8px 12px;
}

/* --------------------------------------------------------------------------
   Big Display (estimated radius)
   -------------------------------------------------------------------------- */
.big-display {
  text-align: center;
  padding: 20px;
  margin: 16px 0;
  background-color: var(--glass);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.big-display .display-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
}

.big-display .display-unit {
  font-size: 16px;
  color: var(--text-muted);
  margin-left: 8px;
}

.big-display .display-note {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Tool Info Box
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.tool-item {
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
}

/* --------------------------------------------------------------------------
   Button Groups
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

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

/* --------------------------------------------------------------------------
   File Upload
   -------------------------------------------------------------------------- */
.file-upload-label {
  display: block;
  cursor: pointer;
  margin-bottom: 12px;
}

.file-upload-label input[type="file"] {
  display: none;
}

.file-upload-btn {
  display: block;
  padding: 14px;
  background-color: white;
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .file-upload-btn {
  background-color: rgba(255, 255, 255, 0.03);
}

.file-upload-btn:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */
.map {
  width: 100%;
  height: 100%;
}

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

.coordinates-control {
  background: var(--glass) !important;
  backdrop-filter: blur(12px);
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Mobile FAB (Floating Action Button)
   -------------------------------------------------------------------------- */
.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;
}

/* --------------------------------------------------------------------------
   Comparison graphic (circle vs. reachable-area illustration in SEO content)
   -------------------------------------------------------------------------- */
.comparison-graphic {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  justify-content: center;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.comparison-graphic figure {
  margin: 0;
  text-align: center;
  flex: 0 0 auto;
}

.comparison-graphic figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  max-width: 220px;
}

.comparison-graphic svg {
  display: block;
  margin: 0 auto;
}

.illustrative-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tool-sidebar {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    transition: max-height 0.3s ease;
  }

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

  .map-container {
    height: 500px;
    min-height: 400px;
  }

  .map {
    min-height: 400px;
    height: 500px;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
  }

  .comparison-graphic {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 600px) {
  .sidebar-content {
    padding: 16px;
  }

  .tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }

  .big-display .display-value {
    font-size: 28px;
  }

  .big-display .display-unit {
    font-size: 14px;
  }

  .map-container {
    height: 400px;
    min-height: 400px;
  }
}
