/* Chantier Live Trip Tracking Phase 3 (14 mai 2026 PM+++++) — styles
 * fasodrive-track. Palette alignee sur fasodrive-website (dark + or Sahel).
 * Mobile-first : le proche utilise majoritairement son tel pour ouvrir le
 * lien Share. Carte en background plein ecran, card footer en bottom sheet.
 */

:root {
  --bg: #0D0D0D;
  --bg-card: #161616;
  --bg-card-alt: #1a1a1a;
  --border: #2a2a2a;
  --primary: #F5A623;
  --primary-dark: #1a1500;
  --primary-border: #4a3000;
  --green: #5DCAA5;
  --red: #E24B4A;
  --blue: #4A90E2;
  --text: #F0F0F0;
  --text-secondary: #B0B0B0;
  --text-muted: #888;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Header ────────────────────────────────────────────────────────────── */

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(13,13,13,0.92) 0%, rgba(13,13,13,0) 100%);
  padding: 12px 16px 24px;
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}
.tagline {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Carte ─────────────────────────────────────────────────────────────── */

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

/* Marker driver custom (emoji dans une bulle) */
.driver-marker {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

/* ── Overlays loading / error ──────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#loading p {
  color: var(--text-secondary);
  font-size: 14px;
}
.error-icon {
  font-size: 48px;
}
#error h2 {
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
}
#error p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 320px;
}

/* ── Footer card ───────────────────────────────────────────────────────── */

#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
  max-height: 60vh;
  overflow-y: auto;
}

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  background: var(--primary-dark);
  border: 1px solid var(--primary-border);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.status-badge.final {
  color: var(--green);
  background: rgba(93, 202, 165, 0.1);
  border-color: rgba(93, 202, 165, 0.4);
}

.driver-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.driver-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-dark);
  border: 2px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.driver-photo.has-photo span {
  display: none;
}
.driver-info {
  flex: 1;
  min-width: 0;
}
.driver-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
}
.driver-vehicle {
  font-size: 13px;
  color: var(--text-secondary);
}
.driver-plate {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  letter-spacing: 1px;
  margin-top: 2px;
}

.addresses {
  background: var(--bg-card-alt);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.address-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-from { background: var(--green); }
.dot-to { background: var(--red); }
.address-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.address-line {
  width: 2px;
  height: 14px;
  background: var(--border);
  margin-left: 14px;
}

.footer-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ── Responsive : tablette+ ────────────────────────────────────────────── */

@media (min-width: 768px) {
  #footer {
    max-width: 420px;
    left: 16px;
    bottom: 16px;
    right: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
  }
  #header {
    padding: 16px 24px 32px;
  }
}
