/* ==========================================================================
   Tesla Dashboard - Design System Dark Glassmorphism
   ========================================================================== */

:root {
  --bg-primary: #07090e;
  --bg-surface: rgba(17, 24, 39, 0.7);
  --bg-surface-elevated: rgba(31, 41, 55, 0.6);
  --bg-surface-hover: rgba(55, 65, 81, 0.5);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);

  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.25);
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #38bdf8 0%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f3f4f6, #9ca3af);
  -webkit-background-clip: text;
  -webkit-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 400;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sélecteur de véhicule */
.vehicle-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.vehicle-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vehicle-btn:hover {
  color: var(--text-main);
}

.vehicle-btn.active {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.asleep,
.status-badge.offline {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.status-badge.charging {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.status-badge.driving {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

.btn-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.btn-pwa-install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(16, 185, 129, 0.18));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  animation: pulseInstallGlow 3s infinite;
  white-space: nowrap;
}

.btn-pwa-install:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(16, 185, 129, 0.35));
  border-color: #38bdf8;
  color: #f3f4f6;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

@keyframes pulseInstallGlow {
  0%, 100% {
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.2);
  }
  50% {
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
  }
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-weight: 600;
}

/* ==========================================================================
   Content Panels & Layouts
   ========================================================================== */
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Cards */
.card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* KPIs */
.kpi-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Batterie & Jauge */
.battery-gauge-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 20px 0;
  flex-wrap: wrap;
  gap: 20px;
}

.circular-gauge {
  width: 140px;
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.gauge-circle-fill {
  fill: none;
  stroke: url(#cyan-gradient);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.gauge-content {
  position: absolute;
  text-align: center;
}

.gauge-percent {
  font-size: 2.2rem;
  font-weight: 700;
}

.gauge-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* TPMS Pneus */
.tpms-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 15px;
}

.tpms-wheel {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wheel-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wheel-pressure {
  font-size: 1.15rem;
  font-weight: 600;
  color: #34d399;
}

.wheel-pressure.warning {
  color: var(--accent-amber);
}

/* Portières & Coffres */
.closures-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 15px;
}

.closure-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.closure-icon {
  font-size: 1.4rem;
}

.closure-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.closure-status {
  font-size: 0.8rem;
  font-weight: 600;
}

.closure-status.closed {
  color: var(--text-muted);
}

.closure-status.open {
  color: var(--accent-rose);
}

/* Carte Leaflet */
.map-container {
  height: 460px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  background-color: #07090e;
}

/* Rendu Dark Mode élégant sans clé API pour OpenStreetMap */
.map-container .leaflet-tile {
  filter: brightness(0.65) invert(1) contrast(2.2) hue-rotate(200deg) saturate(0.35);
}

.map-container .leaflet-container {
  background-color: #07090e;
}

.selected-drive-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Tableau & Listes */
.data-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.4);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 0.85rem;
}

.data-table tbody tr {
  cursor: pointer;
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

.data-table tbody tr.selected {
  background: rgba(56, 189, 248, 0.15);
}

/* Formulaire Tarifs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #041021;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #f3f4f6;
  border: 1px solid var(--accent-cyan);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   SSE Live Indicator
   ========================================================================== */
.sse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
}

.sse-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sse-badge.connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sse-badge.disconnected,
.sse-badge.idle {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* ==========================================================================
   Battery Health Card
   ========================================================================== */
.health-gauge-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 12px 0 8px 0;
}

.health-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

/* ==========================================================================
   Drive Scrubber & Speed Legend
   ========================================================================== */
.scrubber-container {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-top: 14px;
}

.scrubber-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.4);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

@media (max-width: 768px) {
  .scrubber-hud {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Badge Énergie Totale Trajet */
.drive-energy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 700;
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.12);
  white-space: nowrap;
}

.drive-energy-badge .energy-icon {
  font-size: 0.95rem;
}

.drive-energy-badge .energy-num {
  font-size: 1rem;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #10b981;
}

.drive-energy-badge .energy-unit {
  font-size: 0.72rem;
  color: #6ee7b7;
  font-weight: 600;
  text-transform: uppercase;
}

.scrubber-hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scrubber-hud-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scrubber-hud-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.scrubber-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scrubber-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.scrubber-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

.scrubber-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
  cursor: grab;
  transition: transform 0.1s ease;
}

.scrubber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.speed-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.speed-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ==========================================================================
   Geofences Management
   ========================================================================== */
