/* ═══════════════════════════════════════════════════════════════
   tracking.css — Simple location tracking markers
   Avatar + speed label. That's it.
   ═══════════════════════════════════════════════════════════════ */

/* --- Marker wrapper --- */
.user-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}

/* --- Speed label above avatar --- */
.marker-speed {
  background: rgba(0,0,0,.7);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.marker-speed.moving {
  background: rgba(34,197,94,.85);
}
.marker-speed.parked {
  background: rgba(245,158,11,.85);
  color: #000;
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

/* --- Avatar circle --- */
.marker-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #3b82f6;
  overflow: hidden;
  background: #171c27;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.marker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.marker-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #7c3aed;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

/* Moving = green border */
.user-marker.moving .marker-avatar {
  border-color: #22c55e;
}

/* Parked = orange/amber */
.user-marker.parked .marker-avatar {
  border-color: #f59e0b;
}
.user-marker.parked .marker-pointer {
  border-top-color: #f59e0b;
}

/* Offline/stale = grey, faded */
.user-marker.offline .marker-avatar {
  border-color: #6b7494;
  opacity: .5;
}
.user-marker.offline .marker-speed {
  opacity: .5;
}

/* --- Pointer triangle --- */
.marker-pointer {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #3b82f6;
  margin-top: -1px;
}
.user-marker.moving .marker-pointer {
  border-top-color: #22c55e;
}
.user-marker.offline .marker-pointer {
  border-top-color: #6b7494;
  opacity: .5;
}

/* Tachograph-derived states (override legacy moving/parked when geoService is active) */
.user-marker.tg-driving .marker-avatar  { box-shadow: 0 0 0 2px #22c55e, 0 2px 6px rgba(0,0,0,.4); }
.user-marker.tg-driving .marker-pointer { border-top-color: #22c55e; }
.user-marker.tg-break .marker-avatar    { box-shadow: 0 0 0 2px #f59e0b, 0 2px 6px rgba(0,0,0,.4); }
.user-marker.tg-break .marker-pointer   { border-top-color: #f59e0b; }
.user-marker.tg-rest .marker-avatar     { box-shadow: 0 0 0 2px #a78bfa, 0 2px 6px rgba(0,0,0,.4); }
.user-marker.tg-rest .marker-pointer    { border-top-color: #a78bfa; }
.user-marker.tg-work .marker-avatar     { box-shadow: 0 0 0 2px #3b82f6, 0 2px 6px rgba(0,0,0,.4); }
.user-marker.tg-work .marker-pointer    { border-top-color: #3b82f6; }
.user-marker.tg-available .marker-avatar  { box-shadow: 0 0 0 2px #14b8a6, 0 2px 6px rgba(0,0,0,.4); }
.user-marker.tg-available .marker-pointer { border-top-color: #14b8a6; }

/* Status badges in panel — match marker colors */
.panel-status.driving  { color: #22c55e; }
.panel-status.break    { color: #f59e0b; }
.panel-status.rest     { color: #a78bfa; }
.panel-status.work     { color: #3b82f6; }
.panel-status.available { color: #14b8a6; }

/* --- Name label --- */
.marker-name {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,.6);
  padding: 1px 6px;
  border-radius: 6px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Detail panel (bottom sheet on tap) --- */
.tracker-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: calc(100% - 32px);
  max-width: 380px;
  background: #10141c;
  border: 1px solid rgba(255,255,255,.1);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 -8px 40px rgba(0,0,0,.5);
  transition: transform .3s ease;
}
.tracker-panel.open {
  transform: translateX(-50%) translateY(0);
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #3b82f6;
}
.panel-info { flex: 1; min-width: 0; }
.panel-name {
  font-size: 15px;
  font-weight: 700;
  color: #e8eeff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-status {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.panel-status.moving { color: #22c55e; }
.panel-status.parked { color: #f59e0b; }
.panel-status.stationary { color: #3b82f6; }
.panel-status.offline { color: #6b7494; }
.panel-close {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #6b7494;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.panel-close:hover { color: #e8eeff; }
.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 13px;
  color: #c0c8e0;
}
.panel-row:last-child { border-bottom: none; }
.panel-row-label { color: #6b7494; }
.panel-row-val { font-weight: 600; color: #e8eeff; }
.panel-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  color: #e8eeff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.panel-btn:hover { background: rgba(255,255,255,.1); }

/* --- Trip summary modal --- */
.trip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,11,16,.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.trip-card {
  background: #10141c;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
}
.trip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.trip-stat {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.trip-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: #e8eeff;
}
.trip-stat-label {
  font-size: 11px;
  color: #6b7494;
  margin-top: 2px;
}
.trip-route-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #e50914, #b20710);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.trip-route-btn:hover { opacity: .9; }

/* --- People list inside panel --- */
.panel-people-section {
  margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,.05);
  padding-top: 8px;
}
/* ── Fast Pick Strip ── */
.fast-pick-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 2px 4px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}
.fast-pick-strip::-webkit-scrollbar { display: none; }
.fast-pick-strip:empty { display: none; }
.fp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: transform .15s;
}
.fp-item:active { transform: scale(.92); }
.fp-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--glass-border, rgba(255,255,255,.12));
  padding: 1px;
  transition: border-color .2s;
}
.fp-item:hover .fp-avatar-wrap { border-color: var(--accent, #4fc3f7); }
.fp-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.fp-avatar-ini {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass, rgba(255,255,255,.06));
  color: var(--muted, #6b7494);
  font-weight: 700;
  font-size: 16px;
}
.fp-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--card-bg, #1a1a2e);
}
.fp-dot.driving {
  background: #22c55e;
  box-shadow: 0 0 5px rgba(34,197,94,.5);
  animation: pulse-green 2s infinite;
}
.fp-dot.online {
  background: #f59e0b;
  box-shadow: 0 0 5px rgba(245,158,11,.4);
}
.fp-dot.offline {
  background: #6b7280;
}
.fp-name {
  font-size: 10px;
  color: var(--muted, #6b7494);
  max-width: 52px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.panel-people-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: none;
  color: #e8eeff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.panel-people-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-people-label svg { opacity: .6; }
.panel-people-count {
  font-size: 11px;
  color: #6b7494;
  font-weight: 600;
}
.panel-people-arrow {
  color: #6b7494;
  font-size: 10px;
  transition: transform .3s;
  display: flex;
}
.panel-people-body {
  max-height: 300px;
  overflow-y: auto;
}

/* Search */
.panel-people-search { padding: 6px 0; }
.panel-people-search input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #e8eeff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.panel-people-search input:focus { border-color: #e50914; }
.panel-people-search input::placeholder { color: #6b7494; }

/* Filter buttons */
.panel-people-filters {
  display: flex;
  gap: 4px;
  padding: 4px 0 8px;
  flex-wrap: wrap;
}
.panel-filter {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03);
  color: #6b7494;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.panel-filter:hover { background: rgba(255,255,255,.06); }
.panel-filter.active {
  background: rgba(var(--accent-rgb),.15);
  color: #e50914;
  border-color: rgba(var(--accent-rgb),.3);
}

/* People items */
.people-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  cursor: pointer;
  border-radius: 6px;
}
.people-item:hover { background: rgba(255,255,255,.05); }
.people-item:last-child { border-bottom: none; }

/* Status dots */
.people-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-moving { background: #22c55e; }
.dot-parked { background: #f59e0b; }
.dot-stationary { background: #3b82f6; }
.dot-offline { background: #6b7494; }

/* Avatar */
.people-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.people-avatar-ini {
  background: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* Info */
.people-info { flex: 1; min-width: 0; }
.people-name {
  font-size: 12px;
  font-weight: 600;
  color: #e8eeff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-meta {
  font-size: 10px;
  color: #6b7494;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.people-battery { font-weight: 600; }
.people-dist { color: #3b82f6; font-weight: 600; }

/* Action arrow */
.people-action { color: #6b7494; flex-shrink: 0; opacity: .5; }
.people-item:hover .people-action { opacity: 1; color: #e50914; }

/* People list wrap */
.panel-people-list-wrap { max-height: 250px; overflow-y: auto; }

@media (max-width: 600px) {
  .tracker-panel { width: 100%; max-width: none; padding: 16px; }
  .marker-avatar { width: 36px; height: 36px; }
  .marker-speed { font-size: 10px; }
  .panel-people-body { max-height: 200px; }
  .panel-people-list-wrap { max-height: 200px; }
}
