/* gps_map_panel.css — Robot GPS Live Map (Issue #709 companion) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0:       #050510;
  --bg1:       #070712;
  --bg2:       #0a0a1a;
  --border:    #0c2a3a;
  --border2:   #1e3a5f;
  --text-dim:  #374151;
  --text-mid:  #6b7280;
  --text-base: #9ca3af;
  --cyan:      #06b6d4;
  --cyan-dim:  #0e4f69;
  --green:     #22c55e;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --orange:    #f97316;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  background: var(--bg0);
  color: var(--text-base);
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
#header {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.logo { color: var(--orange); font-weight: bold; letter-spacing: .15em; font-size: 13px; }
.logo a { color: inherit; text-decoration: none; }
.logo a:hover { text-decoration: underline; }

#conn-bar { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 240px; }
#conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim); flex-shrink: 0; transition: background .3s;
}
#conn-dot.connected { background: var(--green); }
#conn-dot.error     { background: var(--red); animation: blink 1s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

#ws-input {
  flex: 1; min-width: 160px; max-width: 240px;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 4px;
  color: #67e8f9; padding: 2px 8px; font-family: monospace; font-size: 11px;
}
#ws-input:focus { outline: none; border-color: var(--cyan); }

.hdr-btn {
  padding: 3px 10px; border-radius: 4px; border: 1px solid var(--border2);
  background: var(--bg2); color: #67e8f9; font-family: monospace;
  font-size: 10px; font-weight: bold; cursor: pointer;
}
.hdr-btn:hover { background: var(--cyan-dim); }
#conn-label { font-size: 10px; color: var(--text-dim); }

/* ── Status bar ── */
#status-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 4px 14px; background: var(--bg1);
  border-bottom: 1px solid var(--border); font-size: 10px;
}
.sys-badge {
  padding: 2px 8px; border-radius: 3px; font-weight: bold;
  border: 1px solid; letter-spacing: .05em;
}
.badge-ok    { background: #052e16; border-color: #166534; color: #4ade80; }
.badge-warn  { background: #451a03; border-color: #92400e; color: #fcd34d; }
.badge-error { background: #450a0a; border-color: #991b1b; color: #f87171; animation: blink 1s infinite; }
.badge-stale { background: #111827; border-color: #374151; color: #6b7280; }
#last-update { color: var(--text-mid); margin-left: auto; }

/* ── Main layout ── */
#main {
  flex: 1; display: flex; min-height: 0;
}

/* ── Map ── */
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map      { width: 100%; height: 100%; }

/* dark tile filter */
.leaflet-tile { filter: brightness(.8) invert(1) hue-rotate(200deg) saturate(.65); }
.leaflet-container { background: #090915; }

/* ── Map controls ── */
#map-controls {
  position: absolute; top: 10px; right: 10px; z-index: 1000;
  display: flex; flex-direction: column; gap: 4px;
}
.map-btn {
  padding: 4px 9px; border-radius: 4px; border: 1px solid var(--border);
  background: rgba(7,7,18,.88); color: var(--cyan);
  font-family: monospace; font-size: 10px; font-weight: bold;
  cursor: pointer; backdrop-filter: blur(4px);
}
.map-btn:hover { background: rgba(14,79,105,.88); }
.map-btn.active { background: rgba(6,182,212,.22); border-color: var(--cyan); }

/* ── Sidebar ── */
#sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--bg1); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}

.stat-section { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.section-title {
  font-size: 8px; font-weight: bold; letter-spacing: .15em;
  color: #0891b2; text-transform: uppercase; margin-bottom: 8px;
}

.big-stat { display: flex; flex-direction: column; align-items: center; padding: 4px 0; }
.big-val  { font-size: 36px; font-weight: bold; font-family: monospace; line-height: 1; }
.big-unit { font-size: 11px; color: var(--text-mid); margin-top: 2px; }
.big-lbl  { font-size: 8px; color: var(--text-dim); margin-top: 4px; letter-spacing: .1em; }

.kv-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.kv-cell  { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; padding: 5px 7px; }
.kv-lbl   { font-size: 8px; color: var(--text-dim); margin-bottom: 2px; }
.kv-val   { font-size: 13px; font-weight: bold; font-family: monospace; }

.coord-row { font-size: 10px; color: var(--text-mid); margin-bottom: 2px; }
.coord-val { color: var(--cyan); font-family: monospace; }

/* accuracy bar */
.acc-wrap { height: 4px; background: var(--bg2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.acc-bar  { height: 100%; border-radius: 2px; transition: width .4s, background .4s; }

/* compass */
#compass-wrap { display: flex; justify-content: center; padding: 6px 0; }

/* trail log */
#trail-log {
  flex: 1; overflow-y: auto; padding: 6px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.trail-entry { font-size: 9px; color: var(--text-dim); border-bottom: 1px solid #0b1a28; padding-bottom: 3px; }
.te-coord { color: var(--cyan); }
.te-spd   { color: var(--orange); }

/* bottom bar */
#bottombar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 14px; background: var(--bg1);
  border-top: 1px solid var(--border); font-size: 10px;
  flex-shrink: 0;
}
.bb-lbl { color: var(--text-dim); }
#last-msg { margin-left: auto; color: var(--text-dim); }

@media (max-width: 600px) { #sidebar { display: none; } }
