/* ============================================
   Essence Ici - Style Mobile-First PWA
   Variables, Layout, Components
   ============================================ */

/* ---- Variables CSS ---- */
:root {
    /* Couleurs principales */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-secondary: #059669;
    --color-secondary-dark: #047857;
    --color-accent: #f59e0b;
    --color-accent-dark: #d97706;
    
    /* Couleurs de fond */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.3);
    --bg-bottom-sheet: #ffffff;
    
    /* Couleurs de texte */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Couleurs des carburants */
    --color-gazole: #2563eb;
    --color-sp95: #059669;
    --color-sp98: #7c3aed;
    --color-e85: #d97706;
    --color-gplc: #dc2626;
    --color-e10: #0891b2;
    
    /* Couleurs de prix */
    --price-low: #059669;
    --price-medium: #d97706;
    --price-high: #dc2626;
    --price-rupture: #94a3b8;
    
    /* Layout */
    --header-height: 56px;
    --bottom-sheet-min: 15vh;
    --bottom-sheet-max: 60vh;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    
    /* Espacement */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Bordures et ombres */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    
    /* Typographie */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-lg: 18px;
    --font-size-xl: 22px;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;
    
    /* Leaflet z-index fix */
    --z-map: 1;
    --z-header: 100;
    --z-bottom-sheet: 200;
    --z-modal: 300;
    --z-popup: 400;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ---- Header (flottant au-dessus de la carte) ---- */
.app-header {
    position: absolute;
    top: 1.5rem;
    left: 0.5rem;
    right: 0.5rem;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: var(--safe-top) var(--spacing-md) 0;
    flex-shrink: 0;
    pointer-events: none;
}

.app-header__title {
    display: none;
}

.app-header__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: auto;
    white-space: nowrap;
    z-index: 600;
    border: none;
    cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #0f172a;
    outline-offset: 2px;
}

/* Économies affichées à gauche */
.app-header__savings {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    background: #065f46;
    color: #a7f3d0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: auto;
    white-space: nowrap;
    margin-right: auto;
    z-index: 1;
}
.app-header__savings.visible {
    display: inline-flex;
}
.app-header__savings .savings-icon {
    font-size: 14px;
}
.app-header__savings .savings-amount {
    color: #fff;
}

.btn-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 3px 9px rgba(0,0,0,0.4);
    pointer-events: auto;
    flex-shrink: 0;
    z-index: 1;
}

.app-header__actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.btn-auth {
    display: none;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    background: #0f766e;
    color: #ccfbf1;
    border: 1px solid #115e59;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.1px;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 3px 9px rgba(0,0,0,0.35);
    white-space: nowrap;
}

.btn-auth:hover {
    background: #0f5f59;
    transform: translateY(-1px);
}

.btn-auth.is-authenticated {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #dbeafe;
}

.btn-settings:hover {
    background: #334155;
    transform: scale(1.05);
}

.btn-settings:active {
    background: #475569;
    transform: scale(0.95);
}

/* Loading overlay repositionné en dessous du header */
.loading-overlay {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    box-shadow: var(--shadow-md);
    display: none;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    pointer-events: none;
}

/* ---- Conteneur Carte (plein écran) ---- */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-map);
    min-height: 0;
}

.map-container .leaflet-container {
    width: 100%;
    height: 100%;
    z-index: var(--z-map);
}

