#map {
  height: 100%;
}

#map {
  height: calc(var(--main-section-height) - var(--footer-height));
  opacity: 0.7;
  transition: opacity 0.3s ease-in-out;
}

.active-section #map {
  opacity: 1;
}

#map-container {
  position: absolute;
  height: 86.5%;
  width: 100%;
  z-index: 0;
  top: 105px;
}

/* Style pour le Menu contextuelle (clic droit map)*/

.map-context-menu {
  font-family: inherit;
  font-size: 14px;
}


.map-context-menu.dropdown {
  max-height: 400px;
  margin: 0;
  margin-top: 0px;

}

.map-context-menu.dropdown.show {
  position: absolute;
  z-index: 10000;
  display: block;
  pointer-events: auto;
}



.map-context-menu .dropdown-menu .btn-close {
  background-color: transparent;
  color: #fff;
  border: none;
  font-size: 0.7rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin: -5px;
}

.map-context-menu .dropdown-menu .btn-close:hover {
  background-color: #e9ecef;
  color: var(--primary-color);
}


.map-context-menu .dropdown-menu {
  font-size: 13px;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
}

.map-context-menu .dropdown-header {
  display: flex;
  font-size: 0.6rem;
  color: #fff;
  white-space: nowrap;
  font-weight: normal;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  line-height: 10px;
  overflow: hidden;
  background: var(--accent-color-focus);
  height: 30px;
  margin: 0;
  padding: 0 10px;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
}

.map-context-menu .dropdown-item {
  width: 100%;
  clear: both;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  cursor: pointer;
  border: 0;
  box-sizing: border-box;
  padding: 4px 8px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
}

.map-context-menu .dropdown-item:hover {
  background-color: #f8f9fa;
  color: var(--secondary-color);
  padding-left: 20px;
  text-decoration: none;
}

.map-context-menu .dropdown-menu>.dropdown-item:last-of-type {
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
}

/* Style pour les options désactivées du menu contextuel */
.dropdown-item.disabled {
  color: #adb5bd !important;
  pointer-events: none;
  opacity: 0.7;
  background: none !important;
  cursor: not-allowed;
}

.dropdown-item.disabled:hover,
.dropdown-item.disabled:active {
  color: #adb5bd !important;
  background: none !important;
}


.map-context-menu .dropdown-divider {
  height: 0;
  overflow: hidden;
  border-top: 1px solid var(--primary-color);
}

/* Style pour la surbrillance temporaire dans FancyTree */
.highlighted-row {
  background-color: #fff3cd !important;
  border: 2px solid #ffc107 !important;
  transition: all 0.3s ease;
}

.highlighted-row td {
  background-color: transparent !important;
}

#layer-control-id {
  margin: 0px;
  padding: 0px;
  border: 0px;
  background: none;
  box-shadow: none;
}

.leaflet-top.leaflet-right {
  top: 180px;
  z-index: 800;
}


.leaflet-control-search.leaflet-control,
.leaflet-control-layers {
  background-color: transparent;
}

.leaflet-verticaltop2 .leaflet-control-layers-toggle {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/layers-w.svg);
  background-size: 30px 30px;
  background-repeat: no-repeat;
  background-position: center center;
}

.leaflet-verticaltop2 .leaflet-control-layers-clicked {
  color: var(--accent-color-focus);
}

.leaflet-verticaltop2 .leaflet-control-layers-clicked .leaflet-control-layers-toggle {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/layers-blue.svg);
}

.leaflet-verticaltop2 .leaflet-control-layers-toggle:hover {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/layers-b.svg);
}

.leaflet-verticaltop1 .search-button {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/search-w.svg);
  background-size: 30px 30px;
  background-repeat: no-repeat;
  background-position: center center;
}

.leaflet-verticaltop1 .leaflet-control-search-clicked {
  color: var(--accent-color-focus);
}

.leaflet-verticaltop1 .leaflet-control-search-clicked .search-button {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/search-blue.svg);
}

.leaflet-verticaltop1 .search-button:hover {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/search-b.svg);
}


.leaflet-verticaltop3 .easyButtonLegendIcon-clicked {
  background-image: url(/assets/IMAGES/GUI/BUTTONS/legend-blue.svg) !important;
}

.leaflet-verticaltop-wrapper {
  position: absolute;
  z-index: 800;
  top: calc(var(--header-height)*3);
  display: flex;
  flex-direction: column;
  padding: 0 0px 0 20px;
  border-bottom-left-radius: 50%;
  border-top-left-radius: 50%;
  background-color: var(--tertiary-color);
  justify-content: flex-start;
  align-items: flex-end;
  width: 60px;
  height: 200px;
  opacity: 0.8;
  transition: all 0.2s ease;
  outline:
    2px solid #3c8dbc;
  outline-offset: -3px;
}

.isLoading .leaflet-verticaltop-wrapper {
  right: -40px;
}

.isLoading .leaflet-verticaltop-wrapper:hover {
  right: 0;
}

.leaflet-verticaltop-wrapper:hover {
  opacity: 1;
}

