/* ================================================
   City autocomplete, GPS and OpenStreetMap picker
   Shared by register, web app, Telegram Mini App and desktop runtime.
   ================================================ */

.place-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The city field lives in a flex row with the map/GPS buttons. The list and
   its history header must take their own line instead of becoming flex
   siblings that stretch the input. `order` keeps the buttons beside the input
   even though the picker inserts the list immediately after it. */
.field-with-action { flex-wrap: wrap; }

.field-with-action > .place-history-head,
.field-with-action > .place-suggestions {
  flex: 0 0 100%;
  width: 100%;
  order: 10;
}

.place-suggestions {
  position: relative;
  z-index: 40;
  margin-top: 6px;
  padding: 4px;
  max-height: 268px;
  overflow-y: auto;
  border: 1px solid var(--app-border, rgba(127, 127, 127, .3));
  border-radius: 12px;
  background: var(--app-surface, #fff);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}

.place-suggestions[hidden] { display: none; }

.place-search-status {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--app-muted, #6b7280);
}

.place-search-status[hidden] { display: none; }

.place-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding: 2px 4px 0;
  font-size: 12px;
  color: var(--app-muted, #6b7280);
}

.place-history-head[hidden] { display: none; }

.place-history-head__label { font-weight: 600; }

.place-history-clear {
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--app-link, #2563eb);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.place-history-clear:hover { background: var(--app-surface-2, rgba(127, 127, 127, .12)); }

.place-history-clear:focus-visible {
  outline: 2px solid var(--app-link, #2563eb);
  outline-offset: 2px;
}

.place-suggestion {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.place-suggestion:hover,
.place-suggestion.is-active {
  background: var(--app-surface-2, rgba(127, 127, 127, .12));
}

.place-suggestion__title {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.place-suggestion__detail {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--app-muted, #6b7280);
  line-height: 1.3;
}

.place-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.place-controls .btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.place-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 15, 24, .62);
}

.place-map {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 18px;
  background: var(--app-surface, #fff);
  color: var(--app-text, #111827);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

.place-map__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--app-border, rgba(127, 127, 127, .25));
}

.place-map__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--app-surface-2, rgba(127, 127, 127, .12));
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.place-map__canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  height: min(52dvh, 420px);
  overflow: hidden;
  background: #dfe8ef;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.place-map__canvas:active { cursor: grabbing; }

.place-map__tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.place-map__marker {
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #d64545;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  pointer-events: none;
}

.place-map__zoom {
  position: absolute;
  top: 64px;
  right: 22px;
  z-index: 4;
  display: grid;
  gap: 6px;
}

.place-map__zoom button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--app-border, rgba(127, 127, 127, .3));
  border-radius: 9px;
  background: var(--app-surface, #fff);
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.place-map__status {
  min-height: 42px;
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
}

.place-map__result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.place-map__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 8px;
}

.place-map__attribution {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 11px;
  color: var(--app-muted, #6b7280);
}

.place-map__attribution a { color: inherit; }

@media (max-width: 720px) {
  /* The Mini App gate uses the shared picker outside the register page, so
     these touch sizes must live with the component, not in register.css. */
  .place-suggestion { min-height: 48px; padding: 12px; font-size: 15px; }
  .place-suggestion__title { font-size: 15px; }
  .place-suggestion__detail { font-size: 13px; }
}

@media (max-width: 520px) {
  .place-map-overlay { padding: 0; align-items: stretch; }
  .place-map { width: 100%; max-height: 100dvh; border-radius: 0; }
  .place-map__canvas { height: 48dvh; }
  .place-history-clear { min-height: 44px; }
}

/* GEO-041: the same picker on a 50-inch / TV browser. Only row and map sizes
   grow so a remote keyboard/pointer can target them from reading distance;
   data, country filters and canonical city ids are untouched. */
@media (min-width: 1600px) {
  .place-suggestions { max-height: 420px; }

  .place-suggestion {
    min-height: 52px;
    padding: 12px 14px;
  }

  .place-suggestion__title { font-size: 16px; }
  .place-suggestion__detail { margin-top: 3px; font-size: 14px; }
  .place-search-status,
  .place-history-head { font-size: 14px; }

  .place-history-clear {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .place-map { width: min(980px, 100%); }
  .place-map__canvas { height: min(58dvh, 560px); }
  .place-map__close { width: 44px; height: 44px; }
  .place-map__status,
  .place-map__actions .btn { font-size: 16px; }
  .place-map__attribution { font-size: 13px; }
  .place-map__zoom button { width: 44px; height: 44px; }
}

@media (min-width: 2400px) {
  .place-suggestions { max-height: 520px; }

  .place-suggestion {
    min-height: 60px;
    padding: 14px 16px;
  }

  .place-suggestion__title { font-size: 18px; }
  .place-suggestion__detail { font-size: 15px; }
  .place-search-status,
  .place-history-head,
  .place-history-clear { font-size: 15px; }

  .place-map { width: min(1180px, 100%); }
  .place-map__canvas { height: min(60dvh, 620px); }
  .place-map__status,
  .place-map__actions .btn { font-size: 18px; }
  .place-map__attribution { font-size: 14px; }
}

@media (min-width: 3200px) {
  .place-suggestions { max-height: 640px; }

  .place-suggestion {
    min-height: 68px;
    padding: 16px 18px;
  }

  .place-suggestion__title { font-size: 22px; }
  .place-suggestion__detail { font-size: 17px; }
  .place-search-status,
  .place-history-head,
  .place-history-clear { font-size: 17px; }

  .place-map { width: min(1400px, 100%); }
  .place-map__canvas { height: min(64dvh, 720px); }
  .place-map__status,
  .place-map__actions .btn { font-size: 20px; }
  .place-map__attribution { font-size: 16px; }
}
