/* Shared waypoints panel, styled to sit next to BlueMap's own dark UI. */
:root {
  --wp-bg: rgba(24, 26, 30, 0.94);
  --wp-bg-2: #2a2d33;
  --wp-line: #3b3f46;
  --wp-text: #e9eaec;
  --wp-muted: #9aa0a8;
  --wp-accent: #4caf50;
  --wp-accent-2: #3d8f41;
  --wp-danger: #e05252;
}

.wp-toggle {
  position: fixed; top: 48px; right: 8px; z-index: 1001; /* just below BlueMap's control bar */
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--wp-line); border-radius: 6px;
  background: var(--wp-bg); color: var(--wp-text);
  font: 600 14px/1.2 system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.wp-toggle:hover, .wp-toggle.wp-active { border-color: var(--wp-accent); }
.wp-toggle-pin {
  width: 10px; height: 10px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--wp-accent);
}

.wp-panel {
  position: fixed; top: 90px; right: 8px; bottom: 12px; z-index: 1000;
  width: 340px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column;
  background: var(--wp-bg); color: var(--wp-text);
  border: 1px solid var(--wp-line); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font: 14px/1.4 system-ui, sans-serif;
  transform: translateX(calc(100% + 24px)); transition: transform 0.2s ease;
  backdrop-filter: blur(6px);
}
.wp-panel.wp-open { transform: none; }

.wp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.wp-close { background: none; border: 0; color: var(--wp-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.wp-close:hover { color: var(--wp-text); }

.wp-tabs { display: flex; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--wp-line); }
.wp-tab {
  flex: 1; padding: 8px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--wp-muted); font: inherit; font-weight: 600; cursor: pointer;
}
.wp-tab:last-child { flex: 0 0 40px; }
.wp-tab-on { color: var(--wp-text); border-bottom-color: var(--wp-accent); }