.leaflet-verticaltop-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  padding: 0 0px 0 20px;
  border-bottom-left-radius: 50%;
  border-top-left-radius: 50%;
  background-color: transparent;
  width: 60px;
  height: 200px;
  border-left: 10px solid var(--secondary-color);
  z-index: -100;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

.leaflet-verticaltop-wrapper>div {
  border-radius: 5px;
  scale: 0.8;
  transition: all 0.3s ease;
  margin-right: -3px;
}

/* Géré par JavaScript avec délai */
.leaflet-verticaltop-wrapper>div.hover-effect {
  scale: 0.95;
}

.leaflet-verticaltop1,
.leaflet-verticaltop2,
.leaflet-verticaltop3,
.leaflet-verticaltop4 {
  height: 50px;
  width: 50px;
}

.leaflet-verticaltop3 .leaflet-control,
.leaflet-verticaltop4 .leaflet-control {
  margin: 0;
  padding: 0;
}

.leaflet-verticaltop3 .leaflet-bar,
.leaflet-verticaltop4 .leaflet-bar {
  border: 0;
}

.leaflet-export-menu {
  position: absolute;
  top: 100%;
  /* Juste sous le bouton */
  right: 0;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  padding: 5px;
  border-radius: 5px;
  list-style: none;
  margin: 0;
  width: max-content;
  z-index: 1000;
}

.leaflet-export-menu li {
  padding: 4px 8px;
  font-family: var(--font-title);
  font-size: 10px;
  cursor: pointer;
  color: #333;
  text-align: center;
}

.leaflet-export-menu li:hover {
  background: #f4f4f4;
}

.leaflet-verticalcenter {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  top: 200px;
  left: 0;
}

.isLoading .leaflet-verticalcenter {
  left: -40px;
}


.leaflet-horizontalcenter {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  left: 50%;
  /* possible because the placeholder's parent is the map */
  transform: translateX(-50%);
  /* using the CSS3 Transform technique */
  padding-top: 10px;
}

.leaflet-horizontalcenter .leaflet-control {
  margin-left: 10px;
}


/* Leaflet Draw */

.leaflet-draw {
  display: none;
}

.leaflet-draw-toolbar {
  display: none;
}

.leaflet-tooltip {
  box-shadow: none;
}


#latlng {
  position: absolute;
  right: 0px;
  bottom: 0px;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 7px 1px 3px;
  margin-left: auto;
  margin-right: auto;
  color: black;
  background-color: white;
  -webkit-border-top-left-radius: 5px;
  -webkit-border-top-right-radius: 5px;
  -moz-border-radius-topleft: 5px;
  -moz-border-radius-topright: 5px;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  -webkit-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.75);
  box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: none;
}


/*******************************************************************************************************************
*
*                                                       LEGEND
*
********************************************************************************************************************/

.easyButtonLegendIcon,
.leaflet-export-button-bg {
  background-size: 30px 30px;
  background-repeat: no-repeat;
  background-position: center;
  height: 50px;
  width: 50px;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.leaflet-export-button-bg {
  background-image: url('/assets/IMAGES/GUI/BUTTONS/print-w.svg');
}

.leaflet-export-button-bg:hover {
  background-image: url('/assets/IMAGES/GUI/BUTTONS/print-b.svg');
}

.leaflet-verticaltop4 .leaflet-export-button-clicked {
  color: var(--accent-color-focus);
}

.leaflet-export-button.leaflet-export-button-clicked {
  background-image: url('/assets/IMAGES/GUI/BUTTONS/print-blue.svg');
}


/* Style pour la carte en mode export */
.map-exporting {
  cursor: wait !important;
  pointer-events: none !important;
  opacity: 0.7;
  position: relative;
}

.map-exporting::after {
  content: "Export en cours...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: bold;
  z-index: 1000;
  pointer-events: none;
}

.easyButtonLegendIcon {
  background-image: url('/assets/IMAGES/GUI/BUTTONS/legend-w.svg');
}

.easyButtonLegendIcon:hover {
  background-image: url('/assets/IMAGES/GUI/BUTTONS/legend-b.svg');
}


.easy-button-button.enable {
  display: block;
}

.easy-button-button.disabled {
  display: none;
}

/* 
.leaflet-bar button:first-of-type {
}

.leaflet-bar button:last-of-type {
  
} */

.leaflet-touch .leaflet-bar button {
  width: 50px;
  height: 50px;
  line-height: 30px;
  float: right;
  background-color: transparent;
  padding: 0;
  margin: 0;
}

/*Zoom specific*/
.leaflet-control-zoom {
  padding: 0px;
  background-color: rgba(3, 19, 36, 0.7);
  transition: all 0.2s ease;
  outline: 1px solid #3c8dbc;
  outline-offset: 0px;
  border-radius: 50%;
  border-right: 5px solid #3c8dbc;
  border-left: 5px solid #3c8dbc;
}

.leaflet-control-zoom:hover {
  border-radius: 20px;
}

.leaflet-bar a {
  color: var(--accent-color-focus) !important;
  background-color: transparent !important;
}

.leaflet-bar a:hover {
  color: var(--secondary-color) !important;
}

.leaflet-touch .leaflet-bar a:first-child {
  border-top-left-radius: 50% !important;
  border-top-right-radius: 50% !important;
}

.leaflet-touch .leaflet-bar a:last-child {
  border-bottom-left-radius: 50% !important;
  border-bottom-right-radius: 50% !important;
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background-color: var(--accent-color-focus) !important;
  color: var(--primary-color) !important;
}

/*Mouse Position specific*/
.leaflet-container .leaflet-control-mouseposition,
.leaflet-container .leaflet-control-attribution {
  background-color: rgba(3, 19, 36, 0.7) !important;
  color: #7fbcdf !important;
  margin-bottom: 0px !important;
}

/*Legend specific*/
#map-legend.map-legend {
  position: absolute;
  display: none;
  overflow: overlay;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  font-family: var(--font-title);
  font-size: 0.7rem;
  /*line-height: 24px;*/
  color: #555;
}