/* ---- Overlay de chargement ---- */
.loading-overlay.visible {
    display: flex;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-primary-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Compteur de stations ---- */
.station-count {
    position: absolute;
    bottom: var(--spacing-sm);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--bg-card);
    border-radius: 20px;
    padding: var(--spacing-xs) var(--spacing-md);
    box-shadow: var(--shadow-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    display: none;
    white-space: nowrap;
    pointer-events: none;
}

.station-count.visible {
    display: block;
}

/* ---- Bottom Sheet (CSS scroll-snap natif) ---- */
/* Le conteneur invisible qui prend tout l'écran */
.sheet-wrapper {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    pointer-events: none;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
.sheet-wrapper::-webkit-scrollbar { display: none; }

/* L'espace vide au-dessus du panneau (point d'arrêt "Fermé") */
.sheet-spacer {
    height: calc(100vh - var(--bottom-sheet-min));
    scroll-snap-align: end;
    pointer-events: none;
}

/* Le panneau lui-même (point d'arrêt "Ouvert") */
.sheet-content {
    position: relative;
    min-height: calc(100vh - 25vh);
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    pointer-events: auto;
    scroll-snap-align: start;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Design du Header */
.sheet-header {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.sheet-handle {
    width: 40px; height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin-bottom: 10px;
}
.sheet-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* ---- Filtres ---- */
.filters {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-group__label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

.filter-group__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1.5px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.filter-chip:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.filter-chip.active {
    background: var(--color-primary);
    color: var(--text-inverse);
    border-color: var(--color-primary-dark);
}

.filter-chip .fuel-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: var(--spacing-xs);
    flex-shrink: 0;
}

.filter-chip.active .fuel-color {
    filter: brightness(1.5);
}

.filter-chip--ev.active {
    background: #1505f1;
    border-color: #0c03c4;
}

/* ---- Horaires dans la modale ---- */
.station-detail__horaires {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.station-detail__hours-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: var(--font-size-sm);
}
.station-detail__hours-row:last-child {
    border-bottom: none;
}
.station-detail__hours-day {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}
.station-detail__hours-open {
    color: var(--color-secondary);
    font-weight: var(--font-weight-medium);
}
.station-detail__hours-closed {
    color: var(--color-highlight, #dc2626);
    font-weight: var(--font-weight-medium);
}

/* ---- En-tête de section dans la liste ---- */
.station-list-section {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-xs);
    margin-top: var(--spacing-sm);
    border-top: 1px solid var(--bg-body);
}
.station-list-section:first-child {
    margin-top: 0;
    border-top: none;
}

/* ---- Accordéon "Plus de filtres" ---- */
.filter-more-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-xs);
    background: none;
    border: none;
    border-top: 1px solid #f1f5f9;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-align: left;
    transition: color 0.15s;
    margin-top: var(--spacing-xs);
}
.filter-more-toggle:hover { color: var(--color-primary); }

.filter-more-toggle__label { flex: 1; }

.filter-more-toggle__badge {
    display: none;
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.filter-more-toggle__badge.visible {
    display: inline-flex;
}

.filter-more-toggle__chevron {
    transition: transform 0.25s;
    flex-shrink: 0;
    color: var(--text-muted);
}
.filter-more-toggle.open .filter-more-toggle__chevron {
    transform: rotate(180deg);
}
.filter-more-toggle.open {
    color: var(--color-primary);
    border-color: var(--color-primary-light);
}

.filter-more-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.32s ease;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}
.filter-more-body.open {
    max-height: 1200px;
}

/* ---- Fourchette de prix ---- */
.price-range-row {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-sm);
}
.price-range-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.price-range-field__label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}
.price-range-field__input {
    width: 100%;
    padding: 7px var(--spacing-sm);
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    transition: border-color 0.15s, background 0.15s;
    appearance: textfield;
    -moz-appearance: textfield;
}
.price-range-field__input::-webkit-outer-spin-button,
.price-range-field__input::-webkit-inner-spin-button { -webkit-appearance: none; }
.price-range-field__input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}
.price-range-sep {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    padding-bottom: 8px;
    flex-shrink: 0;
}

/* ---- Range Slider ---- */
.range-input {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--color-primary-light);
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--bg-card);
}

.range-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--bg-card);
}

.range-value {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    text-align: center;
}

/* ---- Liste des stations (dans bottom sheet) ---- */
.station-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.station-item {
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.station-item:hover {
    background: var(--color-primary-light);
}

.station-item:active {
    background: #bfdbfe;
}

.station-item:focus-visible {
    outline: 3px solid #1e293b;
    outline-offset: 2px;
    background: #dbeafe;
}

.station-item__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.station-item__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    line-height: 1.3;
}

