/* ─── carte-interactive.css ──────────────────────────────────────────────────
   Carte temps réel du réseau Ginko — ARCTB
   Thème : Transport urbain — nuit urbaine, accents vifs
   ─────────────────────────────────────────────────────────────────────────── */

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

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --ci-bg-deep:        #0d1117;
    --ci-bg-surface:     #161b22;
    --ci-bg-panel:       #1c2333;
    --ci-bg-panel-glass: rgba(22, 27, 34, 0.92);
    --ci-accent:         #4d9fff;
    --ci-accent-glow:    rgba(77, 159, 255, 0.25);
    --ci-text-primary:   #e6edf3;
    --ci-text-secondary: #8b949e;
    --ci-border:         rgba(255, 255, 255, 0.08);
    --ci-radius:         12px;
    --ci-radius-sm:      8px;
    --ci-shadow:         0 8px 32px rgba(0, 0, 0, 0.5);
    --ci-font-display:   'Barlow Condensed', sans-serif;
    --ci-font-body:      'Barlow', sans-serif;
    --ci-map-height:     520px;
    --ci-panel-width:    320px;
}

/* ─── Section ────────────────────────────────────────────────────────────────── */
.CarteInteractive--Section {
    background: var(--ci-bg-deep);
    padding: 72px 0 0;
    font-family: var(--ci-font-body);
    color: var(--ci-text-primary);
    overflow: hidden;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.CarteInteractive--Header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px 40px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.CarteInteractive--Eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--ci-font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ci-accent);
    margin-bottom: 10px;
}

.CarteInteractive--Eyebrow::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ci-accent);
    box-shadow: 0 0 8px var(--ci-accent), 0 0 16px var(--ci-accent-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.8); }
}

.CarteInteractive--Title {
    font-family: var(--ci-font-display);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ci-text-primary);
    margin-bottom: 10px;
}

.CarteInteractive--Subtitle {
    font-size: 15px;
    color: var(--ci-text-secondary);
    line-height: 1.5;
}

/* ─── Contrôles ──────────────────────────────────────────────────────────────── */
.CarteInteractive--Controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.MapControl--Btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--ci-bg-surface);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-sm);
    color: var(--ci-text-secondary);
    font-family: var(--ci-font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.MapControl--Btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.MapControl--Btn:hover {
    background: var(--ci-bg-panel);
    color: var(--ci-text-primary);
    border-color: var(--ci-accent);
}

.MapControl--Btn.active {
    background: var(--ci-accent-glow);
    border-color: var(--ci-accent);
    color: var(--ci-accent);
}

/* ─── Wrapper carte ──────────────────────────────────────────────────────────── */
.CarteInteractive--Wrapper {
    position: relative;
    width: 100%;
    height: var(--ci-map-height);
}

/* ─── Carte Leaflet ──────────────────────────────────────────────────────────── */
#carte-ginko {
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Override Leaflet pour s'intégrer au thème sombre */
.leaflet-container {
    font-family: var(--ci-font-body) !important;
    background: var(--ci-bg-deep);
}

.leaflet-control-zoom a {
    background: var(--ci-bg-panel) !important;
    color: var(--ci-text-primary) !important;
    border-color: var(--ci-border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--ci-bg-surface) !important;
}

.leaflet-attribution-flag { display: none !important; }

.leaflet-control-attribution {
    background: rgba(13, 17, 23, 0.7) !important;
    color: var(--ci-text-secondary) !important;
    font-size: 10px;
}

.leaflet-control-attribution a { color: var(--ci-accent) !important; }

/* ─── Icônes véhicules ───────────────────────────────────────────────────────── */
.vehicle-icon {
    cursor: pointer;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
    transition: filter 0.2s ease;
}

.vehicle-icon--selected {
    filter: drop-shadow(0 4px 16px rgba(77, 159, 255, 0.6));
    z-index: 9999 !important;
}

/* ─── Marqueurs d'arrêts ─────────────────────────────────────────────────────── */
.stop-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--ci-accent);
    box-sizing: border-box;
}

.leaflet-tooltip {
    background: var(--ci-bg-panel) !important;
    color: var(--ci-text-primary) !important;
    border-color: var(--ci-border) !important;
    border-radius: var(--ci-radius-sm) !important;
    font-family: var(--ci-font-body) !important;
    font-size: 12px !important;
    box-shadow: var(--ci-shadow) !important;
}

/* ─── Panneau véhicule ────────────────────────────────────────────────────────── */
.VehiclePanel {
    position: absolute;
    top: 16px;
    left: 16px;
    width: var(--ci-panel-width);
    background: var(--ci-bg-panel-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    padding: 20px;
    z-index: 1000;
    color: var(--ci-text-primary);
    box-shadow: var(--ci-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    pointer-events: none;
}

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

.VehiclePanel--Close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--ci-bg-surface);
    border: 1px solid var(--ci-border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: var(--ci-text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.VehiclePanel--Close:hover {
    color: var(--ci-text-primary);
    background: var(--ci-bg-panel);
    border-color: var(--ci-accent);
}

.VehiclePanel--LineBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-family: var(--ci-font-display);
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.VehiclePanel--VehicleType {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ci-text-secondary);
    margin-bottom: 2px;
}

.VehiclePanel--VehicleId {
    font-family: var(--ci-font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--ci-text-primary);
}

.VehiclePanel--Direction {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--ci-radius-sm);
    border: 1px solid var(--ci-border);
}

.VehiclePanel--Direction svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--ci-accent);
    margin-top: 1px;
}

