/* Atlas page — map-first split layout using the 2026 Findhelp primary palette. */

.atlas-body {
  overflow: hidden;
  --fh-teal: #008080;
  --fh-teal-dark: #08444a;
  --fh-teal-darker: #06292b;
  --fh-teal-muted: #08444a;
  --fh-burgundy: #06292b;
  --fh-cream: #f4f8f8;
  --fh-border: #e3e8e8;
  --fh-border-warm: #e0ebeb;
  --fh-text: #06292b;
  --fh-text-muted: #767676;
  --fh-white: #ffffff;
  --fh-orange: #e4572e;
  --danger: #e4572e;
  --bg: var(--fh-cream);
  --bg-elevated: var(--fh-white);
  --border: var(--fh-border);
  --text: var(--fh-burgundy);
  --text-body: var(--fh-text);
  --text-muted: var(--fh-text-muted);
  --accent: var(--fh-teal);
  --accent-dark: var(--fh-teal-dark);
}

.atlas-app {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.atlas-app.auth-locked .atlas-chat,
.atlas-app.auth-locked .atlas-map-pane {
  visibility: hidden;
  pointer-events: none;
}

.atlas-chat {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--fh-border-warm);
  background: var(--bg-elevated);
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(6, 41, 43, 0.06);
}

.atlas-chat-header {
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--fh-border-warm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.atlas-brand .brand-ai-name {
  margin-top: 0.35rem;
}

.atlas-nav-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.atlas-nav-link:hover {
  text-decoration: underline;
}

.atlas-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 6rem;
  background:
    radial-gradient(ellipse 80% 40% at 0% 0%, rgba(0, 128, 128, 0.05), transparent),
    var(--bg);
}

.atlas-messages .message {
  max-width: 100%;
}

.atlas-messages .empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: auto 0;
  padding: 0.5rem;
}

.atlas-composer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--fh-border-warm);
  background: var(--bg-elevated);
  flex-shrink: 0;
  min-width: 0;
}

.atlas-composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-body);
  background: var(--fh-white);
}

.atlas-composer textarea:focus {
  outline: 2px solid rgba(0, 128, 128, 0.35);
  outline-offset: 1px;
}

.atlas-chat-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 1.15rem 0.85rem;
  border-top: 1px solid var(--fh-border-warm);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.atlas-map-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(160deg, #e0ebeb 0%, #f4f8f8 55%, #ffffff 100%);
}

.atlas-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.atlas-legend {
  position: absolute;
  z-index: 500;
  left: 1rem;
  bottom: 1.25rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--fh-border-warm);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text-body);
  box-shadow: 0 8px 24px rgba(6, 41, 43, 0.08);
  max-width: min(240px, calc(100% - 2rem));
}

.atlas-legend h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fh-burgundy);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.atlas-legend-bar {
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(6, 41, 43, 0.12);
  margin: 0.35rem 0 0.25rem;
}

.atlas-legend-scale {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.45rem;
}

.atlas-legend-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 0.45rem;
  line-height: 1.3;
}

.atlas-legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0;
  font-variant-numeric: tabular-nums;
}

.atlas-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(6, 41, 43, 0.15);
  flex-shrink: 0;
}

.atlas-map-note {
  position: absolute;
  z-index: 500;
  right: 1rem;
  top: 1rem;
  max-width: min(320px, calc(100% - 2rem));
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--fh-border-warm);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  box-shadow: 0 8px 24px rgba(6, 41, 43, 0.08);
}

.atlas-map-caption {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-left: 3px solid var(--fh-teal);
  background: rgba(0, 128, 128, 0.06);
  border-radius: 0 6px 6px 0;
}

.atlas-map-caption h4 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fh-burgundy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.atlas-map-caption ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-body);
  font-size: 0.9rem;
  line-height: 1.45;
}

.atlas-map-caption li {
  margin: 0.15rem 0;
}

.atlas-map-download {
  position: absolute;
  z-index: 600;
  right: 1rem;
  bottom: 1.25rem;
  border: 1px solid var(--fh-border-warm);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--fh-burgundy);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(6, 41, 43, 0.08);
}

.atlas-map-download:hover {
  background: var(--fh-white);
  border-color: rgba(0, 128, 128, 0.45);
  color: var(--accent-dark);
}

.atlas-map-download:disabled {
  opacity: 0.65;
  cursor: wait;
}

.atlas-map-pane.is-exporting .leaflet-control-zoom,
.atlas-map-pane.is-exporting .atlas-map-download,
.atlas-map-pane.is-exporting .atlas-map-note {
  visibility: hidden !important;
}

.atlas-activity {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 900px) {
  .atlas-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 38dvh) minmax(0, 1fr);
  }

  .atlas-chat {
    border-right: none;
    border-bottom: 1px solid var(--fh-border-warm);
    order: 1;
    overflow-y: auto;
  }

  .atlas-map-pane {
    order: 0;
    min-height: 0;
  }

  .atlas-legend {
    left: 0.65rem;
    bottom: 0.65rem;
    max-width: min(200px, calc(100% - 8.5rem));
  }

  .atlas-map-download {
    right: 0.65rem;
    bottom: 0.65rem;
  }

  .atlas-map-note {
    right: 0.65rem;
    top: 0.65rem;
    max-width: min(240px, calc(100% - 1.3rem));
  }
}

@media (max-height: 760px) {
  .atlas-chat-header {
    padding: 0.7rem 1rem 0.6rem;
    gap: 0.4rem;
  }

  .atlas-composer {
    padding: 0.6rem 1rem;
  }

  .atlas-chat-footer {
    padding: 0.4rem 1rem 0.6rem;
  }

  .atlas-messages {
    min-height: 4.5rem;
    padding: 0.75rem 1rem;
  }
}