.wp-view { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.wp-view[hidden] { display: none; }

.wp-row { display: flex; gap: 6px; align-items: center; }
.wp-row > * { flex: 1; min-width: 0; }
.wp-label { display: flex; flex-direction: column; gap: 4px; color: var(--wp-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.wp-check { display: flex; gap: 6px; align-items: center; color: var(--wp-muted); font-size: 13px; white-space: nowrap; flex: 0 0 auto; }
.wp-h { margin: 4px 0 0; font-size: 15px; }
.wp-hint { margin: 0; color: var(--wp-muted); font-size: 12px; }

.wp-input {
  width: 100%; box-sizing: border-box; padding: 7px 9px;
  background: var(--wp-bg-2); color: var(--wp-text);
  border: 1px solid var(--wp-line); border-radius: 5px;
  font: 14px/1.3 system-ui, sans-serif; text-transform: none; letter-spacing: 0;
}
.wp-input:focus { outline: none; border-color: var(--wp-accent); }
textarea.wp-input { resize: vertical; }
.wp-num { text-align: center; }

.wp-btn {
  padding: 5px 10px; background: var(--wp-bg-2); color: var(--wp-text);
  border: 1px solid var(--wp-line); border-radius: 5px;
  font: 600 12px/1.3 system-ui, sans-serif; cursor: pointer; white-space: nowrap;
}
.wp-btn:hover { border-color: var(--wp-muted); }
.wp-btn:disabled { opacity: 0.5; cursor: wait; }
.wp-primary { background: var(--wp-accent-2); border-color: var(--wp-accent); }
.wp-primary:hover { background: var(--wp-accent); }
.wp-danger:hover { border-color: var(--wp-danger); color: var(--wp-danger); }
.wp-wide { width: 100%; padding: 9px; font-size: 14px; }

.wp-list { display: flex; flex-direction: column; gap: 8px; }
.wp-empty { color: var(--wp-muted); text-align: center; padding: 24px 0; margin: 0; }
.wp-item { display: flex; gap: 10px; padding: 10px; background: var(--wp-bg-2); border: 1px solid var(--wp-line); border-radius: 6px; }
.wp-icon { width: 24px; height: 24px; flex: 0 0 24px; }
.wp-item-body { flex: 1; min-width: 0; }
.wp-item-name { font-weight: 700; overflow-wrap: anywhere; }
.wp-item-meta { color: var(--wp-muted); font-size: 12px; }
.wp-item-desc { margin: 4px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wp-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.wp-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 2000;
  transform: translate(-50%, 20px); opacity: 0; transition: all 0.25s ease;
  padding: 10px 16px; border-radius: 6px; background: var(--wp-accent-2); color: #fff;
  font: 600 14px/1.3 system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.wp-toast.wp-bad { background: var(--wp-danger); }
.wp-toast.wp-show { transform: translate(-50%, 0); opacity: 1; }

body.wp-picking canvas { cursor: crosshair !important; }

/* Marker popup content (rendered by BlueMap from the marker "detail" HTML). */
.wp-detail { min-width: 160px; font: 13px/1.4 system-ui, sans-serif; }
.wp-detail-title { font-weight: 700; font-size: 14px; }
.wp-detail-meta, .wp-detail-author { opacity: 0.7; font-size: 12px; }
.wp-detail-desc { margin: 4px 0; white-space: pre-wrap; }

@media (max-width: 600px) {
  .wp-toggle { top: auto; bottom: 12px; left: 12px; right: auto; } /* zoom buttons are bottom-right */
  .wp-panel { top: auto; left: 12px; right: 12px; bottom: 60px; width: auto; height: 65vh; transform: translateY(calc(100% + 80px)); }
}

/* Free-flight speed indicator (spectator.js) */
.wp-speed-hud {
  position: fixed; left: 50%; top: 60%; z-index: 2000; transform: translateX(-50%);
  padding: 6px 12px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); color: #fff;
  font: 600 14px/1.2 system-ui, sans-serif; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
.wp-speed-hud.wp-show { opacity: 1; }

/* ---- Tools, badges, photos, picking ---- */
.wp-tab:last-child { flex: 0 0 40px; }
.wp-badge {
  min-width: 18px; padding: 1px 5px; border-radius: 9px; background: #e05252; color: #fff;
  font-size: 11px; line-height: 16px; text-align: center;
}
.wp-badge[hidden] { display: none; }
.wp-new { margin-left: 6px; padding: 0 5px; border-radius: 3px; background: #e05252; color: #fff; font-size: 10px; vertical-align: 2px; }
.wp-tag { margin-left: 6px; padding: 0 5px; border-radius: 3px; border: 1px solid var(--wp-line); color: var(--wp-muted); font-size: 10px; font-weight: 600; vertical-align: 2px; }
.wp-new-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 5px; background: rgba(224, 82, 82, 0.15); font-size: 13px; }
.wp-new-info[hidden] { display: none; }
.wp-highlight { border-color: var(--wp-accent); box-shadow: 0 0 0 1px var(--wp-accent); }
.wp-thumb { display: block; width: 100%; max-height: 140px; object-fit: cover; margin: 6px 0; border-radius: 4px; cursor: zoom-in; }
.wp-detail-photo { display: block; width: 240px; max-width: 100%; margin-bottom: 6px; border-radius: 4px; }

.wp-sep { width: 100%; border: 0; border-top: 1px solid var(--wp-line); margin: 6px 0; }
.wp-nogrow { flex: 0 0 auto !important; }
.wp-small { padding: 3px 6px; font-size: 12px; margin-top: 4px; }
.wp-result { display: flex; flex-direction: column; gap: 6px; }
.wp-result-big { font-size: 18px; font-weight: 700; }
.wp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wp-table td { padding: 3px 0; border-bottom: 1px solid var(--wp-line); }
.wp-table td:last-child { text-align: right; color: var(--wp-muted); }
.wp-xaero-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px; background: var(--wp-bg-2); border: 1px solid var(--wp-line); border-radius: 6px; cursor: pointer; }
.wp-panel code { background: var(--wp-bg-2); padding: 0 4px; border-radius: 3px; font-size: 11px; }

.wp-pick-banner {
  position: fixed; left: 50%; top: 52px; transform: translateX(-50%); z-index: 1500;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 6px;
  background: rgba(24, 26, 30, 0.95); color: #fff; border: 1px solid #f2c94c;
  font: 600 14px/1.3 system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.wp-pick-banner[hidden] { display: none; }

/* "The map was updated" banner (MapSync auto re-render) */
.wp-update-banner {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1500;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 6px;
  background: rgba(24, 26, 30, 0.95); color: #fff; border: 1px solid var(--wp-accent);
  font: 600 14px/1.3 system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px);
}
.wp-update-banner[hidden] { display: none; }

/* Map update progress (render-progress.json via /api/render-status) */
.wp-progress {
  position: fixed; left: 12px; bottom: 12px; z-index: 1400; width: 280px; max-width: calc(100vw - 80px);
  padding: 10px 12px; border-radius: 6px; background: rgba(24, 26, 30, 0.92); color: #fff;
  border: 1px solid var(--wp-line); font: 13px/1.35 system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.wp-progress[hidden] { display: none; }
.wp-progress-title { font-weight: 700; margin-bottom: 2px; }
.wp-progress-text { color: var(--wp-muted); }
.wp-progress-track { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--wp-bg-2); overflow: hidden; }
.wp-progress-fill { height: 100%; border-radius: 3px; background: var(--wp-accent); transition: width 0.6s ease; }
.wp-progress-busy .wp-progress-fill {
  background: repeating-linear-gradient(90deg, var(--wp-accent-2) 0 12px, var(--wp-accent) 12px 24px);
  background-size: 48px 100%; animation: wp-busy 1s linear infinite;
}
@keyframes wp-busy { to { background-position: 48px 0; } }
@media (max-width: 600px) { .wp-progress { bottom: 60px; } }
