/* ============================================
   STYLES.CSS - GPS Moto
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --bg: #FFFFFF;
    --bg2: #F5F5F7;
    --bg3: #E5E5EA;
    --text: #1D1D1F;
    --text2: #86868B;
    --accent: #0A84FF;
    --accent2: #5AC8FA;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --card: rgba(255,255,255,0.9);
    --border: rgba(0,0,0,0.06);
    /* Élévation douce : remplace les bordures franches sur les cartes/boutons
       pour un rendu plus contemporain (moins "boîte avec un contour"). */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-2: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-3: 0 12px 32px rgba(0,0,0,0.14);
}

[data-theme="dark"] {
    --bg: #000000;
    --bg2: #1C1C1E;
    --bg3: #2C2C2E;
    --text: #FFFFFF;
    --text2: #98989D;
    --accent: #0A84FF;
    --accent2: #64D2FF;
    --card: rgba(28,28,30,0.9);
    --border: rgba(255,255,255,0.08);
    /* En sombre les ombres portées sont invisibles sur fond noir : on retombe
       sur un liseré clair très discret + un halo pour suggérer le relief. */
    --shadow-1: 0 0 0 1px rgba(255,255,255,0.05), 0 2px 6px rgba(0,0,0,0.5);
    --shadow-2: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 20px rgba(0,0,0,0.55);
    --shadow-3: 0 0 0 1px rgba(255,255,255,0.08), 0 16px 40px rgba(0,0,0,0.6);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg2);
    color: var(--text);
    overflow: hidden;
    position: fixed;
    inset: 0;
}

#map { position: absolute; inset: 0; z-index: 1; }

/* Écran d'accueil affiché le temps que la carte TomTom charge ses tuiles.
   Sans lui, le premier écran est un rectangle gris vide pendant 2-4s. */
#mapLoadingOverlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(160deg, var(--bg2), var(--bg));
    transition: opacity 0.4s ease;
}
#mapLoadingOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.map-loading-icon {
    font-size: 56px;
    margin-bottom: 8px;
    animation: mapLoadingBounce 1.4s ease-in-out infinite;
}
.map-loading-title {
    font-size: 20px;
    font-weight: 800;
}
.map-loading-sub {
    font-size: 13px;
    color: var(--text2);
    font-weight: 500;
}
@keyframes mapLoadingBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: max(env(safe-area-inset-top), 12px) 16px 12px;
    background: linear-gradient(var(--card), transparent);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon { font-size: 24px; }

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

#statsBtn {
    display: none;
    padding: 8px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}
#statsBtn.visible { display: flex; align-items: center; gap: 6px; }

.theme-btn {
    width: 44px; height: 44px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
}

/* ============================================
   SPEED DISPLAY
   ============================================ */
.speed-display {
    position: fixed;
    top: 80px; right: 16px;
    z-index: 100;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 12px 16px;
    text-align: center;
    display: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
}
.speed-display.active { display: block; }
.speed-value { font-size: 40px; font-weight: 900; color: var(--accent); line-height: 1; }
.speed-unit { font-size: 11px; color: var(--text2); font-weight: 600; }

/* ============================================
   ZOOM CONTROLS
   ============================================ */
.zoom-controls {
    position: fixed;
    top: 180px; right: 16px;
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: 8px;
}
.zoom-controls.active { display: flex; }

.zoom-btn {
    width: 44px; height: 44px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
}
.zoom-btn:active { transform: scale(0.95); }

#zoomIndicator {
    position: fixed;
    top: 290px; right: 16px;
    z-index: 100;
    background: var(--warning);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    display: none;
}
#zoomIndicator.active { display: block; }

/* ============================================
   BOTTOM CONTROLS
   ============================================ */
.bottom-controls {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--card);
    backdrop-filter: blur(20px);
    box-shadow: 0 -1px 0 var(--border), 0 -12px 24px -12px rgba(0,0,0,0.12);
    padding: 10px 8px max(env(safe-area-inset-bottom), 10px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.bottom-controls.hidden { display: none; }

.bottom-btn {
    background: none;
    border: none;
    padding: 4px 4px 2px;
    text-align: center;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}
.bottom-btn:active .bottom-btn-icon { transform: scale(0.88); }
.bottom-btn-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    border-radius: 50%;
    background: var(--bg2);
    transition: transform 0.15s ease;
}
.bottom-btn-label { font-size: 10.5px; font-weight: 600; color: var(--text2); margin-top: 6px; }

/* Action principale mise en avant : la navigation est le geste n°1 de l'app,
   elle ne doit pas se fondre dans les 3 autres boutons secondaires. */