.map-legend h1 {
  font-family: var(--font-title);
  text-align: left;
  text-transform: uppercase;
  font-size: .4rem;
  margin: .1rem 0 .5rem;
  color: #777;
}

.map-legend summary {
  font-family: var(--font-title);
  text-align: left;
  text-transform: uppercase;
  font-size: .7rem;
  margin: .1rem 0 .5rem;
  color: var(--dark-color-5);
}


.map-legend summary:hover {
  background: #fff;
}

.map-legend summary.legend-always-open:hover {
  background: transparent;
}

/* Masquer le chevron natif */
summary.legend-always-open {
  list-style: none;
  cursor: default;
  position: relative;
  padding-left: 1.5em;
  /* Laisse la place à l'icône FA */
}

summary.legend-always-open::-webkit-details-marker {
  display: none;
}

summary.legend-always-open::marker {
  display: none;
}

/* Ajoute l'icône Font Awesome (cadenas ici) */
summary.legend-always-open::before {
  font-family: "Font Awesome 5 Free";
  /* ou "FontAwesome" selon ta version */
  content: "\f023";
  /* Unicode FA pour le cadenas */
  font-weight: 900;
  /* 900 pour solid, 400 pour regular */
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1em;
  display: inline-block;
  width: 1.2em;
  text-align: center;
}

/* Masquer le + ou - natif sur les groupes verrouillés */
.leaflet-layerstree-header.force-open .leaflet-layerstree-closed,
.leaflet-layerstree-header.force-open .leaflet-layerstree-opened {
  color: transparent;
  /* ou display: none; mais attention à la mise en page */
  position: relative;
}

/* Ajoute une icône Font Awesome à la place - seulement si l'option est activée */
.leaflet-layerstree-header.force-open.show-lock-icon::before {
  font-family: "Font Awesome 5 Free";
  content: "\f023";
  font-weight: 900;
}

.map-legend span {
  position: relative;
}

.map-legend img.marker,
.map-legend img.polygon {
  width: 1rem;
  height: 1rem;
  float: left;
  margin: -.2rem .5rem 0 0;
}

.map-legend img.line {
  width: 1rem;
  height: .1rem;
  float: left;
  margin: .25rem .5rem 0 0;
}

.map-legend img.circle {
  width: 1rem;
  height: 1rem;
  float: left;
  margin: 0 .5rem 0 0;
  -webkit-border-radius: .5rem;
  -moz-border-radius: .5rem;
  border-radius: .5rem;
}

.map-legend i.icon {
  background-size: 1rem;
  background-color: rgba(255, 255, 255, 1);
}

.map-legend dl>details {
  position: relative;
  margin-left: .5rem;
}

.map-legend dt {
  margin-bottom: 0.3rem;
  display: flex;
}

#confirmExport:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.switch-group-btn {
  color: var(--accent-color-hover);
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 1px;
  z-index: 10;
  left: -20px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 15px;
  width: 20px;
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  padding-bottom: 3px;
  transition: all .2s ease;
}

.switch-group-btn:hover {
  color: var(--accent-color-focus);
  background: rgba(255, 255, 255, 0.3);
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

/******************************************************
 *                    ZOOM DE LA LÉGENDE              *
 ******************************************************/

.legend-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  margin-bottom: 5px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-zoom-btn {
  background: var(--tertiary-color);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
}

.legend-zoom-btn:hover {
  background: var(--primary-color);
  transform: scale(1.1);
}

.legend-zoom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.legend-zoom-btn:disabled:hover {
  background: var(--tertiary-color);
  transform: none;
}

.legend-zoom-btn i {
  font-size: 12px;
}

.zoom-level {
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 600;
  min-width: 45px;
  text-align: center;
  user-select: none;
}

/* Assure que la transformation est appliquée correctement */
#map-legend.map-legend.leaflet-control .legend-content {
  transform-origin: top left;
  transition: transform 0.2s ease-out;
  will-change: transform;
}

/* Style pour le conteneur des contrôles de zoom */
.legend-zoom-controls-container {
  display: none;
  /* Masqué car les contrôles sont ajoutés directement dans la légende */
}
