/* maps.css — Archie driving-aid map (spec-maps-driving-aid.md P1). Dark overlays
   over a full-screen Leaflet map; reuses the theme vars from style.css. */

html, body { height: 100%; margin: 0; }
.maps-body { overflow: hidden; font-family: var(--font-body); background: var(--bg); }

/* Chat with Archie — slide-up panel (bottom-right; full-width on phones). */
#btn-chat {
  pointer-events: auto; background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 3px 12px; font-size: 12px; cursor: pointer;
}
#chat-panel {
  position: absolute; z-index: 1200; right: 12px; bottom: 12px;
  width: min(420px, calc(100vw - 24px)); height: min(60vh, 560px);
  display: flex; flex-direction: column;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: var(--text); overflow: hidden;
}
#chat-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
#chat-title { font-weight: 600; }
#chat-head button {
  background: var(--bg-surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px 9px; font-size: 12px; cursor: pointer;
}
#btn-chat-close { margin-left: auto; }
#chat-history-list {
  max-height: 40%; overflow-y: auto; border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.chat-hist-item { padding: 7px 10px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-hist-item:hover { background: var(--bg-raised); }
.chat-hist-empty { padding: 10px; font-size: 12px; color: var(--text-muted); }
#chat-messages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 85%; padding: 7px 11px; border-radius: var(--radius-lg); font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.chat-user { align-self: flex-end; background: var(--accent-dim); color: #fff; }
.chat-assistant { align-self: flex-start; background: var(--bg-surface); border: 1px solid var(--border); }
#chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
#chat-input { flex: 1; background: var(--bg-input); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 10px; font-size: 14px; }
#chat-input:focus { outline: none; border-color: var(--border-focus); }
#chat-send { background: var(--accent-dim); color: #fff; border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; font-size: 14px; }

/* Route→map push confirm bar (Phase 2) — Archie proposes a route; one-tap Go. */
#map-intent-bar {
  position: absolute; z-index: 1300; left: 50%; transform: translateX(-50%);
  top: 110px; display: flex; align-items: center; gap: 10px;
  background: var(--bg-raised); border: 1px solid var(--accent);
  border-radius: var(--radius-pill); padding: 8px 14px; color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); font-size: 14px; max-width: calc(100vw - 24px);
}
#map-intent-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#map-intent-bar button {
  background: var(--bg-surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 12px; cursor: pointer; font-size: 13px;
}
#map-intent-go { background: var(--accent-dim) !important; border-color: var(--accent) !important; color: #fff !important; }

#map { position: absolute; inset: 0; z-index: 0; background: var(--bg); }

/* Leaflet zoom control sits below our top controls on small screens */
.leaflet-top.leaflet-left { margin-top: 150px; }

#maps-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(17, 17, 16, 0.92), rgba(17, 17, 16, 0));
  color: var(--text);
}
#maps-topbar a, #maps-topbar span { pointer-events: auto; }
#maps-back { color: var(--text); text-decoration: none; font-size: 20px; padding: 2px 8px; }
#maps-title { font-weight: 600; }
#maps-status { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sec); }

/* Traffic toggle (P3) — in the topbar; pointer-events restored over the gradient. */
#btn-traffic {
  pointer-events: auto; background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 3px 12px; font-size: 12px; cursor: pointer;
}
#btn-traffic.active { background: var(--accent-dim); border-color: var(--accent); color: #fff; }

/* Destination weather chip (P3) — inline in the route panel under the summary. */
#weather-chip {
  display: inline-block; margin: 0 0 8px; padding: 4px 10px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 13px; color: var(--text-sec);
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); display: inline-block; }
.dot.ok { background: var(--green); }
.dot.busy { background: var(--amber); }
.dot.err { background: var(--red); }

#maps-controls {
  position: absolute; top: 46px; left: 12px; right: 12px; z-index: 1000;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px; max-width: 520px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.maps-field { display: flex; gap: 6px; }
.maps-field input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 8px 10px; font-size: 14px;
}
.maps-field input:focus { outline: none; border-color: var(--border-focus); }

/* Next-maneuver banner (P2) — replaces the input controls while navigating. */
#nav-banner {
  position: absolute; top: 46px; left: 12px; right: 12px; z-index: 1000;
  background: var(--bg-raised); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 12px 14px; max-width: 520px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); color: var(--text);
}
#nav-distance { font-size: 30px; font-weight: 700; line-height: 1.05; color: var(--accent); }
#nav-distance:empty { display: none; }
#nav-instruction { font-size: 18px; margin-top: 4px; }
#nav-banner-actions { display: flex; gap: 6px; margin-top: 10px; }
#nav-banner-actions button {
  background: var(--bg-surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 14px; cursor: pointer; font-size: 14px;
}
#btn-mute { font-size: 16px; }
#btn-use-location, #btn-save-fav, #btn-del-fav {
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); cursor: pointer; padding: 0 12px; font-size: 16px;
}
#btn-save-fav { color: var(--amber); }
#fav-select {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 8px 10px; font-size: 14px;
}
.maps-actions { display: flex; gap: 6px; }
.maps-actions select, .maps-actions button {
  background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 14px; cursor: pointer;
}
.btn-primary { background: var(--accent-dim) !important; border-color: var(--accent) !important; color: #fff !important; }
#btn-route { flex: 1; }
#maps-error { color: var(--red); font-size: 13px; padding: 2px; }

#route-panel {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1000;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px; max-width: 520px;
  max-height: 42vh; overflow-y: auto; color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
#route-summary { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
#route-summary .sub { font-weight: 400; color: var(--text-sec); font-size: 13px; }
#route-panel-actions { display: flex; gap: 6px; margin-bottom: 6px; }
#route-panel button {
  background: var(--bg-surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px; cursor: pointer; font-size: 13px;
}
#route-panel button.active { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
#route-steps { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-sec); }
#route-steps li { margin: 4px 0; }

.hidden { display: none !important; }