#navBtn .bottom-btn-icon {
    background: var(--accent);
    box-shadow: 0 4px 14px rgba(10,132,255,0.4);
}
#navBtn .bottom-btn-label { color: var(--accent); }

/* ============================================
   SEARCH PANEL
   ============================================ */
.search-panel {
    position: fixed;
    top: 80px; left: 16px; right: 16px;
    z-index: 200;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    display: none;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.search-panel.active { display: block; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.panel-title { font-size: 18px; font-weight: 700; }
.close-btn {
    width: 32px; height: 32px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg2);
    border-radius: 10px;
    margin-bottom: 8px;
}
.settings-label { font-size: 14px; font-weight: 500; }
.settings-right { display: flex; align-items: center; gap: 10px; }
.test-btn {
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.test-btn:active { opacity: 0.8; }

.toggle {
    width: 50px; height: 30px;
    background: var(--bg3);
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle.active { background: var(--success); }
.toggle::after {
    content: '';
    position: absolute;
    width: 26px; height: 26px;
    background: white;
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle.active::after { transform: translateX(20px); }

.search-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 12px;
}
.search-input:focus { outline: none; border-color: var(--accent); }

#suggestions { margin-bottom: 16px; }
.suggestion-item {
    padding: 12px;
    background: var(--bg2);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}
.suggestion-item:active { transform: scale(0.98); }
.suggestion-main { font-weight: 600; margin-bottom: 2px; }
.suggestion-sub { font-size: 12px; color: var(--text2); }

#startBtn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 6px 18px rgba(10,132,255,0.35);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#startBtn:active:not(:disabled) { transform: scale(0.98); }
#startBtn:disabled { opacity: 0.4; box-shadow: none; }

/* Version applicative en pied de panneau — discret mais toujours findable */
#versionFooter {
    margin-top: 20px;
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: var(--text2);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    user-select: none;
    transition: background 0.15s;
}
#versionFooter:active { background: var(--bg2); }
#versionFooter .version-status {
    display: inline-block;
    margin-left: 6px;
    font-weight: 700;
}
#versionFooter .version-status.up-to-date { color: var(--success); }
#versionFooter .version-status.checking { color: var(--text2); }
#versionFooter .version-status.update    { color: var(--accent); }

/* ============================================
   ROUTE PREVIEW
   ============================================ */
#routePreview {
    position: fixed;
    bottom: 20px; left: 16px; right: 16px;
    z-index: 200;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    display: none;
}
#routePreview.active { display: block; }

.route-option {
    background: var(--bg2);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}
.route-option.selected { border-color: var(--accent); }

.route-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.route-icon { font-size: 20px; }
.route-name { font-weight: 700; flex: 1; }
.route-time { font-size: 20px; font-weight: 800; color: var(--accent); }

.route-details {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 4px;
}
.route-desc { font-size: 12px; color: var(--text2); font-style: italic; }

.route-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.route-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
#cancelRouteBtn {
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    color: var(--text);
}
#startNavBtn {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 6px 18px rgba(10,132,255,0.35);
    border: none;
    color: white;
}
#startNavBtn:active { transform: scale(0.98); }

/* ============================================
   NAV PANEL
   ============================================ */
#navPanel {
    position: fixed;
    bottom: 20px; left: 16px; right: 16px;
    z-index: 150;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    display: none;
}
#navPanel.active { display: block; }

.nav-main {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

#navIcon {
    font-size: 48px;
    line-height: 1;
    min-width: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* SVG Manœuvres */
.maneuver-svg,
.roundabout-svg {
    width: 80px;
    height: 80px;
}

/* Emoji maneuver (fallback) */
.maneuver-emoji {
    font-size: 48px;
}

/* Ancien style rond-point (backup) */
.roundabout-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.roundabout-icon .exit-num {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 800;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text { flex: 1; min-width: 0; overflow: hidden; }
#navDistance { font-size: 32px; font-weight: 900; color: var(--accent); line-height: 1; }
#navInstruction { font-size: 16px; font-weight: 600; margin-top: 4px; word-wrap: break-word; overflow-wrap: break-word; }
#navStreet { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.nav-info-item {
    background: var(--bg2);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.nav-info-label { font-size: 10px; color: var(--text2); font-weight: 600; text-transform: uppercase; }
.nav-info-value { font-size: 16px; font-weight: 700; margin-top: 2px; }

.nav-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.nav-btn {
    padding: 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.nav-btn:active { transform: scale(0.96); }
#stopNavBtn { background: var(--danger); color: white; border-color: var(--danger); }

/* ============================================
   ARROW MODE (Plein écran)
   ============================================ */
#arrowMode {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: var(--bg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
#arrowMode.active { display: flex; }

#closeArrowBtn {
    position: absolute;
    top: max(env(safe-area-inset-top), 20px);
    right: 20px;
    width: 50px; height: 50px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
}

#arrowSpeed {
    position: absolute;
    top: max(env(safe-area-inset-top), 20px);
    left: 20px;
    font-size: 48px;
    font-weight: 900;
    color: var(--accent);
}
#arrowSpeed::after {
    content: ' km/h';
    font-size: 14px;
    font-weight: 600;
    color: var(--text2);
}

