/* Sentinel-2 Satellite Image Viewer — orbital dark theme */
.atm-container {
  --atm-bg: #0a0f1a;
  --atm-panel: #121a2b;
  --atm-panel-2: #0f1626;
  --atm-line: #24304a;
  --atm-text: #e8eef7;
  --atm-muted: #93a3bd;
  --atm-accent: #4ea3ff;
  --atm-truecolor: #4ea3ff;
  --atm-ndvi: #5ad17a;
  --atm-ndwi: #37c8d6;
  color: var(--atm-text);
}

/* below-map content (bookmarks / chat / attribution) keeps a readable
   content width even though the map above is full-bleed */
.atm-below-fold {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ---- map ---- */
/* full-bleed: fills the viewport edge-to-edge below the fixed 80px navbar
   (.main-content already applies the 80px top offset) */
.atm-map-wrap {
  position: relative;
  overflow: hidden;
  background: #05080f;
  height: calc(100vh - 80px);
}
#atm-map {
  height: 100%;
  min-height: 420px;
  background: #05080f;
}
.leaflet-container { background: #05080f; font-family: inherit; }

/* Tile-fetch indicator -- separate from .atm-status (which only reflects
   the /api/search call): a search can resolve in under a second while the
   actual tile images it names are still streaming in behind the per-tile
   placeholder pattern for several more seconds, especially at low zoom or
   over a slow connection. Top-right so it never competes with the
   top-left zoom control or the control box. */
.atm-tile-loading {
  position: absolute;
  top: 10px;
  right: 10px;
  /* Leaflet's own top/bottom corner controls sit at z-index 1000
     (.leaflet-top/.leaflet-bottom) and 800 (.leaflet-control) -- this only
     needs to clear the map panes themselves (atm-left pane is 300), since
     neither corner badge here actually overlaps a Leaflet control (badge is
     top-right, zoom control is top-left; coords is bottom-left, attribution
     is bottom-right). */
  z-index: 650;
  display: flex;
  align-items: center;
  gap: .5em;
  padding: .4em .75em;
  border-radius: 999px;
  background: rgba(18, 26, 43, .92);
  border: 1px solid var(--atm-line);
  color: var(--atm-text);
  font-size: .85rem;
  pointer-events: none;
}
.atm-tile-loading[hidden] { display: none; }
.atm-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid var(--atm-line);
  border-top-color: var(--atm-accent);
  border-radius: 50%;
  animation: atm-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .atm-spinner { animation: none; border-top-color: var(--atm-line); }
}
@keyframes atm-spin {
  to { transform: rotate(360deg); }
}

/* Map-center coordinate readout -- bottom-left, clear of Leaflet's own
   bottom-right attribution control. */
.atm-coords {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 650;
  padding: .35em .7em;
  border-radius: 6px;
  background: rgba(18, 26, 43, .92);
  border: 1px solid var(--atm-line);
  color: var(--atm-muted);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: .78rem;
  letter-spacing: .01em;
  pointer-events: none;
}

/* ---- single left-docked control panel ---- */
/* Anchored below Leaflet's own top-left zoom control (~52px tall + 10px
   margin) so the two never overlap; top-anchored rather than vertically
   centered because the stacked control list is tall enough on a typical
   desktop viewport that centering could push it off the top anyway. */
.atm-control-box {
  position: absolute;
  z-index: 500;
  top: 4.6rem;
  left: 1rem;
  width: min(310px, calc(100vw - 2rem));
  max-height: calc(100vh - 80px - 5.6rem);
  display: flex;
  flex-direction: column;
  background: rgba(18, 26, 43, .92);
  border: 1px solid var(--atm-line);
  border-radius: 14px;
  /* Clips .atm-control-box-body's scrollbar/content to these rounded
     corners -- the body owns the actual scrolling (overflow-y below), this
     box's own overflow is otherwise visible/irrelevant. */
  overflow: hidden;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}
.atm-control-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem .9rem .5rem .9rem;
  flex-shrink: 0;
}
.atm-control-box-title { font-size: .8rem; font-weight: 600; color: var(--atm-muted); }
.atm-control-toggle {
  background: var(--atm-panel-2);
  border: 1px solid var(--atm-line);
  color: var(--atm-text);
  font-size: 1rem;
  line-height: 1;
  border-radius: 6px;
  width: 1.8rem;
  height: 1.8rem;
  cursor: pointer;
}
.atm-control-toggle:hover,
.atm-control-toggle:focus-visible { border-color: var(--atm-accent); color: var(--atm-accent); }
.atm-control-box-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 0 .9rem .9rem;
}
/* Collapsed: only the header (title + toggle) stays visible, so the map
   underneath is unobstructed. */
.atm-control-box.is-collapsed .atm-control-box-body { display: none; }

/* Child controls below sit inside .atm-control-box, which already supplies
   the translucent/blurred panel treatment -- children use a flat panel-2
   fill instead of repeating their own blur, so nested panels stay legible
   rather than stacking into visual mush. */