.geofence-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.geofence-card-badge.hp_hc {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.geofence-card-badge.free {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.geofence-card-badge.fixed {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-danger-sm {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #f43f5e;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger-sm:hover {
  background: rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   Live Charging HUD & Animations
   ========================================================================== */
.charging-hero-card {
  border-left: 4px solid #10b981 !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(15, 23, 42, 0.75) 100%) !important;
  box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.25) !important;
  animation: chargingFadeIn 0.5s ease-out;
}

@keyframes chargingFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.charging-bolt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-full);
  font-size: 1rem;
  color: #34d399;
  animation: boltPulse 1.8s infinite ease-in-out;
}

@keyframes boltPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    transform: scale(1.12);
    box-shadow: 0 0 14px 4px rgba(16, 185, 129, 0.4);
  }
}

.circular-gauge.charging .gauge-circle-fill {
  stroke: #10b981 !important;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.8));
}

.badge-charging-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========================================================================
   3D Vehicle Viewer (Option A - Three.js)
   ========================================================================== */
.car3d-card {
  margin-bottom: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.85) 0%, rgba(7, 9, 14, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.15);
  position: relative;
}

.car3d-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 10px;
  max-width: calc(100% - 345px);
  position: relative;
  z-index: 10;
}

.car3d-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.car3d-color-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.car3d-controls {
  display: flex;
  gap: 6px;
}

.car3d-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.car3d-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.car3d-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
}

.car3d-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 420px;
  max-height: 420px;
  overflow: hidden;
  contain: strict;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.car3d-canvas-wrapper canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: grab;
}

.car3d-canvas-wrapper canvas:active {
  cursor: grabbing;
}

/* HUD Overlay */
.car3d-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  padding: 10px 24px;
  background: rgba(7, 9, 14, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  z-index: 10;
  pointer-events: none;
}

.car3d-hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.car3d-hud-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-main);
  line-height: 1;
}

#car3d-hud-speed .car3d-hud-val {
  color: var(--accent-cyan);
}

#car3d-hud-shift .car3d-hud-val {
  color: var(--accent-purple);
}

#car3d-hud-soc .car3d-hud-val {
  color: var(--accent-emerald);
}

.car3d-hud-unit {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* Loading Overlay */
.car3d-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(7, 9, 14, 0.9);
  z-index: 20;
  transition: opacity 0.5s ease;
}

.car3d-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.car3d-loading span {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.car3d-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: car3d-spin 0.8s linear infinite;
}

@keyframes car3d-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Fullscreen mode */
.car3d-card.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  margin: 0;
  border-radius: 0;
  border: none;
}

.car3d-card.fullscreen .car3d-canvas-wrapper {
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
}

/* 3D Viewer Glow Border Animation */
.car3d-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, transparent 30%, transparent 70%, rgba(168, 85, 247, 0.2) 100%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.car3d-card:hover::before {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .car3d-canvas-wrapper {
    height: 300px;
  }

  .car3d-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .car3d-hud {
    gap: 12px;
    padding: 8px 16px;
  }

  .car3d-hud-val {
    font-size: 1.1rem;
  }
}

/* ==========================================================================
   Modal d'édition d'itinéraire & Autocomplétion d'adresses
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  background: #111827;
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.1);
  width: 92%;
  max-width: 520px;
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px) scale(0.97);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #9ca3af);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-edit-drive-addr {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan, #38bdf8);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.btn-edit-drive-addr:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.autocomplete-list {
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

/* ─── Tiroir Mode Test / Démo Glassmorphism Showroom ─────────────────────── */
.demo-drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 320px;
  max-width: calc(100% - 24px);
  background: rgba(13, 17, 26, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(168, 85, 247, 0.15);
  transform: translateX(360px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.demo-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#btn-demo-mode.active {
  background: rgba(168, 85, 247, 0.25) !important;
  border-color: #a855f7 !important;
  color: #d8b4fe !important;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.45) !important;
}

.demo-drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.demo-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
}

.demo-badge-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
  animation: pulse-dot 1.8s infinite;
}

.demo-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-demo-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-demo-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-demo-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.btn-demo-close:hover {
  color: #f43f5e;
}

.demo-drawer-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.demo-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
}

