/* Overpass map search (overpass-search.js). Colours and sizes are variables,
   so a page can fit them to its own design. MapLibre needs its own CSS too. */
.ovs {
  --ovs-accent: #0b6bcb;
  --ovs-text: #0f172a;
  --ovs-muted: #64748b;
  --ovs-bg: #ffffff;
  --ovs-soft: #f1f5f9;
  --ovs-border: #d7dee8;
  --ovs-bad: #b42318;
  --ovs-radius: 12px;
  --ovs-height: 560px;
  color: var(--ovs-text);
  font: inherit;
}
.ovs *, .ovs *::before, .ovs *::after { box-sizing: border-box; }

.ovs-mapwrap { position: relative; height: var(--ovs-height); border: 1px solid var(--ovs-border); border-radius: var(--ovs-radius); overflow: hidden; background: var(--ovs-soft); }
.ovs-map { position: absolute; inset: 0; }

/* the search box, on the map */
.ovs-form { position: absolute; z-index: 3; top: 12px; left: 12px; width: min(460px, calc(100% - 24px)); display: flex; background: var(--ovs-bg);
  border: 1px solid var(--ovs-border); border-radius: 10px; box-shadow: 0 2px 10px rgb(0 0 0 / 14%); }
.ovs-combo { position: relative; flex: 1; min-width: 0; }
/* .ovs .ovs-input: stronger than the input rules of a page */
.ovs .ovs-input { position: relative; display: block; width: 100%; height: 46px; margin: 0; border: 0; background: transparent; color: var(--ovs-text); font: inherit; font-size: 1rem; line-height: 46px;
  padding: 0 14px; border-radius: 10px 0 0 10px; box-shadow: none; }
/* the completion in grey, behind the text of the box; the script copies the font and padding of the box */
.ovs-ghost { position: absolute; inset: 0; padding: 0 14px; font: inherit; font-size: 1rem; line-height: 46px; white-space: pre; overflow: hidden; pointer-events: none; color: var(--ovs-muted); opacity: .75; }
.ovs-ghost-typed { color: transparent; }
.ovs .ovs-input:focus { outline: 2px solid var(--ovs-accent); outline-offset: -2px; border: 0; }
.ovs-input::-webkit-search-cancel-button { cursor: pointer; }
.ovs-go { flex: none; width: 48px; border: 0; border-left: 1px solid var(--ovs-border); background: transparent; color: var(--ovs-accent); cursor: pointer; border-radius: 0 10px 10px 0; display: grid; place-items: center; }
.ovs-go:hover { background: var(--ovs-soft); }

/* the suggestions */
.ovs-list { position: absolute; top: calc(100% + 6px); left: -1px; width: calc(100% + 50px); max-height: min(380px, calc(var(--ovs-height) - 90px)); overflow-y: auto;
  margin: 0; padding: 6px 0; list-style: none; background: var(--ovs-bg); border: 1px solid var(--ovs-border); border-radius: 10px; box-shadow: 0 6px 20px rgb(0 0 0 / 18%); }
.ovs-group { padding: 6px 14px 2px; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ovs-muted); }
.ovs-opt { display: flex; flex-direction: column; gap: 1px; padding: 7px 14px 7px 36px; cursor: pointer; position: relative; }
.ovs-opt::before { content: ""; position: absolute; left: 14px; top: 11px; width: 12px; height: 12px; border-radius: 50%; background: var(--ovs-accent); opacity: .85; }
.ovs-opt.ovs-place::before { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #d0312d; }
.ovs-opt[aria-selected="true"], .ovs-opt:hover { background: var(--ovs-soft); }
.ovs-opt-label { font-weight: 500; }
.ovs-opt-detail { font-size: .82rem; color: var(--ovs-muted); }

.ovs-status { position: absolute; z-index: 2; top: 70px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 6px 14px; border-radius: 999px;
  background: var(--ovs-bg); color: var(--ovs-text); font-size: .9rem; box-shadow: 0 2px 8px rgb(0 0 0 / 16%); }
.ovs-status.ovs-bad { border-radius: 10px; color: var(--ovs-bad); }

/* popups */
.ovs-popup { font-size: .88rem; line-height: 1.4; color: #0f172a; }
.ovs-popup strong { display: block; font-size: .95rem; padding-right: 14px; }
.ovs-popup-type { color: #64748b; font-size: .8rem; }
.ovs-popup dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 6px 0; font-size: .8rem; }
.ovs-popup dt { color: #64748b; }
.ovs-popup dd { margin: 0; overflow-wrap: anywhere; }
.ovs-popup a { color: #0b6bcb; }

/* the result */
.ovs-panel { margin-top: 14px; }
.ovs-title { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.ovs-sub { margin: 4px 0 0; color: var(--ovs-muted); font-size: .9rem; overflow-wrap: anywhere; }
.ovs-chips { margin-top: 10px; }
.ovs-chiprow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.ovs-chipname { font-size: .85rem; color: var(--ovs-muted); margin-right: 2px; }
.ovs-chip { border: 1px solid var(--ovs-border); background: var(--ovs-bg); color: var(--ovs-text); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: .85rem; cursor: pointer; }
.ovs-chip:hover { border-color: var(--ovs-accent); color: var(--ovs-accent); }
.ovs-count { margin: 12px 0 6px; font-size: .9rem; color: var(--ovs-muted); }
.ovs-count:empty { display: none; }
.ovs-results { list-style: none; margin: 0; padding: 4px; max-height: 232px; overflow-y: auto; border: 1px solid var(--ovs-border); border-radius: 10px; background: var(--ovs-bg); }
.ovs-results:empty { display: none; }
.ovs-item { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; color: var(--ovs-text); font: inherit; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.ovs-item:hover { background: var(--ovs-soft); }
.ovs-item-name { font-weight: 500; }
.ovs-item-type { font-size: .78rem; color: var(--ovs-muted); overflow-wrap: anywhere; }
.ovs-more { padding: 4px 6px; font-size: .85rem; color: var(--ovs-muted); }
.ovs-query { margin-top: 10px; border: 1px solid var(--ovs-border); border-radius: 10px; padding: 8px 12px; background: var(--ovs-bg); }
.ovs-query summary { cursor: pointer; font-weight: 500; }
.ovs-qtext { display: block; box-sizing: border-box; width: 100%; margin: 8px 0; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; resize: vertical;
  background: var(--ovs-soft); color: var(--ovs-text); font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow: auto; }
.ovs-qtext:not([readonly]):focus { outline: none; border-color: var(--ovs-accent); }
.ovs-qactions { display: flex; align-items: center; gap: 8px; }
.ovs-run { border: 1px solid var(--ovs-accent); background: var(--ovs-accent); color: #fff; border-radius: 8px; padding: 4px 14px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.ovs-run:disabled { opacity: .6; cursor: progress; }
.ovs-copy { border: 1px solid var(--ovs-border); background: var(--ovs-bg); color: var(--ovs-text); border-radius: 8px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }

@media (max-width: 640px) {
  .ovs { --ovs-height: 460px; }
  .ovs-form { top: 8px; left: 8px; width: calc(100% - 16px); }
  .ovs-list { width: calc(100% + 50px); }
  .ovs-status { top: 62px; }
}
