/* CDraggableScaleControl - Styles pour l'outil d'échelle draggable */

/* Contrôle d'échelle draggable - Styles complets */
.leaflet-control-scale-draggable {
  position: absolute;
  z-index: 1000;
  cursor: default;
  user-select: none;
  pointer-events: auto;
  display: flex;
  align-items: center;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.1), transparent 80%);
  border: 0;
  border-radius: 3px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 2px 5px;
  transition: background-color .3s ease, border-color .3s ease, border .3s ease, transform .3s ease;
  justify-content: flex-end;
  width: auto;
  min-width: 100px;
  right: -89px;
  top: -13px;
  transform: scale(1);
  outline: 2px solid rgba(109, 109, 109, 0.2);
  outline-offset: -2px;
}

/* Label de l'échelle */
.leaflet-control-scale-draggable .scale-label {
  position: absolute;
  bottom: -10px;
  right: 0px;
  color: white;
  font-size: 9px;
  font-weight: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.leaflet-control-scale-draggable:hover .scale-label {
  opacity: 1;
}

.leaflet-control-scale-draggable:hover {
  cursor: default; /* Curseur par défaut sur le conteneur */
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(204, 204, 204, 0.3);
  outline: 2px solid rgba(109, 109, 109, 0.5);
}

.leaflet-control-scale-draggable.dragging {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: scale(1.01);
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(204, 204, 204, 0.5);
}

.leaflet-control-scale-drag-handle {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: bold;
  cursor: grab;
  padding: 2px 4px;
  border-radius: 2px;
  user-select: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1;
  margin: 0 5px;
  opacity: 0.5;
  display: inline-block;
  z-index: 1000;
  position: relative;
  height: 20px;
  width: 20px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all .2s ease-in-out;
}

/* Icône Font Awesome par défaut */
.leaflet-control-scale-drag-handle .drag-handle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity .2s ease-in-out;
  font-size: 10px;
}

/* Points cachés par défaut */
.leaflet-control-scale-drag-handle .drag-handle-dots {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  opacity: 0;
  transition: opacity .2s ease-in-out;
  font-size: 10px;
  font-weight: bold;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1;
}

/* Au hover du handle ou pendant le drag : cacher l'icône et afficher les points */
.leaflet-control-scale-drag-handle:hover .drag-handle-icon,
.leaflet-control-scale-draggable.dragging .leaflet-control-scale-drag-handle .drag-handle-icon {
  opacity: 0;
  display: none;
}

.leaflet-control-scale-drag-handle:hover .drag-handle-dots,
.leaflet-control-scale-draggable.dragging .leaflet-control-scale-drag-handle .drag-handle-dots {
  display: flex;
  opacity: 1;
}

.leaflet-control-scale-draggable:hover .leaflet-control-scale-drag-handle {
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0.8;
}

.leaflet-control-scale-draggable .leaflet-control-scale-drag-handle:hover {
  opacity: 1;
}

/* Conteneur circulaire de rotation */
.rotation-container {
  position: absolute;
  z-index: 1000;
  cursor: default;
  user-select: none;
  pointer-events: auto;
}

/* Cercle de rotation */
.rotation-container .rotation-gizmo {
  position: absolute;
  top: 50%;
  right: 50%;
  transform: translate(50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0);
  border: 2px dotted rgba(255, 255, 255, 0.5);
  pointer-events: auto;
  cursor: crosshair;
  z-index: -1;
  opacity: 0.2;
  transition: all 0.2s ease;
}

.rotation-container:hover .rotation-gizmo {
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.1);
}

.rotation-container .rotation-gizmo:hover {
  opacity: 0.8;
}

.rotation-container .rotation-gizmo.dragging {
  opacity: 0.1;
}

/* Indicateur d'angle de rotation */
.rotation-container .angle-indicator {
  position: absolute;
  top: -10px;
  left: -10px;  
  background: rgba(0, 0, 0, 0.3);
  color: rgb(255, 255, 255);
  font-size: 12px;
  font-weight: bold;
  font-family: var(--font-sec);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2000;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  padding: 1px 2px;
  margin-left: 3px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rotation-container.rotating .angle-indicator {
  opacity: 1;
}

.rotation-container.hovering .angle-indicator {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.leaflet-control-scale-draggable.dragging .leaflet-control-scale-drag-handle {
  cursor: grabbing;
}

/* Poignée de redimensionnement */
.leaflet-control-scale-resize-handle {
  color: rgba(255, 255, 255, 0.5);
  font-weight: normal;
  cursor: ew-resize;
  border-top-left-radius: 5px;
  user-select: none;
  /* margin-right: 5px; Supprimé car position: absolute */
  opacity: 0.9;
  display: flex;
  transition: all 0.2s ease;
  position: absolute;
  left: 1px;
  width: 2px;
  background: rgba(0, 0, 0, 0.3);
  height: 100%;
  align-items: center;
  justify-content: center;
  justify-content: center;
  align-items: center;
  border-bottom-left-radius: 5px;
  opacity: 0.5;
}

.leaflet-control-scale-resize-handle i {
  font-size: 12px;
  line-height: 1;
}

.leaflet-control-scale-resize-handle:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.1);
  opacity: 1;
}

.leaflet-control-scale-draggable:hover .leaflet-control-scale-resize-handle {
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  opacity: 0.9;
  left: -10px;
  width: 10px;
}

.leaflet-control-scale-draggable.resizing .leaflet-control-scale-resize-handle {
  cursor: ew-resize;
  background: rgba(0, 0, 0, 0.2);
  color: #333;
  opacity: 1;
  left: -10px;
  width: 10px;
}

