/* MODULE: livetrack - Live-Tracking Steuerung + Karten-Pins
   Control-Leiste im Mitglieder-Karten-Bereich + pulsierende Live-Marker.
══════════════════════════════════════════════════════════════════════ */

/* ── Steuerungsleiste ─────────────────────────────────────── */
.livetrack-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 12px 0 0;
}

.lt-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius, 10px);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.lt-btn:active { transform: scale(0.97); }

.lt-btn--start { background: #E53935; color: #fff; }
.lt-btn--start:hover { background: #c62828; }
.lt-btn--stop  { background: #1f2937; color: #fff; }
.lt-btn--stop:hover  { background: #374151; }
.lt-btn--ghost {
  background: transparent;
  color: var(--text, #333);
  border: 1px solid var(--border, rgba(0,0,0,.18));
}
.lt-btn--ghost:hover { background: rgba(0,0,0,.05); }

.lt-hint {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

/* Roter Punkt (statisch bzw. pulsierend) */
.lt-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
}
.lt-btn--start .lt-dot { background: #fff; }
.lt-dot--pulse {
  background: #E53935;
  box-shadow: 0 0 0 0 rgba(229,57,53,.6);
  animation: lt-pulse 1.6s infinite;
}

.lt-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(229,57,53,.12);
  color: #E53935;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
}

/* ── Start-Formular ───────────────────────────────────────── */
.lt-form {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: var(--radius, 12px);
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.lt-form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.lt-form-row label { font-size: 12px; font-weight: 600; color: var(--text-muted, #6b7280); }
.lt-form-row input,
.lt-form-row select {
  padding: 9px 11px;
  border: 1px solid var(--border, rgba(0,0,0,.18));
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}
.lt-form-row input:focus,
.lt-form-row select:focus { outline: 2px solid rgba(229,57,53,.35); border-color: #E53935; }
.lt-form-actions { display: flex; gap: 10px; margin-top: 4px; }
.lt-privacy { margin: 10px 0 0; font-size: 11.5px; color: var(--text-muted, #6b7280); line-height: 1.4; }

/* ── Live-Marker auf der Karte ────────────────────────────── */
.lt-marker-wrap { background: none; border: none; }
.lt-marker {
  position: relative;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.lt-marker-pulse {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #E53935;
  box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(229,57,53,.6);
  animation: lt-pulse 1.6s infinite;
}
.lt-marker--me .lt-marker-pulse { background: #2563eb; box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(37,99,235,.6); }
.lt-marker-avatar {
  position: absolute;
  top: -34px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

@keyframes lt-pulse {
  0%   { box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(229,57,53,.55); }
  70%  { box-shadow: 0 0 0 3px #fff, 0 0 0 14px rgba(229,57,53,0); }
  100% { box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(229,57,53,0); }
}
@media (prefers-reduced-motion: reduce) {
  .lt-dot--pulse, .lt-marker-pulse { animation: none; }
}

/* ── Popup ────────────────────────────────────────────────── */
.lt-popup { min-width: 150px; }
.lt-popup-name { font-weight: 700; font-size: 14px; }
.lt-popup-you { color: #2563eb; font-weight: 600; }
.lt-popup-title { font-size: 13px; color: var(--text, #333); margin-top: 2px; }
.lt-popup-meta { font-size: 12px; color: #E53935; margin-top: 4px; }
.lt-popup-route { font-size: 12.5px; color: var(--text, #333); margin-top: 6px; font-weight: 600; }
.lt-popup-progress { margin-top: 4px; }
.lt-popup-progress-bar {
  height: 6px; border-radius: 999px;
  background: rgba(0,0,0,.1); overflow: hidden;
}
.lt-popup-progress-bar span {
  display: block; height: 100%;
  background: #16a34a; border-radius: 999px;
}
.lt-popup-progress-txt { font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 3px; }
.lt-popup-stream {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #E53935;
  color: #fff !important;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.lt-popup-stream:hover { background: #c62828; }

/* ── Karten-Filter "Live jetzt" (mitglieder-map.js) ────────── */
.mbmap-live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #E53935;
  vertical-align: middle;
  margin-right: 3px;
}
.members-map-filter-btn--live.active {
  background: #E53935 !important;
  border-color: #E53935 !important;
  color: #fff !important;
}
.members-map-filter-btn--live.active .mbmap-live-dot { background: #fff; animation: mbmap-blink 1.4s infinite; }
@keyframes mbmap-blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .members-map-filter-btn--live.active .mbmap-live-dot { animation: none; }
}

/* ── Profil-Bereich "Live-Tracking" (js/livetrack-device.js) ── */
.ltd-lead { font-size: 13.5px; line-height: 1.55; margin: 0 0 14px; }
.ltd-block { border-top: 1px solid var(--border, rgba(0,0,0,.1)); padding-top: 14px; margin-top: 14px; }
.ltd-block-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.ltd-opt { font-weight: 400; font-size: 12px; color: var(--text-muted, #6b7280); }
.ltd-hint2 { font-size: 12px; color: var(--text-muted, #6b7280); }
.ltd-btn-sm { padding: 8px 14px; font-size: 13px; }

/* Failsafe-Status */
.ltd-status { font-size: 13.5px; line-height: 1.5; padding: 9px 12px; border-radius: 8px; margin-bottom: 10px; background: #f3f4f6; }
.ltd-status--ok   { background: rgba(22,163,74,.12);  color: #15803d; }
.ltd-status--warn { background: rgba(234,88,12,.12);  color: #c2410c; }

/* Route */
.ltd-current { font-size: 13.5px; margin-bottom: 10px; }
.ltd-route-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ltd-route-row select {
  flex: 1; min-width: 160px;
  padding: 9px 11px; border: 1px solid var(--border, rgba(0,0,0,.18));
  border-radius: 8px; font: inherit; font-size: 14px; background: #fff;
}
.ltd-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ltd-linkbtn {
  border: none; background: none; padding: 0; cursor: pointer;
  color: #c2410c; font: inherit; font-size: 12.5px; text-decoration: underline;
}

/* App verbinden */
.ltd-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 2px 0 12px; }
.ltd-dl { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 14px; }
.ltd-alt { font-size: 13px; color: var(--accent, #FF6B00); }
.ltd-mini { margin: 0; padding-left: 20px; }
.ltd-mini > li { margin-bottom: 10px; font-size: 13.5px; line-height: 1.5; }
.ltd-mini > li::marker { color: var(--accent, #FF6B00); font-weight: 700; }
.ltd-urlbox { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 2px; }
.ltd-urltext {
  display: block; word-break: break-all;
  background: #f9fafb; border: 1px solid var(--border, rgba(0,0,0,.18));
  border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.45; color: var(--text, #222);
}
.ltd-copy { align-self: flex-start; }
.ltd-note { font-size: 11.5px; color: var(--text-muted, #6b7280); line-height: 1.4; margin: 8px 0 0; }
.ltd-help { margin-top: 14px; }
.ltd-help summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--accent, #FF6B00); }
.ltd-help-inner { margin-top: 10px; }
.ltd-regen { margin-top: 12px; }

/* ── Live-Rangliste (js/livetrack.js) ─────────────────────── */
.live-ranking {
  max-width: 460px; margin: 12px 0 0;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: var(--radius, 12px);
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.lr-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.lr-list { list-style: none; margin: 0; padding: 0; counter-reset: lr; }
.lr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border, rgba(0,0,0,.06)); }
.lr-row:first-child { border-top: none; }
.lr-row::before { counter-increment: lr; content: counter(lr); width: 20px; text-align: center; font-weight: 700; color: var(--accent, #FF6B00); flex: 0 0 auto; }
.lr-name { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-val { font-size: 12.5px; color: var(--text-muted, #6b7280); white-space: nowrap; }
.lr-row--me .lr-name { font-weight: 700; color: #2563eb; }

/* ── Community-Leaderboard (js/leaderboard.js) ────────────── */
.leaderboard-section {
  margin: 22px 0;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: var(--radius, 14px);
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.lb-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.lb-title { font-family: var(--font-display, 'Bebas Neue', sans-serif); font-size: 24px; letter-spacing: .03em; margin: 0; }
.lb-controls { display: flex; gap: 10px 14px; flex-wrap: wrap; }
.lb-tabs, .lb-metric { display: inline-flex; gap: 4px; background: rgba(0,0,0,.05); border-radius: 999px; padding: 3px; }
.lb-tab, .lb-mbtn { border: none; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; color: var(--text-muted, #6b7280); }
.lb-tab.active, .lb-mbtn.active { background: var(--accent, #FF6B00); color: #fff; }
.lb-list { list-style: none; margin: 0; padding: 0; counter-reset: lb; }
.lb-row { display: grid; grid-template-columns: 30px 1fr auto; grid-template-areas: 'rank name main' 'rank sub main'; align-items: center; gap: 0 10px; padding: 8px 0; border-top: 1px solid var(--border, rgba(0,0,0,.07)); }
.lb-row:first-child { border-top: none; }
.lb-rank { grid-area: rank; font-weight: 800; font-size: 15px; color: var(--text-muted, #9ca3af); text-align: center; }
.lb-row--top .lb-rank { color: var(--accent, #FF6B00); }
.lb-name { grid-area: name; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-main { grid-area: main; font-weight: 700; font-size: 15px; white-space: nowrap; }
.lb-sub { grid-area: sub; font-size: 11.5px; color: var(--text-muted, #6b7280); }
.lb-empty { font-size: 13.5px; color: var(--text-muted, #6b7280); margin: 4px 0; }
.lb-note { font-size: 11px; color: var(--text-muted, #9ca3af); margin: 10px 0 0; }

/* Live-Rangliste: Gruppen je Strecke */
.lr-group { margin-top: 12px; }
.lr-group:first-of-type { margin-top: 6px; }
.lr-group-name { font-size: 12px; font-weight: 700; color: var(--accent, #FF6B00); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.lr-group-n { color: var(--text-muted, #9ca3af); font-weight: 600; }

/* ── Crew-Notes / POI-Drops (js/crewnotes.js) ─────────────── */
.crew-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 0; }
.crew-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border, rgba(0,0,0,.18));
  border-radius: 999px; background: #fff; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text, #333);
}
.crew-btn.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
.crew-btn--ghost { font-weight: 500; color: var(--text-muted, #6b7280); }
.crew-hint { font-size: 12px; color: var(--text-muted, #6b7280); }

/* Marker */
.crew-marker-wrap { background: none; border: none; }
.crew-marker {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); font-size: 15px;
}
.crew-marker > * { transform: rotate(45deg); }

/* Formular im Popup */
.crew-form { display: flex; flex-direction: column; gap: 4px; min-width: 230px; }
.crew-form label { font-size: 11px; font-weight: 600; color: var(--text-muted, #6b7280); margin-top: 4px; }
.crew-form select, .crew-form input {
  padding: 7px 9px; border: 1px solid var(--border, rgba(0,0,0,.2));
  border-radius: 7px; font: inherit; font-size: 13px;
}
.crew-actions { display: flex; gap: 8px; margin-top: 8px; }
.crew-save { flex: 1; background: #2563eb; color: #fff; border: none; border-radius: 7px; padding: 8px; font-weight: 600; cursor: pointer; }
.crew-cancel { background: none; border: none; color: var(--text-muted, #6b7280); cursor: pointer; font: inherit; }

/* Popup-Inhalt */
.crew-popup-cat { font-weight: 700; font-size: 13.5px; }
.crew-popup-note { font-size: 13px; margin-top: 3px; }
.crew-popup-links { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.crew-gmaps { font-size: 12.5px; color: #2563eb; }
.crew-popup-meta { font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 6px; }
.crew-del { border: none; background: none; color: #E53935; cursor: pointer; font: inherit; font-size: 11.5px; text-decoration: underline; padding: 0; }

.lb-period { font-size: 13px; font-weight: 700; color: var(--text-muted, #6b7280); padding: 6px 2px; }

/* Standort-teilen-Schalter (js/livetrack-device.js) */
.ltd-share { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.ltd-share-label { font-weight: 700; font-size: 14px; }
.ltd-switch { position: relative; width: 46px; height: 26px; border-radius: 999px; border: none; background: #cbd5e1; cursor: pointer; padding: 0; transition: background .15s; flex: 0 0 auto; }
.ltd-switch.is-on { background: #16a34a; }
.ltd-switch-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.ltd-switch.is-on .ltd-switch-knob { left: 23px; }
.ltd-share-state { font-size: 12px; font-weight: 700; color: var(--text-muted, #6b7280); }
