body, html {
    margin: 0; padding: 0;
    height: 100dvh; width: 100%;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

.layout {
    display: flex;
    height: 100dvh;
    width: 100vw;
}

/* === LE PANNEAU LATÉRAL === */
.sidebar {
    width: 320px;
    background-color: #ffffff;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    background-color: #0f172a;
    color: white;
    padding: 20px;
}

.sidebar-header h1 {
    margin: 0 0 5px 0;
    font-size: 20px;
}

.sidebar-header p {
    margin: 0;
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-content h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #1e293b;
}

.indication {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 15px;
}

/* === LES BOUTONS LIGNES === */
.lignes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ligne-btn {
    border: 2px solid;
    background-color: transparent;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ligne-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* === LA CARTE === */
.map-container {
    flex-grow: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

.menu-toggle {
    display: none; /* Caché sur PC */
    position: absolute;
    top: 15px; left: 15px;
    z-index: 1000;
    background: white;
    border: 2px solid #cbd5e1;
    padding: 10px 15px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* === POPUPS ET ANIMATION === */
.bus-icon {
    font-size: 26px;
    text-align: center;
    line-height: 30px;
    filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.4));
}

/* === POPUPS MAPLIBRE === */
.maplibregl-popup-content {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 15px;
}

.maplibregl-popup-content b {
    color: #0f172a;
}

/* Le style de la barre de catégorie */
.categorie-header {
    display: flex;
    justify-content: space-between; /* Titre à gauche, flèche à droite */
    align-items: center;
    cursor: pointer;
    padding: 12px 0;
    margin-top: 10px;
    border-bottom: 2px solid #e2e8f0;
    user-select: none; /* Empêche le texte d'être surligné si on clique vite */
}

.categorie-header h4 {
    color: #334155;
}

/* La petite flèche animée */
.categorie-fleche {
    font-size: 14px;
    color: #64748b;
    transition: transform 0.3s ease; /* L'animation de rotation qui fait "pro" */
}

/* La grille des boutons quand elle est ouverte */
.sous-grille-boutons {
    display: flex; /* Ne pas mettre 'none' ici, le JavaScript s'en occupe */
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 15px;
    padding-bottom: 15px;
}

/* Style pour les pastilles de lignes TEOR (T1, T2...) */
.line-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; /* Un peu plus large pour les noms à 2-3 caractères */
    height: 32px;
    border-radius: 50%;
    color: white;
    font-weight: 800; /* Texte bien épais */
    font-size: 10px;  /* Taille adaptée pour F3, 41, etc. */
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    text-align: center;
    line-height: 1;
}

.bus-icon {
    font-size: 22px;
    cursor: pointer;
}

/* === PLANIFICATEUR D'ITINÉRAIRE === */
.input-it {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.boutons-mode {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.btn-mode {
    flex: 1;
    padding: 8px;
    font-size: 18px;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mode:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
}

/* === LE PANNEAU DE DROITE (INFO-TRAFIC - VERSION BLINDÉE MOBILE) === */
#sidebar-right {
    position: fixed !important;
    top: 0;
    right: 0 !important;
    left: auto !important; /* Annule l'ancrage à gauche du menu classique */
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background-color: #ffffff;
    z-index: 2000;
    /* 🚨 L'ÉLÉMENT CLÉ : On le force à sortir par la DROITE (+100%) */
    transform: translateX(100%) !important; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid #cbd5e1;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Quand on l'ouvre, on le force à revenir à sa place */
#sidebar-right.ouverte {
    transform: translateX(0) !important;
}

/* Pour que la liste des 52 alertes puisse défiler proprement */
.sidebar-right .sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Le bouton en haut à droite */
.menu-toggle-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #cbd5e1;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-toggle-right:hover {
    background: #f8fafc;
}

/* === BOUTON DE GÉOLOCALISATION === */
.btn-geoloc {
    position: absolute;
    bottom: 30px; 
    right: 20px;
    z-index: 1000; /* Pour passer au-dessus de la carte */
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 50%; /* Bouton tout rond */
    width: 50px;
    height: 50px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-geoloc:hover, .btn-geoloc:active {
    background-color: #f8fafc;
    transform: scale(1.05); /* Petit effet de grossissement */
}

/* Le style du point bleu de l'utilisateur sur la carte */
.user-icon {
    font-size: 20px;
    text-align: center;
    line-height: 20px;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.5));
}

/* === RESPONSIVE (TÉLÉPHONES) === */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        left: -350px; /* On cache le menu hors de l'écran sans utiliser transform */
        transition: left 0.3s ease;
        transform: none !important; /* 🚨 LA MAGIE OPÈRE ICI : Libère la carte itinéraire ! */
    }
    
    .sidebar.ouverte {
        left: 0; /* Fait glisser le menu à l'écran */
    }

    .sidebar-content {
        padding-bottom: 380px; /* Ajoute du vide en bas de la liste pour qu'elle ne soit pas cachée par la carte itinéraire */
    }

    .menu-toggle {
        display: block; /* On affiche le bouton Menu */
    }
}

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

.sidebar-header h1 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    display: none; /* Caché sur PC car le menu est toujours ouvert */
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close-btn {
        display: block; /* On affiche la croix sur téléphone */
    }

/* =========================================
   📱 MODE MOBILE EXCLUSIF (Android & iOS)
   ========================================= */
@media screen and (max-width: 768px) {
    
    /* 1. On détache la boîte et on la fait flotter en bas */
    #carte-itineraire-mobile {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        
        /* Les beaux bords arrondis style Apple Maps / Citymapper */
        border-top-left-radius: 25px;
        border-top-right-radius: 25px;
        
        /* L'ombre pour l'effet de flottaison au-dessus de la carte */
        box-shadow: 0px -4px 20px rgba(0, 0, 0, 0.15);
        
        padding: 20px;
        box-sizing: border-box;
        z-index: 1000; /* Toujours au-dessus de la carte */
        
        /* Transition douce si tu veux l'animer plus tard */
        transition: transform 0.3s ease-out;
    }

    /* 2. On rend les boutons plus larges et cliquables pour les pouces */
    #carte-itineraire-mobile input {
        width: 100%;
        padding: 12px;
        margin-bottom: 10px;
        font-size: 16px; /* Empêche le zoom auto énervant sur iOS */
        border-radius: 10px;
        border: 1px solid #cbd5e1;
    }

    #carte-itineraire-mobile button {
        padding: 12px;
        border-radius: 10px;
        flex: 1; /* Les boutons prennent toute la largeur disponible */
        font-size: 14px;
        font-weight: bold;
    }

    /* 3. On remonte un peu les logos Mapbox/MapLibre pour ne pas les cacher */
    .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right {
        bottom: 300px !important; /* Ajuste cette valeur selon la hauteur de ta carte flotante */
    }

    /* 🚨 LA MAGIE ICI : On cache la carte itinéraire quand le menu s'ouvre */
    .sidebar.ouverte #carte-itineraire-mobile {
        transform: translateY(150%); /* Fait glisser la boîte vers le bas hors de l'écran */
    }
}