.demo-val-badge {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #38bdf8;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.demo-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

.demo-quick-buttons {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.btn-quick-speed {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 4px 0;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-quick-speed:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.demo-gear-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-gear {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-gear:hover {
  color: #fff;
}

.btn-gear.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(56, 189, 248, 0.4));
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.demo-sub-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #64748b;
}

.btn-sub-link {
  background: transparent;
  border: none;
  color: #38bdf8;
  padding: 0;
  font-size: 0.72rem;
  cursor: pointer;
}

.btn-sub-link:hover {
  text-decoration: underline;
}

.demo-doors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-door-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.btn-door-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-door-toggle.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.demo-toggles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #cbd5e1;
  cursor: pointer;
  padding: 3px 0;
}

.demo-toggle-row input[type="checkbox"] {
  accent-color: #a855f7;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

/* ═══════════════════════════════════════════════════════════════════
   Design Officiel Tesla App : En-tête Statut, Carte Fondue & Barre Rapide
   ═══════════════════════════════════════════════════════════════════ */

/* En-tête Statut Style Tesla App */
.car3d-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.battery-pill-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 7px;
  font-weight: 600;
  color: #10b981;
}

.battery-mini-icon {
  width: 18px;
  height: 9px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  position: relative;
  display: inline-block;
  padding: 1px;
}

.battery-mini-icon::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: #94a3b8;
  border-radius: 0 1px 1px 0;
}

.battery-mini-fill {
  display: block;
  height: 100%;
  background: #10b981;
  border-radius: 1px;
  transition: width 0.3s ease;
}

.status-dot-sep {
  color: #64748b;
  font-size: 0.8rem;
}

/* Mini-Carte GPS Superposée (Tesla MCU V12) - Agrandie de 15% et en haut à droite */
.live-map-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 325px;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  z-index: 15;
  background: rgba(7, 9, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  mask-image: radial-gradient(circle at 85% 20%, black 50%, rgba(0, 0, 0, 0.7) 75%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at 85% 20%, black 50%, rgba(0, 0, 0, 0.7) 75%, transparent 100%);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.live-map-overlay:hover {
  mask-image: none;
  -webkit-mask-image: none;
  border-color: rgba(255, 255, 255, 0.22);
}

.live-map-leaflet {
  width: 100%;
  height: 100%;
}

.live-map-location-pill {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.72rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Barre d'icônes rapides sous le véhicule (Style Application Tesla) */
.car3d-quick-actions {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 28px;
  z-index: 10;
  background: rgba(10, 14, 23, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.quick-status-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s ease;
  user-select: none;
}

.quick-status-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Sentinelle : rond rouge ou gris fidèle à l'app Tesla */
.sentry-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sentry-outer-ring {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.sentry-inner-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  transition: all 0.3s ease;
}

/* Sentinelle active (Rond Rouge Tesla) */
.quick-status-item.sentry-active .sentry-outer-ring {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.quick-status-item.sentry-active .sentry-inner-dot {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: sentry-pulse 2s infinite ease-in-out;
}

@keyframes sentry-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

/* Verrouillage ouvert */
.quick-status-item.unlocked {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.15);
}

/* Climatisation active */
.quick-status-item.climate-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.15);
  animation: fan-spin 3s linear infinite;
}

@keyframes fan-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Feux allumés */
.quick-status-item.lights-active {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.15);
}

/* ====================================================================
   Inspecteur JSON des Données Brutes Collector
   ==================================================================== */
.raw-filter-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
  transition: var(--transition);
}

.raw-filter-badge:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.raw-filter-badge.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  font-weight: 600;
}

.json-node {
  margin: 2px 0;
  position: relative;
}

