html, body {
    overflow-x: hidden;
    height: 100%;
    margin: 0;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#map {
    flex: 1 1 auto;
    width: 100%;
    min-height: 300px;
}

/* En-tête : grille à 3 colonnes symétriques (langue | titre | nav) en desktop, empilée sur mobile.
   La grille garantit un centrage réel du titre, même si langue et nav n'ont pas la même largeur. */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px 30px;
    flex: 0 0 auto;
}

/* Sélecteur de langue : intégré dans la barre en desktop */
#lang-switcher {
    justify-self: start;
    display: flex;
    background: white;
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    overflow: hidden;
}

.lang-btn {
    border: none;
    background: none;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: bold;
    color: #777;
    cursor: pointer;
}

.lang-btn:hover {
    background: #f0f0f0;
}

.lang-btn.active {
    background: #74C15A;
    color: white;
}

.header-title-block {
    justify-self: center;
    text-align: center;
    min-width: 0;
}

h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 26px;
    margin: 0;
    flex-wrap: wrap;
}

.logo {
    height: 1.8em;
    width: auto;
    display: block;
}

.tagline {
    text-align: center;
    margin: 2px 0 0;
    color: #555;
    font-size: 13px;
}

/* Navigation desktop : liens directs vers le panneau d'info */
#desktop-nav {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 2px;
}

.info-nav-trigger {
    border: none;
    background: none;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: bold;
    color: #444;
    cursor: pointer;
    border-radius: 20px;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.info-nav-trigger:hover {
    background: rgba(116, 193, 90, 0.1);
    color: #74C15A;
}

/* Menu burger : masqué en desktop, réservé au mobile */
#menu-button {
    display: none;
}

@media (max-width: 1024px) {

    .header {
        display: flex;
        flex-direction: column;
        text-align: center;
        /* Réserve l'espace des boutons flottants (langue + menu) au-dessus du titre,
           pour que le texte passe toujours SOUS eux plutôt qu'à côté */
        padding: 56px 15px 10px;
    }

    #lang-switcher {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1000;
        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }

    .lang-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    h1 {
        font-size: 21px;
    }

    .tagline {
        font-size: 12px;
    }

    /* La navigation desktop cède la place au menu burger */
    #desktop-nav {
        display: none;
    }

    #menu-button {
        display: block;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 1000;

        width: 45px;
        height: 45px;

        border: none;
        border-radius: 50%;
        background: white;
        font-size: 26px;
        cursor: pointer;

        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }
}

.subtitle {
    text-align: center;
}

/* Jeu de mots Map + (p)étanque dans le titre */
.brand-map {
    font-style: italic;
    font-weight: 900;
    color: #74C15A;
}

/* Bouton de localisation */
#locateBtn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px auto;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background-color: #74C15A;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

#locateBtn .btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

#locateBtn:hover {
    background-color: #56A03D;
}

/* Barre de contrôles : bouton localiser + recherche d'adresse */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin: 10px auto;
    padding: 0 15px;
}

.controls #locateBtn {
    margin: 0;
}

.search-form {
    display: flex;
    gap: 6px;
}

.search-form input {
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 15px;
    width: 240px;
    max-width: 60vw;
}

.search-form input:focus {
    outline: none;
    border-color: #74C15A;
}

.search-form button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    background-color: #74C15A;
    color: white;
    cursor: pointer;
}

.search-form button svg {
    width: 18px;
    height: 18px;
}

.search-form button:hover {
    background-color: #56A03D;
}

.search-error {
    text-align: center;
    color: #c62828;
    font-size: 14px;
    margin: 0 0 8px;
    min-height: 18px;
    flex: 0 0 auto;
}

@media (max-width: 600px) {
    .search-form input {
        width: 180px;
        max-width: 55vw;
    }
}

/* Panneau de partage (modal centré) */
#share-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1400;
}

#share-overlay.visible {
    display: block;
}

#share-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1450;

    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 25px;
    width: 300px;
    max-width: 85vw;
}

#share-panel.open {
    display: block;
}

#share-close {
    float: right;
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.share-title {
    font-weight: bold;
    font-size: 16px;
    margin: 0 0 18px;
    clear: both;
    padding-top: 4px;
}

.share-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.share-link:hover {
    background: #f0f4f9;
}

.share-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    color: #555;
}

.share-icon svg {
    width: 18px;
    height: 18px;
}

/* Liens dans les popups de terrain (itinéraire, partager) :
   seul le texte est souligné, pas l'icône ni l'espace qui le sépare du texte */
.leaflet-popup-content a {
    text-decoration: none;
}