.leaflet-control-scale-draggable.resizing .leaflet-control-scale-resize-handle i {
  transform: scale(1.1);
}

/* Styles pour l'échelle en position fixe */
.leaflet-control-scale-draggable[style*="position: fixed"] {
  z-index: 2000;
  pointer-events: auto;
}

/* Styles pour l'échelle interne */
.leaflet-control-scale-draggable .leaflet-control-scale {
  margin: 0;
  padding: 0;
}

/* Styles commentés car écrase des styles déja existants !*/
/*.leaflet-control-scale-draggable .leaflet-control-scale-line {
  background: #333;
  height: 2px;
  margin: 2px 0;
  border-radius: 1px;
  position: relative;
}

.leaflet-control-scale-draggable .leaflet-control-scale-line-inner {
  color: #333;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
} */

/* Styles pour les contrôles de zoom dans le conteneur draggable */
.leaflet-control-scale-draggable .zoom-controls {
  display: flex;
  align-items: center;
}

.leaflet-control-scale-draggable .zoom-button:first-of-type {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.leaflet-control-scale-draggable .zoom-button:last-of-type {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.leaflet-control-scale-draggable .zoom-button {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(51, 51, 51, 0.1);
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.8);
  user-select: none;
}

.leaflet-control-scale-draggable .zoom-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(153, 153, 153, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.leaflet-control-scale-draggable .zoom-button i {
  font-size: 12px;
  line-height: 1;
}

.leaflet-control-scale-draggable .zoom-level {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  min-width: 20px;
  text-align: center;
  height: 15px;
  width: 20px;
  display: flex;
  justify-content: center;
  align-content: center;
  opacity: 0.5;
}

.leaflet-control-scale-draggable:hover .zoom-level {
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.4);
  opacity: 0.8;
}

.leaflet-control-scale-draggable:hover .zoom-level {
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.4);
  opacity: 0.9;
}

/* Contrôles de verrouillage */
.leaflet-control-scale-draggable .lock-controls {
  display: flex;
  position: absolute;
  right: -20px;
  opacity: 0;
}

.leaflet-control-scale-draggable:hover .lock-controls {
  opacity: 0.6;
}

.leaflet-control-scale-draggable .lock-button {
  font-size: 10px;
  padding: 5px;
  border: 1px solid rgba(51, 51, 51, 0.9);
  background: rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  user-select: none;
  transition: all 0.2s ease;
  border-radius: 5px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.leaflet-control-scale-draggable .lock-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(153, 153, 153, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  color: #fff;
}

.leaflet-control-scale-draggable .lock-button.locked {
  background: rgba(0, 122, 186, 0.9);
  border-color: rgba(0, 90, 135, 0.9);
  color: #fff;
}

.leaflet-control-scale-draggable .lock-button.locked:hover {
  background: rgba(0, 122, 186, 1);
  border-color: rgba(0, 90, 135, 1);
}

/* Contrôles de paliers */
.leaflet-control-scale-draggable .palier-controls {
  position: absolute;
  bottom: -15px;
  right: 50%;
  transform: translateX(-50%);
  display: flex;
  z-index: 10;
}

.leaflet-control-scale-draggable .palier-button:first-of-type {
  border-bottom-left-radius: 50%;
}

.leaflet-control-scale-draggable .palier-button:last-of-type {
  border-bottom-right-radius: 50%;
}

.leaflet-control-scale-draggable .palier-button {
  min-width: 20px;
  min-height: 16px;
  font-size: 8px;
  border: 1px solid rgba(204, 204, 204, 0.2);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-weight: bold;
  font-family: var(--font-sec);
  color: white;
  transition: all .3s ease;
  position: relative;
  overflow: hidden;
  opacity: 0.6;
}

.leaflet-control-scale-draggable .palier-button:hover {
  background: rgba(224, 224, 224, 0.7);
  border-color: #fff;
  opacity: 1;
  color: black;
}

.leaflet-control-scale-draggable:hover .palier-button {
  opacity: 0.9;
}

.leaflet-control-scale-draggable .palier-button.active {
  background: #007cba;
  color: white;
  border-color: #005a87;
}

.leaflet-control-scale-draggable .palier-button .point {
  width: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.7;
}

/* Points par défaut */
.leaflet-control-scale-draggable .palier-button .points {
  display: flex;
  gap: 1px;
  transition: all 0.3s ease;
}

/* Animation au hover */
.leaflet-control-scale-draggable .palier-button:hover .points {
  transform: translateY(-20px);
  opacity: 0;
}

/* Nombres au hover */
.leaflet-control-scale-draggable .palier-button .number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  font-weight: bold;
}

.leaflet-control-scale-draggable .palier-button:hover .number {
  transform: translate(-50%, -50%) translateY(0);
  opacity: 1;
}

/* --- Flip vertical de la barre d'outil quand .rotation-container a .flipped --- */
.rotation-container.flipped .leaflet-control-scale-draggable {
  transform: scaleY(-1);
}

/* Inverser aussi les éléments internes pour qu'ils restent lisibles */
.rotation-container.flipped .leaflet-control-scale-draggable .scale-label,
.rotation-container.flipped .leaflet-control-scale-draggable .palier-controls,
.rotation-container.flipped .leaflet-control-scale-draggable .zoom-controls,
.rotation-container.flipped .leaflet-control-scale-draggable .leaflet-control-scale-line {
  transform: scaleX(-1);
}

.rotation-container.flipped .angle-indicator {
  transform: scaleY(-1) scaleX(-1);
}