.json-line {
  display: flex;
  align-items: baseline;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.json-line:hover {
  background: rgba(255, 255, 255, 0.04);
}

.json-toggle {
  display: inline-block;
  width: 16px;
  cursor: pointer;
  user-select: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.json-toggle:hover {
  color: var(--accent-cyan);
}

.json-toggle.collapsed {
  transform: rotate(-90deg);
}

.json-key {
  color: #38bdf8;
  font-weight: 500;
  margin-right: 6px;
}

.json-string {
  color: #34d399;
  word-break: break-all;
}

.json-number {
  color: #fbbf24;
}

.json-boolean {
  color: #f472b6;
  font-weight: 600;
}

.json-null {
  color: #94a3b8;
  font-style: italic;
}

.json-count {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-left: 8px;
  opacity: 0.7;
}

.json-children {
  margin-left: 20px;
  border-left: 1px dashed rgba(255, 255, 255, 0.12);
  padding-left: 8px;
}

.json-children.collapsed {
  display: none;
}

.json-highlight {
  background: rgba(250, 204, 21, 0.35);
  color: #fef08a;
  border-radius: 2px;
  padding: 0 2px;
}

/* ==========================================================================
   Mobile & Responsive Excellence (UI/UX Pro Max - Densité et Ergonomie)
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    padding: 8px 10px;
  }

  /* Header compact */
  .header {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 12px;
    gap: 10px;
  }

  .brand {
    gap: 10px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .brand-subtitle {
    display: none;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }

  .vehicle-selector {
    flex-grow: 1;
  }

  .vehicle-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
    min-height: 34px;
  }

  .status-badge {
    padding: 3px 7px;
    font-size: 0.7rem;
  }

  /* Barre d'onglets compacte scrollable horizontalement sans scrollbar */
  .tabs-nav {
    gap: 4px;
    padding: 3px;
    margin-bottom: 10px;
    background: rgba(17, 24, 39, 0.4);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
  }

  .tab-btn {
    padding: 6px 11px;
    font-size: 0.8rem;
    border-radius: 8px;
    min-height: 36px;
  }

  /* Cards & Headers */
  .card {
    padding: 12px 10px;
    border-radius: 12px;
    margin-bottom: 10px !important;
  }

  .card-header {
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-title {
    font-size: 1.02rem;
  }

  /* Grilles sur mobile : 2 colonnes compactes pour les KPIs */
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .grid-3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .kpi-box {
    padding: 8px 10px;
    border-radius: 8px;
    gap: 2px;
  }

  .kpi-label {
    font-size: 0.7rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  /* Showroom 3D & Live Map */
  .car3d-canvas-wrapper {
    height: 250px;
  }

  .live-map-overlay {
    width: 160px;
    height: 110px;
    top: 6px;
    right: 6px;
    border-radius: 8px;
  }

  .live-map-location-pill {
    font-size: 0.65rem;
    padding: 2px 6px;
    bottom: 4px;
    left: 4px;
    right: 4px;
  }

  .car3d-quick-actions {
    gap: 12px;
    padding: 4px 10px;
    bottom: 6px;
    border-radius: 20px;
  }

  .quick-status-item {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  .car3d-hud {
    padding: 4px 8px;
    gap: 8px;
    bottom: 46px;
  }

  .car3d-hud-val {
    font-size: 0.9rem;
  }

  .car3d-controls-overlay {
    top: 6px;
    left: 6px;
    gap: 6px;
  }

  .car3d-tool-btn {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  /* Jauge Batterie */
  .battery-gauge-container {
    padding: 8px 0;
    gap: 10px;
  }

  .circular-gauge {
    width: 100px;
    height: 100px;
  }

  .gauge-text .gauge-value {
    font-size: 1.4rem;
  }

  /* Trajets & Leaflet Scrubber */
  #drives-leaflet-map {
    height: 240px !important;
    border-radius: 8px;
  }

  .scrubber-container {
    padding: 8px 10px;
    border-radius: 10px;
    margin-top: 8px;
  }

  .scrubber-hud {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px 8px;
    margin-bottom: 8px;
  }

  .scrubber-hud-label {
    font-size: 0.68rem;
  }

  .scrubber-hud-val {
    font-size: 0.92rem;
  }

  .scrubber-controls {
    gap: 6px;
  }

  .scrubber-btn {
    width: 30px;
    height: 30px;
  }

  #scrubber-step {
    min-width: 60px;
    font-size: 0.7rem;
  }

  .speed-legend {
    gap: 4px;
    font-size: 0.7rem;
    padding: 4px 0;
  }

  /* Tableaux & Données */
  .data-table-container {
    border-radius: 8px;
  }

  .data-table th,
  .data-table td {
    padding: 7px 8px;
    font-size: 0.76rem;
  }

  .btn-edit-drive-addr {
    padding: 2px 6px;
    font-size: 0.68rem;
    margin-top: 3px;
  }

  /* Modale Adresse */
  .modal-box {
    width: calc(100% - 16px);
    padding: 14px;
    border-radius: 12px;
    max-height: 90vh;
  }

  /* Drawer Démo Mode */
  .demo-drawer {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 5px 6px;
  }

  .header {
    padding: 8px 10px;
  }

  .card {
    padding: 10px 8px;
  }

  .kpi-value {
    font-size: 1.15rem;
  }

  .live-map-overlay {
    width: 130px;
    height: 90px;
  }

  #drives-leaflet-map {
    height: 200px !important;
  }
}