/* modules.css — styling for structures-tool.js, geosearch.js,
   weather-panel.js, forecast-player.js and tour.js. Uses the design tokens
   and shared classes already defined in style.css (--bg/--panel/--card/
   --line/--text/--muted/--accent/--accent-ink/--ok/--warn/--err/--shadow,
   .btn/.btn-sm/.btn-primary/.btn-ghost/.chip/.field/.row/.toggle-row/
   .stats-card/.section-title/.hint/.card). No new tokens are introduced. */

/* generic card wrapper (weather + forecast panels reuse it) */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px 14px; box-sizing: border-box;
}

/* ───────────────────────── structures ───────────────────────── */
.wn-structure-vertex {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); cursor: move;
}
.wn-edge-label {
  background: var(--panel) !important; color: var(--text) !important;
  border: 1px solid var(--line) !important; border-radius: 5px; font-size: 11px;
  padding: 1px 5px !important; box-shadow: none !important;
}
.wn-edge-label::before { display: none; }
.wn-structure-popup .leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--text); border-radius: 10px; box-shadow: var(--shadow);
}
.wn-structure-popup .leaflet-popup-tip { background: var(--panel); }
.wn-structure-editor { display: flex; flex-direction: column; gap: 8px; min-width: 220px; font-size: 13px; }
.wn-structure-editor input[type="text"],
.wn-structure-editor input[type="number"],
.wn-structure-editor select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--text); font-size: 13px; font-family: inherit; width: 100%;
}
.wn-structure-editor .field.row { display: flex; gap: 6px; }
.wn-structure-editor .field.row > * { flex: 1; min-width: 0; }
.wn-structure-editor .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.wn-ctx-menu {
  position: fixed; z-index: 4000; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 120px;
  padding: 4px; overflow: hidden;
}
.wn-ctx-item {
  background: none; border: none; text-align: left; padding: 7px 10px; font-size: 13px;
  color: var(--text); cursor: pointer; border-radius: 5px; font-family: inherit;
}
.wn-ctx-item:hover { background: var(--card); color: var(--accent); }


/* ───────────────────────── geosearch ───────────────────────── */
.wn-search { position: relative; width: 100%; max-width: 360px; }
.wn-search-box { display: flex; gap: 6px; align-items: center; }
.wn-search-input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--card); color: var(--text); font-size: 13.5px; font-family: inherit;
}
.wn-locate-btn { flex: none; font-size: 15px; line-height: 1; }
.wn-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1300;
  list-style: none; margin: 0; padding: 4px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.wn-search-result { padding: 7px 9px; font-size: 13px; color: var(--text); cursor: pointer; border-radius: 6px; }
.wn-search-result:hover, .wn-search-result.active { background: var(--card); color: var(--accent); }
.wn-search-pin-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.wn-pin-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.wn-clear-pin-btn { font-size: 15px; line-height: 1; padding: 2px 8px; }
.wn-search-pin .wn-pin-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--err); border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
/* "You are here" marker: same shape, accent color so it reads distinctly
   from a search-result pin; never selectable (pointer-events off). */
.wn-location-pin { pointer-events: none; }
.wn-location-pin .wn-pin-dot { background: var(--accent); }

/* ───────────────────────── weather panel ───────────────────────── */
.wn-weather-card { width: 100%; }
.wn-weather-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wn-weather-head h3 { font-size: 14px; font-weight: 700; }
.wn-weather-asof { font-size: 11px; color: var(--muted); }
.wn-weather-alerts { margin-bottom: 8px; }
.wn-alert {
  background: rgba(212,48,53,0.1); border: 1px solid var(--err); color: var(--err);
  border-radius: 7px; padding: 6px 9px; font-size: 12px; margin-bottom: 4px; font-weight: 600;
}
.wn-weather-body { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; flex-wrap: wrap; }
.wn-weather-compass { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.wn-weather-wind-num { font-size: 13px; font-weight: 700; text-align: center; white-space: nowrap; }
.wn-weather-stats { flex: 1; min-width: 160px; }
.wn-weather-chart { width: 100%; display: block; margin: 8px 0; }
.wn-run-with-btn { margin-top: 4px; }

/* data sources (profile sources + station networks) */
.wn-source-group { margin-top: 10px; }
.wn-source-checks { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.wn-source-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.wn-source-row.disabled { color: var(--muted); cursor: default; }
.wn-source-row input { flex: none; }
.wn-source-row span:nth-of-type(1) { flex: 1; min-width: 0; }
.wn-unavail-tag {
  flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; cursor: help;
}
.wn-station-use { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.wn-station-use-count { flex: 1; }
.wn-station-icon { pointer-events: auto; }
.wn-station-dot { display: block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }

/* wind profile */
.wn-profile-section { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.wn-profile-toggle { width: 100%; justify-content: space-between; display: flex; }
.wn-profile-body { margin-top: 8px; }
.wn-profile-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.wn-profile-chart-wrap { position: relative; }
.wn-profile-chart { width: 100%; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.wn-profile-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: var(--muted); }
.wn-profile-legend-chip { display: inline-flex; align-items: center; gap: 4px; }
.wn-profile-legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.wn-profile-hover {
  position: absolute; top: 6px; right: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px; font-size: 11.5px; color: var(--text); box-shadow: var(--shadow);
}
.wn-profile-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.wn-profile-table th, .wn-profile-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }

/* ───────────────────────── forecast player ───────────────────────── */
.wn-forecast-player { width: 100%; }
.wn-forecast-head { display: flex; align-items: center; gap: 10px; }
.wn-fp-play { flex: none; font-size: 13px; }
.wn-fp-slider { flex: 1; min-width: 0; }
.wn-fp-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; flex: none; }

/* ───────────────────────── tour ───────────────────────── */
.wn-tour-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(10,14,20,0.55);
}
.wn-tour-hole {
  position: fixed; border-radius: 10px; box-shadow: 0 0 0 4000px rgba(10,14,20,0.55);
  transition: left .2s, top .2s, width .2s, height .2s; pointer-events: none;
}
.wn-tour-tooltip {
  position: fixed; width: 320px; max-width: calc(100vw - 24px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 14px 16px; z-index: 5001;
}
.wn-tour-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.wn-tour-text { font-size: 13px; color: var(--text); line-height: 1.45; margin-bottom: 12px; }
.wn-tour-actions { display: flex; align-items: center; gap: 8px; }
.wn-tour-spacer { flex: 1; }
.wn-tour-actions .wn-tour-back:disabled { opacity: .4; cursor: not-allowed; }

/* ───────────────────────── mobile (420px bottom-sheet friendly) ───────────────────────── */
@media (max-width: 480px) {
  .wn-search { max-width: 100%; }
  .wn-weather-body { flex-direction: column; align-items: stretch; }
  .wn-weather-compass { flex-direction: row; justify-content: center; }
  .wn-tour-tooltip { width: calc(100vw - 24px); left: 12px !important; right: 12px; }
  .wn-structure-editor { min-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .wn-tour-hole { transition: none; }
}
