/* Icônes personnalisées */
.custom-icon .icon-wrapper {
  background-color: white;
  border: 2px solid #070e5c;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-icon .icon-svg {
  width: 20px;
  height: 20px;
  filter: invert(10%) sepia(100%) saturate(1000%) hue-rotate(210deg) brightness(90%) contrast(100%);
}

/* Pleine hauteur */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: auto;
  touch-action: auto;
}

body.no-scroll {
  overflow: auto !important;
  overscroll-behavior: auto !important;
  touch-action: auto !important;
}


/* Carte Leaflet */
#train-corse-map {
  height: 100%;
}

#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  touch-action: pinch-zoom;
}


/* Correction Safari (iOS) */
@supports (-webkit-touch-callout: none) {
  #map {
    margin-top: 106px;
  }
}

/* Autres navigateurs */
@supports not (-webkit-touch-callout: none) {
  #map {
    padding-top: 0px;
  }
}

/* Cache les footers si besoin */
body.hide-footers .nd-region.footer-top,
body.hide-footers .nd-region.footer-bottom {
  display: none !important;
}

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

/* Popup */
.leaflet-popup-content-wrapper {
  width: 250px !important;
  padding: 0 !important;
  border-radius: 8px;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

.leaflet-popup-content-wrapper .custom-popup {
  font-family: sans-serif;
  text-align: center;
}

.popup-img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid #ccc;
  margin: 0; /* supprime les marges */
}

.popup-category {
  font-size: 10px;
  color: #006dca;
  margin-bottom: 2px;
  padding-top: 10px;
  text-transform: uppercase;
}

.popup-name {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
  padding-bottom: 10px;
  text-transform: uppercase;
}

.popup-name a:hover {
  text-decoration: none;
}

.popup-link {
  display: block;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s ease, background-color 0.2s ease;
  border-radius: 8px;
}

.popup-link:hover {
  background-color: rgba(0, 0, 0, 0.04); /* fond clair au survol */
  transform: scale(1.01); /* léger zoom */
}

.popup-link,
.popup-link:hover,
.popup-link * {
  text-decoration: none !important;
}

/* Couleur SVG */
.icon-nature .icon-wrapper {
  background-color: #a8e6cf;
}
.icon-panorama .icon-wrapper {
  background-color: #d0e5ff;
}
.icon-patrimoine .icon-wrapper {
  background-color: #ffd3b6;
}
.icon-culture .icon-wrapper {
  background-color: #ffe298;
}
.icon-préhistoire .icon-wrapper {
  background-color: #ffaf76;
}
.icon-musée .icon-wrapper {
  background-color: #e998fb;
}
.icon-plage .icon-wrapper {
  background-color: #b3e5fc;
}
.icon-parc_loisir .icon-wrapper {
  background-color: #ff8c00;
}
.icon-port .icon-wrapper {
  background-color: #c4fcaa;
}
.icon-aeroport .icon-wrapper {
  background-color: #fffa84;
}
.icon-hotel .icon-wrapper {
  background-color: #c5e1a5;
}
.icon-escape_room .icon-wrapper {
  background-color: #ff1493;
}
.icon-accrobranche .icon-wrapper {
  background-color: #8bc34a;
}
.icon-canyoning .icon-wrapper {
  background-color: #00bcd4;
}
.icon-via_ferrata .icon-wrapper {
  background-color: #ff9800;
}
.icon-rafting .icon-wrapper {
  background-color: #84a9fb;
}
.icon-parapente .icon-wrapper {
  background-color: #87CEEB;
}
.icon-paint_ball .icon-wrapper {
  background-color: #f79e9e;
}
.marker-cluster {
  width: 40px !important;
  height: 40px !important;
  border: 2px solid white !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3) !important;
  font-weight: bold !important;
  color: white !important;
  text-align: center !important;
  margin: 0 !important;
  padding: 0 !important;
}


/* Empêche le style parasite */
.marker-cluster div {
  all: unset !important;
}

.marker-cluster-small {
    background-color: rgba(181, 226, 140, 1);
}