.VehiclePanel--DirectionLabel {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ci-text-secondary);
    margin-bottom: 3px;
}

.VehiclePanel--DirectionValue {
    font-size: 14px;
    font-weight: 600;
    color: var(--ci-text-primary);
    line-height: 1.3;
}

.VehiclePanel--NextStop {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.VehiclePanel--NextStopHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.VehiclePanel--NextStopHeader span:first-child {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ci-text-secondary);
}

.VehiclePanel--NextStopTime {
    font-size: 12px;
    font-weight: 600;
    color: var(--ci-accent);
    background: var(--ci-accent-glow);
    padding: 2px 8px;
    border-radius: 20px;
}

.VehiclePanel--NextStopName {
    font-family: var(--ci-font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ci-text-primary);
}

.VehiclePanel--ProgressBar {
    height: 4px;
    background: var(--ci-border);
    border-radius: 2px;
    overflow: hidden;
}

.VehiclePanel--Progress {
    height: 100%;
    background: linear-gradient(90deg, var(--ci-accent), #7dc5ff);
    border-radius: 2px;
    transition: width 1s ease;
}

/* ─── Affluence ─────────────────────────────────────────────────────────────── */
.VehiclePanel--Affluence {
    display: flex;
    align-items: center;
    gap: 10px;
}

.VehiclePanel--AffluenceLabel {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ci-text-secondary);
    flex-shrink: 0;
}

.VehiclePanel--AffluenceDots {
    display: flex;
    gap: 4px;
}

.VehiclePanel--AffluenceDots .dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ci-border);
    border: 1px solid rgba(255,255,255,0.1);
}

.VehiclePanel--AffluenceDots .dot.filled {
    background: var(--ci-accent);
    border-color: var(--ci-accent);
    box-shadow: 0 0 6px var(--ci-accent-glow);
}

.VehiclePanel--AffluenceText {
    font-size: 13px;
    font-weight: 500;
    color: var(--ci-text-secondary);
}

/* ─── Détail des arrêts ──────────────────────────────────────────────────────── */
.VehiclePanel--StopsDetail {
    border-top: 1px solid var(--ci-border);
    padding-top: 12px;
}

.VehiclePanel--StopsDetail summary {
    font-size: 12px;
    font-weight: 600;
    color: var(--ci-text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.VehiclePanel--StopsDetail summary::after {
    content: '▸';
    font-size: 10px;
    transition: transform 0.2s;
}

.VehiclePanel--StopsDetail[open] summary::after {
    transform: rotate(90deg);
}

.VehiclePanel--StopsDetail summary:hover { color: var(--ci-text-primary); }

.VehiclePanel--StopsList {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.VehiclePanel--StopsList::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--ci-border);
}

.VehiclePanel--StopsList li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--ci-text-secondary);
    position: relative;
}

.VehiclePanel--StopsList li.next {
    color: var(--ci-text-primary);
    font-weight: 600;
}

.stop-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--ci-bg-panel);
    border: 2px solid var(--ci-text-secondary);
    flex-shrink: 0;
    z-index: 1;
    transition: all 0.2s;
}

.VehiclePanel--StopsList li.next .stop-dot {
    background: var(--ci-accent);
    border-color: var(--ci-accent);
    box-shadow: 0 0 8px var(--ci-accent-glow);
}

/* ─── Lien fiche technique ───────────────────────────────────────────────────── */
.VehiclePanel--MoreLink {
    display: block;
    text-align: center;
    padding: 9px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-sm);
    color: var(--ci-text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.VehiclePanel--MoreLink:hover {
    background: var(--ci-accent-glow);
    border-color: var(--ci-accent);
    color: var(--ci-accent);
}

/* ─── Légende ────────────────────────────────────────────────────────────────── */
.MapLegend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--ci-bg-panel-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    padding: 12px 14px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 220px;
    overflow-y: auto;
}

.MapLegend--Item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.MapLegend--Dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-family: var(--ci-font-display);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.MapLegend--Name {
    font-size: 12px;
    color: var(--ci-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ─── Loader ────────────────────────────────────────────────────────────────── */
.MapLoader {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--ci-text-secondary);
    font-size: 14px;
    font-family: var(--ci-font-body);
}

.MapLoader--Spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ci-border);
    border-top-color: var(--ci-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --ci-map-height: 400px;
        --ci-panel-width: calc(100vw - 32px);
    }

    .CarteInteractive--Header {
        padding: 0 16px 28px;
        flex-direction: column;
        align-items: flex-start;
    }

    .CarteInteractive--Controls {
        flex-wrap: wrap;
    }

    .MapControl--Btn span {
        display: none;
    }

    .VehiclePanel {
        top: auto;
        bottom: 16px;
        left: 16px;
        transform: translateY(calc(100% + 24px));
    }

    .VehiclePanel.is-open {
        transform: translateY(0);
    }

    .MapLegend {
        display: none;
    }
}
