/* Nazareth 1897 overlay viewer — mobile-first, thumb-zone controls. */
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#map { position: absolute; inset: 0; background: #ddd; }

/* Persistent accuracy chip (§3.5) */
#accuracy-chip {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 1000; background: rgba(255,255,255,0.92); color: #333;
  border: 1px solid #999; border-radius: 14px; padding: 4px 12px;
  font-size: 12px; white-space: nowrap; pointer-events: auto; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* North indicator (§3.6) */
#north-indicator {
  position: absolute; top: 10px; right: 10px; z-index: 1000;
  background: rgba(255,255,255,0.92); color: #333; border: 1px solid #999;
  border-radius: 50%; width: 36px; height: 36px; line-height: 36px; text-align: center;
  font-size: 15px; font-weight: bold; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Off-coverage banner (§3.8) */
#off-coverage {
  position: absolute; top: 48px; left: 50%; transform: translateX(-50%);
  z-index: 1000; background: #fff3cd; color: #664d03; border: 1px solid #ffecb5;
  border-radius: 8px; padding: 8px 12px; font-size: 13px; text-align: center;
  max-width: 92vw; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Tile-failure notice (§3.9) — stacked below the off-coverage banner */
#tile-notice {
  position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
  z-index: 1001; background: #f8d7da; color: #842029; border: 1px solid #f5c2c7;
  border-radius: 8px; padding: 8px 12px; font-size: 13px; text-align: center;
  max-width: 92vw; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
#tile-notice button { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; }

/* Loading indicator */
#loading {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1000; background: rgba(255,255,255,0.92); border: 1px solid #999;
  border-radius: 8px; padding: 10px 18px; font-size: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Status toast */
#toast {
  position: absolute; top: 152px; left: 50%; transform: translateX(-50%);
  z-index: 1100; background: rgba(33,37,41,0.92); color: #fff;
  border-radius: 8px; padding: 10px 16px; font-size: 14px; text-align: center;
  max-width: 92vw; box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Bottom control bar — thumb zone (§3.10). Tap targets >= 44px. */
#control-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(255,255,255,0.94); border-top: 1px solid #bbb;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 6px rgba(0,0,0,0.2);
}
#overlay-row, #action-row {
  display: flex; align-items: center; gap: 6px; justify-content: center;
}
#overlay-row { margin-bottom: 8px; }
.ctl-btn {
  min-height: 44px; min-width: 44px; padding: 0 12px; font-size: 15px;
  border: 1px solid #888; border-radius: 8px; background: #fff; color: #222;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ctl-btn:active { background: #e9e9e9; }
.ctl-btn.toggle-on { background: #d9ead3; border-color: #5a8a4d; }
.ctl-btn.toggle-off { background: #f2f2f2; color: #777; }
.ctl-btn.active { background: #cfe2ff; border-color: #3a6ea5; }
#overlay-toggle { font-weight: bold; }
#opacity-slider { flex: 1 1 120px; min-width: 80px; height: 44px; accent-color: #3a6ea5; }
#opacity-value { min-width: 42px; text-align: center; font-size: 14px; }
.preset { padding: 0 10px; }
#info-btn { font-weight: bold; font-size: 18px; }
#find-me, #follow-toggle, #base-toggle, #pins-btn { flex: 1 1 auto; }

/* Leaflet control offsets so nothing hides under the control bar (~120px tall) */
.leaflet-control-scale { margin-bottom: 132px !important; }
.leaflet-control-attribution { margin-bottom: 128px !important; font-size: 10px !important; }
.leaflet-control-zoom { margin-top: 48px !important; }

/* Bottom sheets (info + pins panels) */
#info-panel, #pins-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1200;
  max-height: 72dvh; background: #fff; border-top: 2px solid #888;
  border-radius: 14px 14px 0 0; box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
}
#info-panel[hidden], #pins-panel[hidden] { display: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid #ddd; flex: none;
}
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body { overflow-y: auto; padding: 6px 16px 20px; font-size: 14px; line-height: 1.5; }
.sheet-body h3 { margin: 16px 0 6px; font-size: 15px; }
.sheet-body p { margin: 6px 0; }
.sheet-body ul { margin: 6px 0; padding-left: 20px; }
.muted { color: #666; font-size: 13px; }

/* Sanborn KEY swatches (§3.5) */
.key-grid {
  display: grid; grid-template-columns: 22px 1fr; gap: 6px 8px;
  align-items: center; margin: 8px 0;
}
.swatch { display: inline-block; width: 20px; height: 14px; border: 1px solid #666; border-radius: 2px; }

/* Pins list */
#pins-list { list-style: none; margin: 8px 0; padding: 0; }
#pins-list li {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
}
#pins-list .pin-note { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#pins-list .pin-coords { font-size: 12px; color: #666; }
.pin-mini-btn { min-height: 36px; min-width: 36px; padding: 0 8px; font-size: 13px;
  border: 1px solid #888; border-radius: 6px; background: #fff; cursor: pointer; }

/* Tap popup: pin-drop form */
.pin-form { margin-top: 8px; }
.pin-form input[type="text"] {
  width: 100%; box-sizing: border-box; font-size: 14px; padding: 8px;
  border: 1px solid #888; border-radius: 6px; margin-bottom: 8px;
}
.pin-form button {
  min-height: 40px; padding: 0 14px; font-size: 14px;
  border: 1px solid #888; border-radius: 6px; background: #d9ead3; cursor: pointer;
}
.leaflet-popup-content { font-size: 14px; line-height: 1.45; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 15px; }

/* Candidate marker pin (gold star) */
.marker-star {
  background: #ffc107; border: 2px solid #7a5b00; color: #332600;
  border-radius: 50%; width: 30px; height: 30px; line-height: 26px; text-align: center;
  font-size: 18px; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Desktop: constrain the sheets, keep the bar centered */
@media (min-width: 700px) {
  #control-bar { left: 50%; right: auto; transform: translateX(-50%);
    width: 640px; border: 1px solid #bbb; border-bottom: none; border-radius: 12px 12px 0 0; }
  #info-panel, #pins-panel { left: 50%; right: auto; transform: translateX(-50%); width: 640px; }
}
