/* The road picker's panel and selection list. Loaded by the three pages that pick
   road segments (permits apply, dig-once create, TTM create), which have three
   different shells between them — so this file leans only on the brand tokens all
   three define (--navy, --blue, --blue-light, --surface, --border, --muted,
   --danger, --success, --warning) and sets its own everything else. */

/* The map needs a positioning context for the panel to sit inside. Both the
   full-bleed map (permits) and the boxed one (dig-once, TTM) get one. */
.map-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.map-wrap > #map { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ the panel */
.rp-panel {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  width: 252px; max-width: calc(100% - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 20px var(--shadow-navy);
  font-size: 12.5px; color: var(--navy);
  overflow: hidden;
}
.rp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; background: var(--navy); color: #fff;
}
.rp-head b { font-size: 12.5px; font-weight: 700; flex: 1; }
.rp-head .rp-toggle {
  background: none; border: 1px solid rgba(255, 255, 255, 0.35); color: #fff;
  border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; cursor: pointer;
  line-height: 1.5;
}
.rp-head .rp-toggle:hover { background: rgba(255, 255, 255, 0.15); }
/* One button, two labels: which one shows follows the panel's state rather than
   being written by script, so the label cannot drift out of step with the panel. */
.rp-panel[data-open="no"] .rp-toggle .on,
.rp-panel:not([data-open="no"]) .rp-toggle .off { display: none; }
.rp-body { padding: 0 10px 10px; }
.rp-panel[data-open="no"] .rp-body { display: none; }
.rp-panel[data-open="no"] .rp-tools { margin-bottom: 10px; }

/* Numbered, because it is a sequence and not a list of tips. */
.rp-steps { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: rp; }
.rp-steps li {
  position: relative; padding: 0 0 0 22px; margin-bottom: 5px; line-height: 1.45;
  counter-increment: rp;
}
.rp-steps li::before {
  content: counter(rp);
  position: absolute; left: 0; top: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue-light); color: var(--blue);
  font-size: 10px; font-weight: 800; text-align: center; line-height: 16px;
}
.rp-steps b { font-weight: 700; }

/* The running answer to "did that click do anything". Never collapses to nothing:
   an empty status line would read as a page that had stopped responding. */
.rp-state {
  margin: 10px 10px 0; padding: 7px 8px; border-radius: 7px; line-height: 1.4;
  background: var(--blue-light); color: var(--navy);
  border-left: 3px solid var(--blue);
}
.rp-state[data-tone="good"] { background: #E7F6EF; border-left-color: var(--success); }
.rp-state[data-tone="bad"] { background: #FDE8E8; border-left-color: var(--danger); }
.rp-state[data-tone="info"] { background: #FEF3E2; border-left-color: var(--warning); }

.rp-tools { display: flex; gap: 5px; margin: 8px 10px 0; }
.rp-tools button {
  flex: 1; padding: 5px 4px; font-size: 11.5px; font-weight: 700; line-height: 1.4;
  background: var(--surface); color: var(--navy);
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.rp-tools button:hover:not(:disabled) { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
.rp-tools button:disabled { opacity: 0.45; cursor: default; }

.rp-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* The pick number, on the road it belongs to. A DOM marker, not a map label: the
   basemaps here are raster and carry no glyphs, so MapLibre refuses text layers. */
.rp-chip {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue); color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(2, 2, 58, 0.35);
  font: 800 11px/17px var(--font-sans, "Segoe UI", -apple-system, Roboto, Arial, sans-serif);
  text-align: center; pointer-events: none;
}

/* ------------------------------------------------------- the selection, in words */
.rp-summary {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--navy); margin: 0 0 4px;
}
.rp-summary span { font-weight: 400; color: var(--muted); }

/* Empty, the list is a placeholder, not a field waiting to be typed in: the boxed
   style it inherits reads as an input until there is something in it. */
.sel-list.rp-empty { color: var(--muted); background: none; border-style: dashed; }
.sel-item.rp-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.sel-item.rp-row + .sel-item.rp-row { border-top: 1px solid var(--border); }
.rp-row .rp-n {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: 10.5px; font-weight: 800; text-align: center; line-height: 18px;
}
.rp-row .rp-name { flex: 1; min-width: 0; line-height: 1.35; }
.rp-row .rp-name small { display: block; color: var(--muted); font-size: 11px; }
.rp-row .rm {
  flex: none; background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--danger); font-size: 15px; font-weight: 800; line-height: 1;
  padding: 2px 7px; cursor: pointer;
}
.rp-row .rm:hover { background: #FDE8E8; border-color: var(--danger); }

@media (max-width: 1024px) and (min-width: 861px) {
  .rp-panel { width: 200px; font-size: 12px; }
}

/* ----------------------------------------------------------------------------
   Narrow screens — matches the 860px breakpoint in style.css, where the map
   shell turns from a row into a column.

   These rules live in THIS file rather than with the rest of the shell's mobile
   layout because base.html loads style.css first and road-picker.css second: the
   `position:absolute` and `display:flex` above would outrank an identical
   selector written over there, and did.

   The panel stops floating. Over a map only 240–420px tall it covered most of
   what it was asking the reader to tap; flowing underneath, its numbered steps
   and its running "three roads picked" line sit exactly where the eye lands
   after a tap on the map.
   ---------------------------------------------------------------------------- */
@media (max-width: 860px) {
  /* Block, not flex: the panel is a DOM child of this wrapper, and once it stops
     floating it has to flow after the map rather than share a height with it. */
  .map-wrap { order: 1; flex: none; display: block; width: 100%; height: auto; }
  .map-wrap > #map { flex: none; }

  .rp-panel {
    position: static; width: auto; max-width: none;
    margin: 0; border-radius: 0; box-shadow: none;
    border-left: none; border-right: none;
    font-size: 13px;
  }
  /* Wider tap targets once there is a whole screen's width to spend on them. */
  .rp-tools button { padding: 9px 6px; font-size: 12.5px; }
  .rp-row .rm { padding: 6px 11px; }
}