.station-item__city {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.station-item__prices {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.price-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
}

.price-tag .fuel {
    font-weight: var(--font-weight-normal);
    opacity: 0.7;
    margin-right: 2px;
}

.price-tag--gazole { background: #dbeafe; color: #1e40af; }
.price-tag--sp95 { background: #d1fae5; color: #065f46; }
.price-tag--sp98 { background: #ede9fe; color: #5b21b6; }
.price-tag--e85 { background: #fef3c7; color: #92400e; }
.price-tag--gplc { background: #fee2e2; color: #991b1b; }
.price-tag--e10 { background: #cffafe; color: #155e75; }

.price-tag--rupture {
    background: #f1f5f9;
    color: var(--text-muted);
    text-decoration: line-through;
    font-style: italic;
}

/* ---- Marqueurs personnalisés Leaflet ---- */
/* Style moderne : cercle bordé blanc + pointe triangulaire */
.station-marker-wrapper {
    background: none !important;
    border: none !important;
}

.station-marker {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.station-marker:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    z-index: 10000 !important;
}

.leaflet-marker-icon.station-marker-wrapper:focus .station-marker,
.leaflet-marker-icon.monument-marker-wrapper:focus .monument-icon__img {
    outline: 3px solid #0f172a00;
    outline-offset: 2px;
}

/* Le cercle principal */
.station-marker__circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    overflow: hidden;
}

/* La pointe triangulaire */
.station-marker__tip {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 8px solid #fff;
    z-index: 1;
}

/* Pointe de couleur (même que le cercle) */
.station-marker__tip-color {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    z-index: 1;
}

/* Logo à l'intérieur du cercle */
.station-marker__logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: contain;
    background: #fff;
    padding: 2px;
    display: block;
}

/* Texte carburant (fallback si pas de logo) */
.station-marker__text {
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    line-height: 1;
    text-align: center;
}

/* Badge Top 3 */
.station-marker__badge {
    position: absolute;
    z-index: 3;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.station-marker__badge--1 {
    background: #f59e0b;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    font-size: 11px;
    border-width: 2.5px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
}
.station-marker__badge--2 {
    background: #94a3b8;
    top: -6px;
    left: -6px;
}
.station-marker__badge--3 {
    background: #d97706;
    top: -6px;
    right: -6px;
}

/* Taille réduite pour les stations normales */
.station-marker--normal .station-marker__circle {
    width: 32px;
    height: 32px;
}

/* ---- Bornes IRVE (marqueurs ronds unifiés) ---- */
.charging-marker__pin {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    border: 3px solid #fff;
    position: relative;
}

.station-marker__power {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #0f172a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    line-height: 1;
}
.station-marker--normal .station-marker__logo {
    width: 20px;
    height: 20px;
}
.station-marker--normal .station-marker__text {
    font-size: 9px;
}
.station-marker--normal {
    width: 38px;
    height: 38px;
}

/* Taille Top 3 */
.station-marker--top .station-marker__circle {
    width: 40px;
    height: 40px;
    border-width: 3px;
}
.station-marker--top .station-marker__logo {
    width: 26px;
    height: 26px;
}
.station-marker--top {
    width: 48px;
    height: 48px;
}
.station-marker--top .station-marker__tip {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 9px solid #fff;
}
.station-marker--top .station-marker__tip-color {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid currentColor;
}

/* Fond de cercle par type de carburant */
.station-marker--gazole { color: var(--color-gazole); }
.station-marker--sp95 { color: var(--color-sp95); }
.station-marker--sp98 { color: var(--color-sp98); }
.station-marker--e85 { color: var(--color-e85); }
.station-marker--gplc { color: var(--color-gplc); }
.station-marker--e10 { color: var(--color-e10); }
.station-marker--default { color: #6b7280; }

.station-marker--gazole .station-marker__circle { background: var(--color-gazole); }
.station-marker--sp95 .station-marker__circle { background: var(--color-sp95); }
.station-marker--sp98 .station-marker__circle { background: var(--color-sp98); }
.station-marker--e85 .station-marker__circle { background: var(--color-e85); }
.station-marker--gplc .station-marker__circle { background: var(--color-gplc); }
.station-marker--e10 .station-marker__circle { background: var(--color-e10); }
.station-marker--default .station-marker__circle { background: #6b7280; }

/* Bornes IRVE — couleurs par classe de puissance */
.station-marker--ev-ultra   { color: #dc2626; }
.station-marker--ev-fast    { color: #d97706; }
.station-marker--ev-semi    { color: #0891b2; }
.station-marker--ev-slow    { color: #059669; }
.station-marker--ev-unknown { color: #2563eb; }
.station-marker--ev-ultra   .station-marker__circle { background: #dc2626; }
.station-marker--ev-fast    .station-marker__circle { background: #d97706; }
.station-marker--ev-semi    .station-marker__circle { background: #0891b2; }
.station-marker--ev-slow    .station-marker__circle { background: #059669; }
.station-marker--ev-unknown .station-marker__circle { background: #2563eb; }

/* ---- Popup Leaflet ---- */
.station-popup {
    font-family: var(--font-family);
    min-width: 200px;
}

.station-popup__address {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-bottom: 2px;
}

.station-popup__city {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.station-popup__prices {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.station-popup__price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    padding: 2px 0;
}

.station-popup__price-row .fuel {
    color: var(--text-secondary);
}

.station-popup__price-row .price {
    font-weight: var(--font-weight-bold);
}

.station-popup__price-row .price.rupture {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ---- Bouton CTA "Plus d'infos" dans la popup ---- */
.station-popup__more {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.station-popup__more:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.station-popup__more:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* ---- Geolocation error toast ---- */
.toast {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    display: none;
    align-items: center;
    gap: var(--spacing-sm);
    border-left: 4px solid var(--color-accent);
    max-width: calc(100% - var(--spacing-xl));
    pointer-events: auto;
}

.toast.visible {
    display: flex;
}

.toast__icon {
    font-size: 18px;
}

.toast__message {
    flex: 1;
}

.toast__close {
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
}

/* ---- Modale (ex: paramètres) ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    background: var(--bg-overlay);
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 768px) {
    .modal-content {
        max-width: 480px;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-md);
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.modal-close {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 var(--spacing-lg) var(--spacing-md);
}

/* ---- Pied de modale avec bouton valider ---- */
.modal-footer {
    padding: var(--spacing-md) var(--spacing-lg) calc(var(--spacing-md) + var(--safe-bottom));
    background: var(--bg-card);
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.btn-validate {
    display: block;
    width: 100%;
    padding: 14px var(--spacing-md);
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-align: center;
}
.btn-validate:hover  { background: var(--color-primary-dark); }
.btn-validate:active { transform: scale(0.98); }

/* ---- Carrousel de type de véhicule ---- */
.car-carousel {
    position: relative;
    margin-top: var(--spacing-xs);
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.car-carousel__viewport {
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-body);
    border: 1.5px solid #e2e8f0;
}

.car-carousel__track {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.car-carousel__slide {
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
    gap: var(--spacing-sm);
    cursor: pointer;
}

.car-carousel__slide:active {
    background: rgba(0,0,0,0.02);
}

.car-carousel__img {
    width: 320px;
    object-fit: contain;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.car-carousel__slide:hover .car-carousel__img {
    transform: scale(1.05);
}

.car-carousel__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.car-carousel__label {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.car-carousel__specs {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.station-detail__logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 4px;
    object-fit: contain;
}

/* Arrondir les logos des stations dans la liste */
.station-logo-wrapper img {
    border-radius: 50%;
    object-fit: contain;
}

.station-detail__title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
}

.station-detail__address {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.station-detail__section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid #f1f5f9;
}

.station-detail__section-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.station-detail__row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.station-detail__row strong {
    color: var(--text-primary);
}

.station-detail__price {
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

.station-detail__rupture {
    color: var(--price-rupture);
    text-decoration: line-through;
}

.station-detail__services {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.station-detail__highlight {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.station-detail__highlight-value {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-secondary);
}

/* Flèches de navigation — cachées sur mobile, visibles sur tablette+ */
.car-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1.5px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
    line-height: 1;
}

.car-carousel__arrow:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.car-carousel__arrow--left {
    left: 6px;
}

.car-carousel__arrow--right {
    right: 6px;
}

@media (min-width: 768px) {
    .car-carousel__arrow {
        display: flex;
    }
}

.car-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: var(--spacing-sm);
}

.car-carousel__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.25s;
}

.car-carousel__dot.active {
    background: var(--color-primary);
    width: 24px;
    border-radius: 4px;
}

.car-carousel__dot:hover {
    background: var(--color-primary-light);
}

/* ---- Paramètres ---- */
.setting-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.setting-item__label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

.setting-item__input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1.5px solid var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-body);
    transition: border-color 0.2s;
}

.setting-item__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.setting-item__help {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.profile-summary {
    display: block;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.profile-feedback__text {
    min-height: 110px;
    resize: vertical;
}

/* ---- Responsive (Tablette+) ---- */
@media (min-width: 768px) {
    .app-header {
        top: 2rem;
        gap: var(--spacing-md);
    }
    .app-header__brand {
        padding: 8px 20px;
        font-size: var(--font-size-base);
    }
    .app-header__savings {
        padding: 6px 16px;
        font-size: var(--font-size-base);
    }
}

/* ---- Section Itinéraire ---- */
.route-section {
    margin-bottom: var(--spacing-md);
}

.route-inputs {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.route-input-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 2px;
    border: 1.5px solid #e2e8f0;
    transition: border-color 0.2s;
}

.route-input-group:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.route-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: var(--font-weight-bold);
    color: var(--text-inverse);
    flex-shrink: 0;
    margin-left: var(--spacing-xs);
}

.route-input-icon--depart {
    background: var(--color-secondary);
}

.route-input-icon--arrivee {
    background: var(--color-accent);
}

.route-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--spacing-sm) 0;
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

.route-input::placeholder {
    color: var(--text-muted);
}

.route-input[readonly] {
    color: var(--text-secondary);
    cursor: default;
}

.route-input-geoloc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
    background: var(--color-primary-light);
    transition: background 0.2s;
}

.route-input-geoloc:hover {
    background: #bfdbfe;
}

.route-input-geoloc:active {
    background: #93c5fd;
}

.route-input-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: var(--spacing-xs);
}

.route-input-clear:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

/* ---- Autocomplétion Photon ---- */
.autocomplete-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 10;
    position: relative;
}

.autocomplete-list.visible {
    display: block;
}

.autocomplete-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--color-primary-light);
}

.autocomplete-item__name {
    font-weight: var(--font-weight-medium);
}

.autocomplete-item__detail {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    background: var(--color-primary);
    color: var(--text-inverse);
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

.route-btn:hover {
    background: var(--color-primary-dark);
}

.route-btn:active {
    background: #1e40af;
}

.route-btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid #e2e8f0;
    margin-top: var(--spacing-xs);
}

.route-btn--secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

.route-btn svg {
    flex-shrink: 0;
}

/* ---- Séparateur ---- */
.section-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: var(--spacing-md) 0;
}

/* ---- Badges de services ---- */
.service-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: var(--font-weight-medium);
    background: #f1f5f9;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ---- Modale Pages Légales ---- */
.legal-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.legal-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-body);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.legal-link-item:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.legal-link-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: var(--spacing-sm);
}

.legal-link-text {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.legal-link-arrow {
    font-size: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.legal-link-item:hover .legal-link-arrow {
    transform: translateX(4px);
    color: var(--color-primary);
}

.service-badge--24h {
    background: #dbeafe;
    color: #1e40af;
}

.service-badge--wc {
    background: #d1fae5;
    color: #065f46;
}

.service-badge--lavage {
    background: #fef3c7;
    color: #92400e;
}

.service-badge--restaurant {
    background: #ede9fe;
    color: #5b21b6;
}

.service-badge--carburant {
    background: #fce7f3;
    color: #9d174d;
}

/* ---- Top 3 Smart Sort ---- */
.station-item--top1 {
    border-left-color: #f59e0b !important;
    background: #fffbeb !important;
}

.station-item--top2 {
    border-left-color: #94a3b8 !important;
    background: #f8fafc !important;
}

.station-item--top3 {
    border-left-color: #d97706 !important;
    background: #fff7ed !important;
}

.station-item__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    color: var(--text-inverse);
    flex-shrink: 0;
}

.station-item__rank--1 { background: #f59e0b; }
.station-item__rank--2 { background: #94a3b8; }
.station-item__rank--3 { background: #d97706; }

.station-item__detour {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.station-item__score {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin-top: 2px;
}

/* ---- Polyligne itinéraire ---- */
.route-polyline {
    stroke: var(--color-primary) !important;
    stroke-width: 4 !important;
    stroke-opacity: 0.8 !important;
}

/* ---- Monuments (icônes de grandes villes) ---- */
.monument-marker-wrapper {
    background: none !important;
    border: none !important;
}

.monument-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    filter: drop-shadow(6px 8px 4px rgba(0,0,0,0.35));
}

.monument-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(6px 8px 6px rgba(0,0,0,0.5));
}

.monument-icon__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* ---- Print ---- */
@media print {
    .app-header,
    .bottom-sheet,
    .loading-overlay,
    .station-count,
    .toast {
        display: none !important;
    }

    .map-container {
        height: 100vh;
    }
}