/* Couleurs par catégorie */
.cluster-nature        { background-color: #a8e6cf !important; }
.cluster-panorama      { background-color: #1e90ff !important; }
.cluster-patrimoine    { background-color: #ffd3b6 !important; }
.cluster-culture       { background-color: #ffe298 !important; }
.cluster-préhistoire   { background-color: #ffaf76 !important; }
.cluster-musée         { background-color: #e998fb !important; }
.cluster-plage         { background-color: #b3e5fc !important; }
.cluster-parc_loisir   { background-color: #ff8c00 !important; }
.cluster-escape_room   { background-color: #ff1493 !important; }
.cluster-port          { background-color: #c4fcaa !important; }
.cluster-aeroport      { background-color: #fffa84 !important; }
.cluster-hotel         { background-color: #4682b4 !important; }
.cluster-accrobranche  { background-color: #8bc34a !important; }
.cluster-canyoning     { background-color: #00bcd4 !important; }
.cluster-via_ferrata   { background-color: #ff9800 !important; }
.cluster-rafting       { background-color: #84a9fb !important; }
.cluster-parapente     { background-color: #87CEEB !important; }
.cluster-paint_ball    { background-color: #f79e9e !important; }

/* Popup avec lien internet */
.popup-content {
  font-size: 14px;
  font-family: sans-serif;
  text-align: center;
}

.popup-button {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 10px;
  background-color: #007BFF;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s ease;
}

.popup-button:hover {
  background-color: #0056b3;
}

/* Menu latéral (filtres) */
#map-controls {
  position: fixed;
  top: 120px; /* tu peux ajuster */
  left: 20px; /* marge à gauche */
  width: 440px;
  max-height: calc(100vh - 120px); /* pour éviter qu'il dépasse l'écran */
  background: #d4e7f8;
  border: 1px solid #ccc;
  padding: 0;
  overflow-y: auto;
  z-index: 1001;
  font-family: 'Segoe UI', sans-serif;
  font-size: 14px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
  border-radius: 10px;
}


#map-controls fieldset {
  margin-bottom: 12px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#map-controls legend {
  font-weight: bold;
  font-size: 15px;
  padding: 0 4px;
}

.menu-header {
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 22px;
  text-shadow: 1px 1px 3px #000;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
}

.menu-header-icon {
  max-height: 100px;
  width: auto;
  margin-bottom: 4px;
  padding-top: 15px;
}


#map-controls .menu-header {
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 22px;
  text-shadow: 1px 1px 3px #000;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
  padding: 40px 0;
}


#map-controls summary {
  position: relative;
  font-weight: bold;
  font-size: 16px;
  padding: 12px 40px 12px 12px; /* place pour l'icône à droite */
  cursor: pointer;
  list-style: none;
  background-color: #f4f7fb;
  border-bottom: 1px solid #dce7f2;
  transition: background-color 0.2s ease;
  overflow: visible;
}

#map-controls summary::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url('/modules/custom/train_corse_map/icons/fleche_droite.svg');
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
}

/* Rotation si le détail est ouvert */
#map-controls details[open] summary::after {
  transform: translateY(-50%) rotate(90deg);
}

#map-controls summary::-webkit-details-marker {
  display: none;
}

#map-controls summary:hover {
  background-color: #e0edf9;
  transition: background-color 0.2s ease;
}

#map-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  background-color: white;
  margin: 0;
  border-top: 1px solid #f0f0f0;
}

.checkbox-row{
  margin-left: 20px;
}

#map-controls .checkbox-row img {
  width: 24px;
  height: 24px;
  margin: 0 5px 5px 10px;
}

#reset-filters {
  margin: 20px 10px 10px;
  padding: 8px;
  background-color: #ffffff;
  color: #036;
  font-weight: bold;
  border: 2px solid #73a1c1;
  border-radius: 4px;
  cursor: pointer;
  width: calc(100% - 20px);
  font-size: 14px;
}

#map-controls details {
  margin: 0 10px; /* décalage gauche/droite */
  background-color: white; /* fond blanc */
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* effet subtil */
}

/* Coin supérieur arrondi pour la première catégorie */
#map-controls details:first-of-type {
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

/* Coin inférieur arrondi pour la dernière catégorie */
#map-controls details:last-of-type {
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
}

/* Tous les autres restent avec des coins droits */
#map-controls details:not(:first-of-type):not(:last-of-type) {
  border-radius: 0;
}

/* Conteneur positionné à droite, fixe */
#custom-zoom-controls {
  position: fixed;
  top: 140px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1001;
}

.custom-zoom-button {
  background-color: #ffffff;
  border: 2px solid #070e5c;
  color: #070e5c;
  font-size: 24px;
  font-weight: bold;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.custom-zoom-button:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.custom-zoom-button:last-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.service_icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
  cursor: pointer;
}

.service_icon__text {
  color: white;
  font-weight: bold;
  font-size: 16px;
}

.service_icon:hover {
  background-color: #e07800;
}

.menu-header__title {
  color: white;
  font-size: 2em;
  font-weight: bold;
  text-shadow: 1px 1px 3px #000;
  line-height: 1.1; /* réduire l'espacement entre les lignes */
  padding-top: 10px;
  width: auto;
  text-align: center;
  margin-bottom: 20px;
}

.underline-second-line {
  text-decoration: underline;
  text-decoration-color: #637ab4;
  text-decoration-thickness: 5pt;
  text-underline-offset: 25px;
}

/* Bouton rond façon Observatoire, version BLEUE */
.service_icon.custom-blue-icon {
  background-color: white;
  border: 2px solid #070e5c;
  border-radius: 50%;
  box-shadow: inset 0 0 5px #898ca8;
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}


.service_icon.custom-blue-icon svg {
  width: 70%;
  height: 70%;
  fill: #070e5c; /* bleu foncé au repos */
  transition: fill 0.3s ease;
}

.service_icon.custom-blue-icon:hover {
  background: linear-gradient(90deg, #0095ff 0%, #070e5c 100%);
  border-color: #070e5c;
  box-shadow: none;
}

.service_icon.custom-blue-icon:hover svg {
  fill: white; /* devient blanc au hover */
}


.poi-svg-icon {
  width: 60%;
  height: 60%;
  fill: #070e5c;
  transition: fill 0.3s ease;
}

.service_icon.custom-blue-icon:hover .poi-svg-icon {
  fill: white;
}

.poi-icon {
  width: 60%;
  height: 60%;
  color: #070e5c; /* couleur bleue foncée par défaut */
  transition: color 0.3s ease;
}

.custom-blue-icon:hover .poi-icon {
  color: white; /* devient blanc au survol */
}

/* actif (par exemple après clic sur une catégorie) */
.custom-blue-icon.active .poi-icon {
  color: #070e5c; /* ou blanc, ou autre couleur d'état actif */
}

/* actif + survol : priorité au survol */
.custom-blue-icon.active:hover .poi-icon {
  color: white;
}

/* Rend le survol de l'icône permanent */
.service_icon.custom-blue-icon.is-hovered {
    background: linear-gradient(90deg, #0095ff 0%, #070e5c 100%);
    border-color: #070e5c;
    box-shadow: none;
}
.service_icon.custom-blue-icon.is-hovered .poi-icon {
    color: white; /* icône devient blanche */
}
.service_icon.custom-blue-icon.is-hovered svg {
    fill: white; /* l'icône devient blanche */
}
/* Rend le survol de l'icône "actif" grâce à une classe dédiée */
.service_icon.custom-blue-icon.is-hovered {
    background: linear-gradient(90deg, #0095ff 0%, #070e5c 100%);
    border-color: #070e5c;
    box-shadow: none;
}
.service_icon.custom-blue-icon.is-hovered svg {
    fill: white;
}
.custom-blue-icon.is-hovered .poi-icon {
    color: white;
}

/* BOUTON MOBILE */
#mobile-menu-button {
    display: none;
}

/* VERSION SMARTPHONE */
@media (max-width: 768px) {

    #mobile-menu-button {
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        background: white;
        border-radius: 10px;
        z-index: 99999;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        cursor: pointer;
    }

    #map-controls {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;

        width: 300px !important;
        max-width: 85vw;

        height: 100vh !important;

        z-index: 99998;

        overflow-y: auto;

        background: white;

        transform: translateX(-100%);

        transition: transform 0.3s ease;
    }

    #map-controls.open {
        transform: translateX(0);
    }
}