#arrowIcon {
    font-size: 140px;
    line-height: 1;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#arrowIcon .maneuver-svg,
#arrowIcon .roundabout-svg {
    width: 160px;
    height: 160px;
}
#arrowIcon .maneuver-emoji {
    font-size: 120px;
}

#arrowDistance {
    font-size: 72px;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}
#arrowInstruction {
    font-size: 24px;
    font-weight: 700;
    margin-top: 16px;
    text-align: center;
    padding: 0 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
#arrowStreet {
    font-size: 18px;
    color: var(--text2);
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.arrow-footer {
    position: absolute;
    bottom: max(env(safe-area-inset-bottom), 30px);
    left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 600;
    color: var(--text2);
}

/* ============================================
   STATS MODAL
   ============================================ */
#statsModal {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: var(--bg);
    display: none;
    overflow-y: auto;
    padding: 20px;
    padding-top: max(env(safe-area-inset-top), 20px);
}
#statsModal.active { display: block; }

.stats-header {
    text-align: center;
    margin-bottom: 24px;
}
.stats-title { font-size: 24px; font-weight: 800; }
#statsDestination { font-size: 14px; color: var(--text2); margin-top: 4px; }

.score-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}
.score-ring {
    width: 140px; height: 140px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--score) * 3.6deg), var(--bg2) 0);
    display: flex;
    align-items: center;
    justify-content: center;
}
.score-inner {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#scoreValue { font-size: 48px; font-weight: 900; color: var(--accent); line-height: 1; }
.score-label { font-size: 12px; color: var(--text2); font-weight: 600; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg2);
    border-radius: 14px;
    padding: 14px;
}
.stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text2); }

.chart-container {
    background: var(--bg2);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    height: 180px;
}

.badges-section { margin-bottom: 20px; }
.badges-title { font-size: 14px; font-weight: 700; text-align: center; margin-bottom: 12px; }
#badgeList {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.badge {
    background: var(--bg2);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
    opacity: 0.4;
}
.badge.earned { opacity: 1; border-color: var(--accent); }
.badge-icon { font-size: 24px; }
.badge-name { font-size: 10px; font-weight: 700; display: block; margin-top: 4px; }

.stats-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: max(env(safe-area-inset-bottom), 16px);
}
.stats-actions button {
    padding: 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
#exportGpxBtn {
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    color: var(--text);
}
#closeStatsBtn {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 6px 18px rgba(10,132,255,0.35);
    border: none;
    color: white;
}
#closeStatsBtn:active { transform: scale(0.98); }

/* Bouton flottant "Vue flèches" — apparait pendant la navigation hors mode flèches */
#showArrowBtn {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 250;
    padding: 14px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(10,132,255,0.4);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}
#showArrowBtn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
#showArrowBtn:active {
    transform: translateX(-50%) translateY(0) scale(0.96);
}

/* Badge limite de vitesse (style panneau routier) */
#speedLimitBadge {
    position: fixed;
    top: 80px;
    left: 16px;
    z-index: 100;
    width: 60px;
    height: 60px;
    background: white;
    border: 5px solid #FF3B30;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #1D1D1F;
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
#speedLimitBadge.visible { display: flex; }
#speedLimitBadge.over { animation: speedPulse 0.6s ease-in-out infinite; }
@keyframes speedPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); box-shadow: 0 4px 20px rgba(255,59,48,0.6); }
}

/* Alerte incident trafic (accident, travaux, route fermée...) — Traffic Incident Details API */
#incidentBanner {
    position: fixed;
    top: 136px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--warning);
    color: white;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-2);
    max-width: 82vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#incidentBanner.visible { display: flex; }
#incidentBanner.severe { background: var(--danger); }
#incidentIcon { font-size: 16px; flex-shrink: 0; }
#incidentText { overflow: hidden; text-overflow: ellipsis; }

/* ============================================
   BARRE TRAFIC (Waze-style) — bord droit en mode flèches
   ============================================ */