.popup-link-text {
    text-decoration: underline;
}

/* Icônes SVG dans les popups de terrain (accès, distance, itinéraire, partager) */
.popup-icon,
.popup-link-icon {
    display: inline-flex;
    vertical-align: middle;
    color: #666;
}

.popup-icon svg,
.popup-link-icon svg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.popup-link-icon {
    color: #74C15A;
}

/* Marqueur de position utilisateur */
.user-location {
    background: transparent;
    border: none;
}

.user-location div {
    width: 18px;
    height: 18px;
    background: #1976d2;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

/* Menu latéral */
#side-menu {
    position: fixed;
    top: 0;
    right: -300px;

    width: 280px;
    height: 100%;
    box-sizing: border-box;

    background: white;
    z-index: 1200;

    padding: 25px;

    transition: right 0.3s ease;

    box-shadow: -3px 0 10px rgba(0,0,0,0.2);
}

#side-menu.open {
    right: 0;
}

#side-menu ul {
    list-style: none;
    padding: 50px 0 0;
}

#side-menu li {
    margin: 25px 0;
}

#side-menu a {
    text-decoration: none;
    color: #333;
    font-size: 18px;
}

/* Bouton fermeture */
#close-menu {
    float: right;
    border: none;
    background: none;
    font-size: 25px;
    cursor: pointer;
}

/* Fond sombre derrière le menu */
#menu-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.3);
    z-index: 1100;
}

#menu-overlay.visible {
    display: block;
}

/* Panneau d'info coulissant */
#info-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 475px;
    max-width: 85vw;
    height: 100%;

    background: white;
    z-index: 1300;

    padding: 30px 25px;
    box-sizing: border-box;
    overflow-y: auto;

    transition: right 0.3s ease;
    box-shadow: -3px 0 10px rgba(0,0,0,0.2);
}

#info-panel.open {
    right: 0;
}

#info-content {
    margin-top: 18px;
}

/* Mini-navigation en haut du panneau (À propos / Contact / FAQ) */
#info-nav {
    display: flex;
    gap: 6px;
    clear: both;
    padding-top: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.info-nav-link {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 4px;
    font-size: 14px;
    font-weight: bold;
    color: #777;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.info-nav-link:hover {
    color: #74C15A;
}

.info-nav-link.active {
    color: #74C15A;
    border-bottom-color: #74C15A;
}

#info-panel p {
    line-height: 1.6;
    color: #333;
}

/* FAQ en accordéon */
.faq-item {
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 0;
}

.faq-item summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    color: #1a1a1a;
    list-style: none;
    position: relative;
    padding-right: 24px;
    line-height: 1.4;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 0;
    font-size: 20px;
    color: #74C15A;
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    content: "+";
    transform: rotate(45deg);
}

.faq-item p {
    margin: 10px 0 0;
    color: #555;
    font-size: 14px;
}

#close-info {
    float: right;
    border: none;
    background: none;
    font-size: 25px;
    cursor: pointer;
}

#info-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.3);
    z-index: 1250;
}

#info-overlay.visible {
    display: block;
}

@media (max-width: 600px) {
    #info-panel {
        width: 100%;
        max-width: 100vw;
    }
}

/* Pied de page */
footer {
    padding: 25px 30px;
    background: #f5f5f5;
    color: #444;
    font-size: 14px;
    line-height: 1.6;
    border-top: 1px solid #ddd;
    flex: 0 0 auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width:600px) {
    footer {
        padding: 18px 15px;
        font-size: 13px;
    }

    .footer-content {
        justify-content: center;
        text-align: center;
    }
}

footer h3 {
    margin-top: 0;
}

footer a {
    color: #74C15A;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-small {
    font-size: 13px;
    color: #777;
    margin: 0;
}

.footer-stats-icon {
    display: inline-flex;
    vertical-align: middle;
    color: #999;
}

.footer-stats-icon svg {
    width: 13px;
    height: 13px;
    vertical-align: middle;
}

/* Icônes de partage du site, dans le footer */
.footer-share {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.footer-share-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #999;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.footer-share-icon svg {
    width: 18px;
    height: 18px;
}

.footer-share-icon:hover {
    color: #74C15A;
    background: rgba(116, 193, 90, 0.1);
    text-decoration: none;
}

.footer-share-copied {
    color: #74C15A !important;
}

/* Bulle de confirmation "Lien copié !" au-dessus de l'icône */
.footer-share-copy-wrapper {
    position: relative;
    display: inline-flex;
}

.copy-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);

    background: #74C15A;
    color: white;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #74C15A;
}

.copy-tooltip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}