/* ==========================================================================
   INDEX PAGE (Map View)
   Page-specific overrides for templates/pages/index.html (map page).
   Most component styling lives under static/css/src/06-components/*.css
   and is bundled via static/css/main.css. Keep this file small.
   ========================================================================== */

/* -------------------------------------------------------------------------
   Page Layout Overrides
   ------------------------------------------------------------------------- */
/* Prevent page scroll on index; internal panels manage their own scroll */
body {
  overflow: hidden;
}

main {
  overflow: hidden;
  min-height: 0;
}

/* Scope padding to the index root container only */
.index-root {
  padding: var(--space-2);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Container for map + overlay panel - needs position:relative for absolute panel */
.index-root>.d-flex.flex-row {
  position: relative;
}

/* Ensure map fills the flex container properly */
#map {
  flex: 1 1 auto;
  min-height: 500px;
  width: 100%;
  height: 100%;
}

/* -------------------------------------------------------------------------
   Top Filters Bar (Overlay Mode)
   ------------------------------------------------------------------------- */
.random-stop-item {
  display: inline-flex;
  justify-content: center;
}

.random-stop-hint {
  z-index: 1005;
}

.osm-group-subfilters {
  border-start: 2px solid rgba(59, 130, 246, 0.2);
  margin-top: var(--space-2);
}

.osm-group-subfilters .form-check {
  margin-bottom: var(--space-1);
}

.osm-pair-subfilters {
  border-start: 2px solid rgba(59, 130, 246, 0.15);
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

.osm-pair-subfilters .form-check {
  margin-bottom: var(--space-1);
}

/* -------------------------------------------------------------------------
   Smart Search Hint Tooltip
   ------------------------------------------------------------------------- */
.smart-search-hint {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1002;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  min-width: 250px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-dark);
  pointer-events: none;
}

.smart-search-hint.random-stop-hint {
  left: 50%;
  transform: translateX(-50%);
  min-width: 0;
  width: 170px;
  max-width: 170px;
  padding: var(--space-2);
  text-align: center;
  white-space: normal;
}

.smart-search-hint.random-stop-hint::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-start: 6px solid transparent;
  border-end: 6px solid transparent;
  border-bottom: 6px solid rgba(255, 255, 255, 0.97);
  filter: drop-shadow(0 -1px 0 var(--color-border));
}

.smart-search-hint__title {
  font-weight: var(--font-semibold);
  color: var(--color-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-1);
  font-size: 0.65rem;
}

.smart-search-hint__item {
  padding: 2px 0;
  line-height: var(--leading-snug);
}

.smart-search-hint__item kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 0.3rem;
  color: var(--color-primary);
  font-weight: var(--font-medium);
}

/* Smart Search Error Feedback – mirrors .smart-search-hint */
.smart-search-feedback {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  min-width: 250px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-danger, #dc3545);
}

/* Doc info icon shared by hint and error tooltips */
.smart-search-doc-link {
  pointer-events: auto;
  color: var(--color-fg-muted);
  margin-left: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.smart-search-doc-link:hover {
  opacity: 1;
  color: var(--color-primary);
  text-decoration: none;
}

/* Zoom banner: centered overlay with semi-transparent background */
.zoom-banner {
  position: fixed;
  left: 50%;
  top: calc(var(--navbar-height) + 70px);
  transform: translateX(-50%);
  z-index: 1001;
  pointer-events: auto;
  background: rgba(80, 80, 80, 0.65);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 1;
  transition: top 180ms ease, opacity 160ms ease;
}

.zoom-banner.zoom-banner--faded {
  opacity: 0;
  pointer-events: none;
}

.zoom-banner.zoom-banner--filters-open {
  top: calc(var(--navbar-height) + 220px);
}

#activeFilters {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0;
  justify-content: flex-start;
  padding: 0;
  border-top: none;
  background-color: transparent;
  width: 100%;
  max-width: 520px;
}

.header-summary #activeFilters {
  width: 100%;
  max-width: none;
  padding: 0.5rem 0 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background-color: transparent;
}

.header-summary #headerSummaryStats {
  width: 100%;
}

@media (max-width: 768px) {
  .top-filters-bar {
    gap: var(--space-2);
    padding: var(--space-2);
    max-height: 68vh;
  }

  .top-filters-bar .filter-item {
    width: calc(50% - var(--space-2));
    margin: 0 !important;
  }

  .top-filters-bar .filter-item.mobile-filter-item--search,
  .top-filters-bar .filter-item.mobile-filter-item--random {
    width: 100%;
  }

  .smart-search-input-group {
    width: 100% !important;
    min-width: 0;
  }

  .filter-item .random-stop-btn {
    width: 100%;
    justify-content: center;
  }

  #activeFilters {
    max-width: calc(100vw - 2.5rem);
  }

  #filterInfoContainer {
    margin-top: var(--space-2);
    max-width: none !important;
    width: 100%;
  }

  .zoom-banner {
    top: calc(var(--navbar-height) + 96px);
    width: min(340px, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .zoom-banner.zoom-banner--filters-open {
    top: calc(var(--navbar-height) + 188px);
  }
}

/* Map container fills entire space (panel overlays it) */
#mapContainer {
  flex: 1 1 auto;
  min-width: 0;
  /* Required for Leaflet/Flexbox to work properly */
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* -------------------------------------------------------------------------
   OSM Query Tool Styles
   ------------------------------------------------------------------------- */
.osm-query-button {
  background-color: var(--color-bg);
  width: 30px;
  height: 30px;
  line-height: 30px;
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--color-dark);
  transition: all var(--transition-fast);
}

.osm-query-button:hover {
  background-color: var(--color-bg-muted);
}

.osm-query-button.active {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.osm-query-button i {
  font-size: var(--text-sm);
}

.osm-query-results .last-child-no-border:last-child {
  border-bottom: none !important;
}

.osm-query-loading {
  padding: var(--space-2);
  text-align: center;
}