#trafficBar {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 14px;
    height: 60vh;
    max-height: 480px;
    border-radius: 8px;
    background: var(--bg2);
    overflow: hidden;
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 2px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
#trafficBar.visible { display: flex; }

.traffic-seg {
    flex: 1;
    border-radius: 2px;
    transition: background 0.4s, opacity 0.4s;
}
.traffic-seg.sev-0 { background: #34C759; }   /* fluide */
.traffic-seg.sev-1 { background: #FFCC00; }   /* léger */
.traffic-seg.sev-2 { background: #FF9500; }   /* modéré */
.traffic-seg.sev-3 { background: #FF3B30; }   /* fort */
.traffic-seg.sev-4 { background: #1D1D1F; }   /* fermeture */
.traffic-seg.done  { opacity: 0.25; }         /* déjà parcouru */

/* Curseur "vous êtes ici" — se déplace verticalement selon la progression */
.traffic-cursor {
    position: absolute;
    left: -6px;
    width: 26px;
    height: 14px;
    background: var(--accent);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    transform: translateY(50%);
    transition: bottom 0.5s ease-out;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ============================================
   SIGNPOST (numéros de route + grandes directions)
   ============================================ */
#navSignpost,
#arrowSignpost {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
#navSignpost.visible,
#arrowSignpost.visible {
    display: flex;
}

#arrowSignpost {
    justify-content: center;
    margin-bottom: 16px;
    max-width: 80%;
}

.road-shield {
    background: #1565C0;
    color: white;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
#arrowSignpost .road-shield {
    font-size: 18px;
    padding: 6px 14px;
}

.signpost-dir {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
#arrowSignpost .signpost-dir {
    font-size: 22px;
}
.signpost-dir::before {
    content: '↗ ';
    color: var(--accent);
}

/* POI panel multi-catégories */
.poi-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 20px 16px max(env(safe-area-inset-bottom), 16px);
    max-height: 70vh;
    overflow-y: auto;
    display: none;
}
.poi-panel.active { display: block; }

.poi-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.poi-cat-btn {
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
}
.poi-cat-btn:active { transform: scale(0.96); }
.poi-cat-btn.selected { border-color: var(--accent); background: var(--accent); color: white; }
.poi-cat-icon { font-size: 22px; }
.poi-cat-label { font-size: 11px; font-weight: 600; margin-top: 2px; }

.poi-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg2);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
}
.poi-result:active { transform: scale(0.98); }
.poi-result-icon { font-size: 22px; }
.poi-result-text { flex: 1; min-width: 0; }
.poi-result-name { font-weight: 700; }
.poi-result-addr { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poi-result-dist { font-weight: 700; color: var(--accent); font-size: 13px; }

/* ============================================
   MARKERS
   ============================================ */
.moto-marker {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.1s linear;
}

.destination-marker {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.poi-marker {
    width: 40px; height: 40px;
    background: var(--warning);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ============================================
   TOAST
   ============================================ */
#toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 500;
    background: var(--text);
    color: var(--bg);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}
#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   LOADING
   ============================================ */
#loading {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}
#loading.active { display: flex; }

.spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--bg2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   FAVORIS
   ============================================ */
.favorites-section {
    margin-bottom: 20px;
}

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

.favorite-item {
    background: var(--bg2);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-1);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    min-height: 85px;
    display: flex;
    flex-direction: column;
}
.favorite-item:active {
    transform: scale(0.97);
}
.favorite-item.configured {
    border-color: var(--accent);
}
.favorite-item.empty {
    border-style: dashed;
    opacity: 0.7;
}

.favorite-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.favorite-name {
    font-size: 13px;
    font-weight: 700;
}

.favorite-address {
    font-size: 11px;
    color: var(--text2);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    margin-top: 2px;
    max-height: 2.6em;
}

.favorite-empty-text {
    font-size: 10px;
    color: var(--text2);
    font-style: italic;
}

.favorite-edit-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.favorite-item.configured .favorite-edit-btn {
    display: flex;
}
.favorite-item.configured:hover .favorite-edit-btn,
.favorite-item.configured:active .favorite-edit-btn {
    display: flex;
}

/* Modal édition favori */
#favoriteModal {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#favoriteModal.active {
    display: flex;
}

.favorite-modal-content {
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-3);
}

.favorite-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.favorite-modal-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorite-modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg2);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.favorite-search-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 12px;
}
.favorite-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

#favoriteSuggestions {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.favorite-modal-actions {
    display: flex;
    gap: 10px;
}
.favorite-modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#favoriteDeleteBtn {
    background: var(--danger);
    border: none;
    color: white;
}
#favoriteCancelBtn {
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    color: var(--text);
}
