/* hub-pin-map.css — the HUB map shell (HubPinMap, assets/js/hub-pin-map.js):
 the same look as the GPX Manager / Locations / GPX maps (Options, Fit, Full
 screen, legend, hover card, popup, picker, resize grip). Every rule is
 scoped to .hpm, the element HubPinMap.mount() fills. */
.hpm {
  --lm-bg: #14171d; --lm-card: #1a1d23; --lm-raise: #22262e; --lm-line: #374151;
  --lm-text: #e5e7eb; --lm-muted: #9ca3af; --lm-accent: #667eea;
}
.hpm .lmap-shell { position: relative; height: 480px; background: var(--lm-bg); border: 1px solid var(--lm-line); border-radius: 12px 12px 0 0; overflow: hidden; container-type: inline-size; }
.hpm .hpm-map { position: absolute; inset: 0; }
.hpm .hpm-map .maplibregl-ctrl-group { background: var(--lm-card); border: 1px solid var(--lm-line); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.hpm .hpm-map .maplibregl-ctrl-group button + button { border-top-color: var(--lm-line); }
.hpm .hpm-map .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.hpm .hpm-map .maplibregl-ctrl-attrib { font-size: 12px; }
.hpm .lmap-shell:fullscreen { height: 100vh !important; border: 0; border-radius: 0; }
.hpm .lmap-shell:-webkit-full-screen { height: 100vh !important; border: 0; border-radius: 0; }
.hpm.lmap--max .lmap-shell { position: fixed; inset: 0; z-index: 1045; height: auto !important; border: 0; border-radius: 0; }
.hpm.lmap--max .lmap-foot { display: none; }
body.lmap-noscroll { overflow: hidden; }

.hpm .lmap-bar { position: absolute; top: 10px; right: 10px; z-index: 4; display: flex; gap: 8px; }
.hpm .lmap-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  background: rgba(26,29,35,.94); color: var(--lm-text); border: 1px solid var(--lm-line); border-radius: 8px;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: pointer;
}
.hpm .lmap-btn:hover { background: var(--lm-raise); color: #fff; }
.hpm .lmap-btn[aria-expanded="true"] { border-color: var(--lm-accent); }
.hpm .lmap-btn i { font-size: 18px; }
.hpm .lmap-btn .lmap-caret { font-size: 16px; color: var(--lm-muted); margin-right: -4px; }
.hpm .lmap-btn-icon { width: 36px; padding: 0; justify-content: center; }
@container (max-width: 520px) { .hpm .lmap-btn span, .hpm .lmap-btn .lmap-caret { display: none; } .hpm .lmap-btn { width: 36px; padding: 0; justify-content: center; } }

.hpm .lmap-pop {
  position: absolute; top: 54px; right: 10px; z-index: 7; width: 290px; max-height: calc(100% - 70px); overflow-y: auto;
  background: var(--lm-card); color: var(--lm-text); border: 1px solid var(--lm-line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); padding: 8px;
}
.hpm .lmap-pop[hidden] { display: none; }
.hpm .lmap-pop h6 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--lm-muted); margin: 10px 8px 6px; }
.hpm .lmap-pop h6:first-child { margin-top: 4px; }
.hpm .lmap-bases { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 0 2px 4px; }
.hpm .lmap-base { min-height: 34px; padding: 4px 8px; border: 1px solid var(--lm-line); border-radius: 8px; background: transparent; color: var(--lm-text); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.hpm .lmap-base:hover { background: var(--lm-raise); }
.hpm .lmap-base.active { border-color: var(--lm-accent); background: rgba(102,126,234,.18); color: #fff; }
.hpm .lmap-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; margin: 0; }
.hpm .lmap-switch:hover { background: var(--lm-raise); }
.hpm .lmap-switch small { display: block; color: var(--lm-muted); font-size: 13px; }
.hpm .lmap-switch input { flex: 0 0 auto; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.hpm .lmap-range { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; font-size: 14px; }
.hpm .lmap-range input { flex: 1; accent-color: var(--lm-accent); }
.hpm .lmap-range b { min-width: 42px; text-align: right; font-weight: 600; color: var(--lm-muted); }

.hpm .lmap-legend {
  position: absolute; left: 10px; bottom: 10px; z-index: 4; min-width: 200px; max-width: min(300px, calc(100% - 80px)); max-height: 50%; overflow-y: auto;
  background: rgba(26,29,35,.94); border: 1px solid var(--lm-line); border-radius: 10px; padding: 8px 10px; color: var(--lm-text); font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.hpm .lmap-legend[hidden] { display: none; }
.hpm .lmap-legend-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 2px 4px; margin-bottom: 4px; border: 0; background: transparent; color: var(--lm-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.hpm .lmap-legend-title:hover { color: #fff; }
.hpm .lmap-legend-title i { font-size: 16px; }
.hpm .lmap-legend.collapsed { min-width: 0; }
.hpm .lmap-legend.collapsed .lmap-legend-title { margin-bottom: 0; }
.hpm .lmap-legend.collapsed .lmap-legend-body { display: none; }
.hpm .lmap-legend-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 3px 4px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; border-radius: 6px; cursor: pointer; }
.hpm .lmap-legend-item:hover { background: var(--lm-raise); }
.hpm .lmap-legend-item img { flex: 0 0 18px; width: 18px; height: 18px; object-fit: contain; max-width: none; }
.hpm .lmap-legend-item .dot { flex: 0 0 14px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #93c5fd; background: #fff; margin: 0 2px; }
.hpm .lmap-legend-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hpm .lmap-legend-item .cnt { color: var(--lm-muted); font-variant-numeric: tabular-nums; }
.hpm .lmap-legend-item.off { opacity: .4; }
.hpm .lmap-legend-item.off .lbl { text-decoration: line-through; }

.hpm .lmap-progress { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 5; background: rgba(26,29,35,.94); border: 1px solid var(--lm-line); border-radius: 999px; padding: 6px 14px; color: var(--lm-text); font-size: 13px; pointer-events: none; }
.hpm .lmap-progress[hidden] { display: none; }

.hpm .lmap-hover {
  position: absolute; z-index: 6; pointer-events: none; width: max-content; max-width: 290px;
  background: rgba(17,20,26,.97); border: 1px solid var(--lm-line); border-radius: 10px; padding: 10px 12px; color: var(--lm-text); font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.hpm .lmap-hover[hidden] { display: none; }
.hpm .hmc-head { display: flex; align-items: center; gap: 10px; }
.hpm .hmc-thumb { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #fff; max-width: none; }
.hpm .hmc-thumb.icon { object-fit: contain; padding: 3px; }
.hpm .hmc-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; -webkit-line-clamp: 2; }
/* Long names (a merged file can be called "Route 1 + Route 1 + …" for a page): two lines on a hover card, three in a popup. */
.hpm .lmap-popup .hmc-title { -webkit-line-clamp: 3; }
.hpm .hmc-sub { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; -webkit-line-clamp: 2; }
.hpm .hmc-sub { color: var(--lm-muted); margin-top: 2px; }
.hpm .hmc-rows { margin-top: 6px; display: grid; gap: 2px; }
.hpm .hmc-rows b { color: #d1d5db; font-weight: 600; }
.hpm .hmc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.hpm .hmc-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #d1d5db; white-space: nowrap; }
.hpm .hmc-tag.ok { color: #86efac; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.1); }
.hpm .hmc-tag.warn { color: #fde68a; border-color: rgba(234,179,8,.35); background: rgba(234,179,8,.1); }
.hpm .hmc-tag.cyan { color: #67e8f9; border-color: rgba(6,182,212,.35); background: rgba(6,182,212,.1); }
.hpm .hmc-tag.fav { color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); }
.hpm .hmc-tag.pub { color: #93c5fd; border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.12); }
.hpm .hmc-tag svg { max-width: none; }
.hpm .hmc-hint { margin-top: 6px; color: var(--lm-muted); font-size: 12px; }

.hpm .lmap-popup .maplibregl-popup-content { background: #1a1d23; color: #e5e7eb; border: 1px solid #374151; border-radius: 12px; padding: 0; box-shadow: 0 10px 30px rgba(0,0,0,.5); overflow: hidden; }
.hpm .lmap-popup { z-index: 6; }
.hpm .lmap-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .hpm .lmap-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .hpm .lmap-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: #374151; }
.hpm .lmap-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip, .hpm .lmap-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .hpm .lmap-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: #374151; }
.hpm .lmap-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #374151; }
.hpm .lmap-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #374151; }
.hpm .lmap-popup .maplibregl-popup-close-button { color: #fff; font-size: 20px; width: 30px; height: 30px; right: 4px; top: 4px; border-radius: 8px; background: rgba(0,0,0,.35); z-index: 2; }
.hpm .lmap-popup .maplibregl-popup-close-button:hover { background: rgba(0,0,0,.6); }
.hpm .hmc-pop { width: 290px; max-width: calc(100vw - 40px); font-size: 13px; }
.hpm .hmc-pop-img { display: block; width: 100%; height: 130px; object-fit: cover; background: #0d1117; max-width: none; }
.hpm .hmc-pop-icon { display: flex; align-items: center; justify-content: center; height: 76px; background: #22262e; }
.hpm .hmc-pop-icon img { width: 40px; height: 40px; opacity: .85; max-width: none; }
.hpm .hmc-pop-body { padding: 12px 14px 4px; }
.hpm .hmc-pop-body .hmc-title { padding-right: 26px; }
.hpm .hmc-pop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 14px 14px; }
.hpm .hmc-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 10px; border-radius: 8px;
  background: #22262e; border: 1px solid #374151; color: #e5e7eb; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; width: auto; margin: 0;
}
.hpm .hmc-act:hover { background: #2a2f39; color: #fff; }
.hpm .hmc-act.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.hpm .hmc-act.primary:hover { background: #1d4ed8; }
.hpm .hmc-act.danger { color: #fca5a5; border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.08); }
.hpm .hmc-act.danger:hover { background: rgba(239,68,68,.18); color: #fff; }
.hpm .hmc-act.btn-success { background: #198754; border-color: #198754; color: #fff; }
.hpm .hmc-act i { font-size: 17px; }
.hpm .hmc-act svg { max-width: none; flex-shrink: 0; }
.hpm .hmc-act.wide { grid-column: 1 / -1; }
.hpm .hmc-pick { padding: 12px 8px 8px; width: 280px; max-width: calc(100vw - 40px); }
.hpm .hmc-pick-head { padding: 0 34px 6px 6px; color: #9ca3af; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.hpm .hmc-pick-list { max-height: 240px; overflow-y: auto; }
.hpm .hmc-pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: #e5e7eb; text-align: left; font-size: 14px; cursor: pointer; }
.hpm .hmc-pick-row:hover { background: #22262e; }
.hpm .hmc-pick-row img { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #fff; max-width: none; }
.hpm .hmc-pick-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hpm .hmc-pick-more { padding: 6px 6px 2px; color: #9ca3af; font-size: 12px; }

.hpm .lmap-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 14px; background: var(--lm-card); border: 1px solid var(--lm-line); border-top: 0; border-radius: 0 0 12px 12px; container-type: inline-size; }
.hpm .lmap-foot small { flex: 1 1 0; min-width: 0; font-size: 13px; }
.hpm .lmap-foot-hint { text-align: right; }
@container (max-width: 700px) { .hpm .lmap-foot-hint { display: none; } }
.hpm .lmap-resize { flex: 0 0 auto; padding: 6px 28px; cursor: ns-resize; touch-action: none; border-radius: 6px; }
.hpm .lmap-resize span { display: block; width: 46px; height: 5px; border-radius: 3px; background: #4b5563; }
.hpm .lmap-resize:hover span, .hpm .lmap-resize.dragging span { background: var(--lm-accent); }
@media (max-width: 575.98px) { .hpm .lmap-pop { left: 10px; right: 10px; width: auto; } }
.hpm .hmc-tag.grp { color: #c7d2fe; border-color: rgba(99,102,241,.45); background: rgba(79,70,229,.18); }
.hpm .hmc-tag.med { color: #fdba74; border-color: rgba(249,115,22,.4); background: rgba(249,115,22,.12); }
.hpm .hmc-tag.hard { color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); }
.hpm .hmc-tag.sig { color: #fcd34d; border-color: rgba(251,191,36,.45); background: rgba(251,191,36,.12); }
.hpm .hmc-tag.new { color: #fff; border-color: #16a34a; background: #16a34a; font-weight: 700; }
.hpm .hmc-pop-icon.gpx { height: 90px; background: linear-gradient(135deg, #334d66 0%, #407080 50%, #4d8073 100%); }
.hpm .hmc-pop-icon.gpx svg { width: 42px; height: 42px; opacity: .9; }
.hpm .hmc-pop-note { padding: 0 14px; color: var(--lm-muted); font-size: 12px; }
.hpm .lmap-legend-item .dot.ring { background: #1f2937; border-width: 3px; }