.atm-search-form { display: flex; gap: .4rem; }
.atm-search-form input {
  flex: 1;
  background: var(--atm-panel-2);
  border: 1px solid var(--atm-line);
  border-radius: 8px;
  padding: .55rem .8rem;
  color: var(--atm-text);
  font-size: .92rem;
}
.atm-search-form input:focus { outline: none; border-color: var(--atm-accent); }
.atm-search-form button {
  background: var(--atm-accent);
  color: #061223;
  border: none;
  border-radius: 8px;
  padding: .55rem .9rem;
  font-weight: 700;
  cursor: pointer;
}
.atm-search-status {
  margin: 0;
  font-size: .8rem;
  color: var(--atm-muted);
  background: var(--atm-panel-2);
  border-radius: 8px;
  padding: .4rem .6rem;
}

.atm-mode-switch {
  display: flex;
  flex-wrap: wrap;
  background: var(--atm-panel-2);
  border: 1px solid var(--atm-line);
  border-radius: 999px;
  padding: .2rem;
  gap: .15rem;
}
.atm-mode-btn {
  background: none;
  border: none;
  color: var(--atm-muted);
  font-size: .78rem;
  font-weight: 600;
  padding: .4rem .65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex: 1 1 auto;
}
.atm-mode-btn.is-active { background: rgba(78,163,255,.18); color: var(--atm-truecolor); }
.atm-mode-btn[data-mode="ndvi"].is-active { background: rgba(90,209,122,.18); color: var(--atm-ndvi); }
.atm-mode-btn[data-mode="ndwi"].is-active { background: rgba(55,200,214,.18); color: var(--atm-ndwi); }

.atm-status {
  margin: 0;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  color: var(--atm-text);
  background: var(--atm-panel-2);
  border-radius: 8px;
  padding: .5rem .7rem;
}

/* ---- timeline (stacked inside the narrow left control box, so the
   play button gets its own row and the range + date label share the row
   below it, rather than all three sitting inline as they did in the old
   wide bottom overlay) ---- */
.atm-timeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  background: var(--atm-panel-2);
  border: 1px solid var(--atm-line);
  border-radius: 12px;
  padding: .7rem .8rem;
}
.atm-play {
  background: var(--atm-accent);
  color: #061223;
  border: none;
  border-radius: 8px;
  padding: .55rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1 1 100%;
}
.atm-play:disabled { opacity: .5; cursor: default; }
.atm-load-more {
  background: none;
  border: 1px solid var(--atm-line);
  color: var(--atm-text);
  border-radius: 8px;
  padding: .5rem .8rem;
  font-size: .85rem;
  cursor: pointer;
  width: 100%;
}
.atm-load-more:hover:not(:disabled) { border-color: var(--atm-accent); color: var(--atm-accent); }
.atm-load-more:disabled { opacity: .4; cursor: default; }
.atm-timeline-range { flex: 1 1 auto; min-width: 0; accent-color: var(--atm-accent); }
.atm-timeline-range:disabled { opacity: .4; }
#atm-date-label, #atm-date-label-b {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 5.5em;
  text-align: right;
  font-size: .82rem;
}

/* ---- bookmarks ---- */
.atm-section-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--atm-muted);
  margin: 1.6rem 0 .7rem;
}
.atm-bookmark-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .7rem;
}
.atm-chip {
  text-align: left;
  background: var(--atm-panel);
  border: 1px solid var(--atm-line);
  border-radius: 12px;
  padding: .9rem 1rem;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.atm-chip:hover { transform: translateY(-2px); border-color: var(--atm-accent); }
.atm-chip.is-active { border-color: var(--atm-accent); box-shadow: 0 0 0 2px rgba(78,163,255,.25); }
.atm-chip-title { font-weight: 700; }
.atm-chip-region { font-size: .82rem; color: var(--atm-muted); }

/* ---- chat ---- */
.atm-chat { margin: 1.6rem 0; }
.atm-chat-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.atm-chat-form input {
  flex: 1 1 260px;
  background: var(--atm-panel);
  border: 1px solid var(--atm-line);
  border-radius: 10px;
  padding: .8rem 1rem;
  color: var(--atm-text);
  font-size: 1rem;
}
.atm-chat-form input:focus {
  outline: none;
  border-color: var(--atm-accent);
  box-shadow: 0 0 0 3px rgba(78, 163, 255, .2);
}
.atm-chat-form button {
  background: var(--atm-accent);
  color: #061223;
  border: none;
  border-radius: 10px;
  padding: .8rem 1.3rem;
  font-weight: 700;
  cursor: pointer;
}
.atm-chat-form button:disabled { opacity: .55; cursor: default; }
.atm-guide-reply {
  margin: .9rem 0 0;
  padding: .9rem 1.1rem;
  background: var(--atm-panel-2);
  border-left: 3px solid var(--atm-accent);
  border-radius: 6px;
  line-height: 1.55;
}

.atm-attribution {
  margin-top: 2rem;
  font-size: .78rem;
  color: var(--atm-muted);
  border-top: 1px solid var(--atm-line);
  padding-top: 1rem;
}

