/* Base styles */
:root {
  --map-navbar-height: 57px;
  --map-top-offset: 12px;
  --map-accent: #0056b3;
  --map-accent-dark: #004792;
  --map-accent-deep: #003d82;
  --map-sky: #aed6f1;
  --map-tool-size: clamp(28px, 3.6vh, 34px);
  --map-tool-gap: 3px;
  --map-control-radius: 10px;
  --map-control-bg: rgba(255, 255, 255, 0.95);
  --map-control-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  --map-safe-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
  :root {
    --map-safe-bottom: max(52px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, .wrapper {
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
/***************** Drawer lateral del mapa */
.map-drawer {
  --drawer-width: min(300px, calc(100% - 56px));
  --drawer-left: 48px;
  position: absolute;
  top: 5%;
  left: var(--drawer-left);
  bottom: var(--map-safe-bottom);
  height: auto;
  max-height: none;
  width: var(--drawer-width);
  max-width: calc(100% - var(--drawer-left));
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 86, 179, 0.2);
  border-radius: 14px;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.12);
  transform: translateX(calc(-100% - var(--drawer-left)));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.map-drawer.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.map-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--map-accent, #0056b3) 0%, var(--map-accent-deep, #003d82) 100%);
  color: #fff;
  flex-shrink: 0;
  border-radius: 14px 14px 0 0;
}

.map-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.map-drawer-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.map-drawer-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-drawer-subtitle {
  margin: 2px 0 0;
  font-size: 10px;
  opacity: 0.85;
  color: #fff;
}

.map-drawer-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
  font-size: 12px;
}

.map-drawer-close:hover {
  background: rgba(220, 53, 69, 0.9);
}

.map-drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 6px;
  background: #f0f5fa;
  border-bottom: 1px solid rgba(0, 86, 179, 0.12);
  flex-shrink: 0;
}

.map-drawer-tab {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #4a5568;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  min-height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.map-drawer-tab.is-active {
  background: #fff;
  color: var(--map-accent-dark, #004792);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.map-drawer-tab:hover:not(.is-active) {
  background: rgba(0, 86, 179, 0.08);
}

.map-drawer-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.map-drawer-panel {
  display: none;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  padding: 8px 10px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 86, 179, 0.45) transparent;
}

.map-drawer-panel.is-active {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.map-drawer-panel[hidden] {
  display: none !important;
}

.map-drawer-panel::-webkit-scrollbar {
  width: 5px;
}

.map-drawer-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 86, 179, 0.45);
  border-radius: 4px;
}

.map-drawer-hint {
  margin: 0 0 6px;
  font-size: 10px;
  color: #64748b;
  flex-shrink: 0;
}

.map-drawer-empty {
  margin: 8px 0 0;
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  background: #f8faf9;
  border: 1px dashed rgba(0, 86, 179, 0.25);
  border-radius: 10px;
  grid-column: 1 / -1;
}

.map-drawer-grupos,
#herramientas_mapas.map-drawer-grupos,
#map-drawer #herramientas_mapas,
#map-drawer #herramientas_layer.map-drawer-grupos,
#herramientas_layer.map-drawer-grupos {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
  align-content: start !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 0 2px 8px 0 !important;
  margin: 0 !important;
  flex-wrap: unset !important;
  flex-direction: unset !important;
  white-space: normal !important;
  background: transparent !important;
  border-radius: 0 !important;
  width: 100% !important;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 86, 179, 0.45) transparent;
}

#map-drawer #herramientas_mapas::-webkit-scrollbar,
#map-drawer #herramientas_layer::-webkit-scrollbar {
  width: 5px;
}

#map-drawer #herramientas_mapas::-webkit-scrollbar-thumb,
#map-drawer #herramientas_layer::-webkit-scrollbar-thumb {
  background: rgba(0, 86, 179, 0.45);
  border-radius: 4px;
}

#map-drawer #herramientas_mapas:empty {
  display: grid !important;
  min-height: 0 !important;
}

.map-drawer-grupos .grupo-icono,
#map-drawer #herramientas_mapas .grupo-icono,
#map-drawer #herramientas_layer .grupo-icono {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  background: #f8faf9 !important;
  border: 1px solid rgba(0, 86, 179, 0.15) !important;
  border-radius: 8px !important;
  padding: 6px 4px !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
  flex: unset !important;
  flex-shrink: 0 !important;
  white-space: normal !important;
  position: relative !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  cursor: pointer;
}

.map-drawer-grupos .grupo-icono:hover,
#map-drawer #herramientas_mapas .grupo-icono:hover,
#map-drawer #herramientas_layer .grupo-icono:hover {
  border-color: var(--map-accent, #0056b3);
  box-shadow: 0 2px 10px rgba(0, 86, 179, 0.15);
  transform: none;
}

#map-drawer #herramientas_layer .grupo-icono.is-active,
#map-drawer #herramientas_layer .layer-tile.is-active {
  background: rgba(0, 86, 179, 0.14) !important;
  border-color: var(--map-accent, #0056b3) !important;
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.16) !important;
}

#map-drawer #herramientas_mapas .boton-modal,
#map-drawer #herramientas_layer .boton-modal {
  width: 48px !important;
  max-width: 48px !important;
  height: 48px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  aspect-ratio: 1 / 1;
  border-radius: 10px !important;
  padding: 4px !important;
  margin: 0 0 4px !important;
  background: #fff !important;
  color: var(--map-accent-dark, #004792) !important;
  border: 1px solid rgba(0, 86, 179, 0.2) !important;
  box-shadow: none !important;
  transform: none !important;
  overflow: visible !important;
  cursor: pointer;
}

#map-drawer #herramientas_mapas .boton-modal::before,
#map-drawer #herramientas_layer .boton-modal::before {
  display: none !important;
}

#map-drawer #herramientas_mapas .boton-modal:hover,
#map-drawer #herramientas_layer .boton-modal:hover {
  background: rgba(0, 86, 179, 0.08) !important;
  transform: none !important;
  box-shadow: none !important;
}

#map-drawer #herramientas_layer .layer-tile.is-active .boton-modal {
  background: var(--map-accent, #0056b3) !important;
  border-color: var(--map-accent, #0056b3) !important;
  color: #fff !important;
}

#map-drawer #herramientas_layer .layer-tile.is-active .boton-modal i,
#map-drawer #herramientas_layer .layer-tile.is-active .boton-modal i::before,
#map-drawer #herramientas_layer .layer-tile.is-active .icono-contenedor i,
#map-drawer #herramientas_layer .layer-tile.is-active .icono-contenedor i::before {
  color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#map-drawer #herramientas_mapas .icono-contenedor,
#map-drawer #herramientas_layer .icono-contenedor {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  border-radius: 8px !important;
  background: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

#map-drawer #herramientas_layer .layer-tile.is-active .icono-contenedor {
  background: transparent !important;
  box-shadow: none !important;
}

#map-drawer #herramientas_layer .icono-contenedor i {
  font-size: 18px !important;
  color: inherit !important;
  line-height: 1;
  display: inline-block !important;
}

#map-drawer #herramientas_mapas .icono-grande {
  width: 34px !important;
  height: 34px !important;
  object-fit: contain !important;
  filter: none !important;
  transform: none !important;
}

#map-drawer #herramientas_mapas .nombre-icono,
#map-drawer #herramientas_layer .nombre-icono {
  font-size: 10px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  color: #334155 !important;
  max-width: 100% !important;
  white-space: normal !important;
  word-break: break-word !important;
  margin-top: 2px !important;
  text-shadow: none !important;
}

#map-drawer #herramientas_layer .form-check-input-layer.sr-only,
#map-drawer #herramientas_layer .sr-only,
#map-drawer #herramientas_layer input.form-check-input-layer {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.map-drawer-layers {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.toggle-button.map-drawer-toggle.is-active {
  background-color: rgba(0, 86, 179, 0.18);
  border-color: var(--map-accent);
  color: var(--map-accent-dark);
}

/* Drawer responsive */
@media (max-width: 768px) {
  .map-drawer {
    --drawer-width: min(340px, calc(100% - 56px));
    --drawer-left: 46px;
    top: 4%;
    bottom: var(--map-safe-bottom);
    height: auto;
    max-height: none;
  }

  .map-drawer-header {
    padding: 12px;
  }

  .map-drawer-title {
    font-size: 12px;
  }

  .map-drawer-tab {
    font-size: 10px;
    min-height: 32px;
  }

  #toolsContainer.tools-container,
  .tools-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(78px, auto);
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .map-drawer {
    --drawer-width: calc(100% - 48px);
    --drawer-left: 46px;
    top: 3%;
    bottom: var(--map-safe-bottom);
    height: auto;
    max-height: none;
    border-radius: 12px;
  }

  .map-drawer-header {
    padding: 10px 10px 10px;
    gap: 8px;
    border-radius: 12px 12px 0 0;
  }

  .map-drawer-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .map-drawer-subtitle {
    display: none;
  }

  .map-drawer-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .map-drawer-tabs {
    padding: 6px;
  }

  .map-drawer-panel {
    padding: 10px 10px 16px;
  }

  #toolsContainer.tools-container,
  .tools-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(78px, auto);
  }

  #toolsContainer .tool-icon-box,
  .tools-container .tool-icon-box {
    width: 40px;
    height: 40px;
  }

  #toolsContainer .tool-icon-box i,
  .tools-container .tool-icon-box i {
    font-size: 14px;
  }

  .map-drawer-tab {
    font-size: 9px;
    gap: 2px;
    padding: 6px 2px;
  }

  #map-drawer #herramientas_mapas .boton-modal,
  #map-drawer #herramientas_layer .boton-modal {
    width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  #map-drawer #herramientas_mapas .icono-grande {
    width: 30px !important;
    height: 30px !important;
  }
}

@media (max-width: 360px) {
  .map-drawer {
    --drawer-width: calc(100% - 42px);
    --drawer-left: 44px;
    top: 2%;
    bottom: var(--map-safe-bottom);
    height: auto;
    max-height: none;
  }

  .map-drawer-tab {
    font-size: 10px;
    gap: 4px;
    padding: 8px 4px;
  }

  .map-drawer-grupos,
  #map-drawer #herramientas_mapas,
  #map-drawer #herramientas_layer {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  #map-drawer #herramientas_mapas .boton-modal,
  #map-drawer #herramientas_layer .boton-modal {
    width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  #map-drawer #herramientas_mapas .icono-grande {
    width: 30px !important;
    height: 30px !important;
  }
}

/* Legacy #herramientas: ya no se usa como panel flotante */
#herramientas {
  display: none !important;
}

#herramientas.mostrar-herramientas {
  display: none !important;
}

.main-tools-wrapper {
  display: none !important;
}

#toolsContainer.tools-container,
.tools-container {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(78px, auto);
  gap: 8px;
  padding: 6px 0 10px !important;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  justify-items: stretch;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#toolsContainer .icono-background,
.tools-container .icono-background {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px;
  width: 100% !important;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  margin: 0 !important;
  padding: 8px 4px !important;
  border-radius: 10px !important;
  background: #f8faf9 !important;
  border: 1px solid rgba(0, 86, 179, 0.18) !important;
  box-shadow: none !important;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#toolsContainer .icono-background:hover,
.tools-container .icono-background:hover {
  background: rgba(0, 86, 179, 0.08) !important;
  border-color: rgba(0, 86, 179, 0.4) !important;
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.12) !important;
  transform: none !important;
}

#toolsContainer .icono-background.selected,
.tools-container .icono-background.selected {
  background: rgba(0, 86, 179, 0.14) !important;
  border-color: var(--map-accent, #0056b3) !important;
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.16) !important;
  color: inherit !important;
}

#toolsContainer .tool-icon-box,
.tools-container .tool-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(0, 86, 179, 0.22);
  color: var(--map-accent-dark, #004792);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#toolsContainer .icono-background:hover .tool-icon-box,
.tools-container .icono-background:hover .tool-icon-box {
  background: rgba(0, 86, 179, 0.1);
  border-color: var(--map-accent, #0056b3);
}

#toolsContainer .icono-background.selected .tool-icon-box,
.tools-container .icono-background.selected .tool-icon-box {
  background: var(--map-accent, #0056b3);
  border-color: var(--map-accent, #0056b3);
  color: #fff;
}

#toolsContainer .icono-background.selected .tool-icon-box i,
.tools-container .icono-background.selected .tool-icon-box i {
  color: #fff !important;
}

#toolsContainer .tool-icon-box i,
.tools-container .tool-icon-box i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 16px;
  color: inherit;
  transform: none !important;
}

#toolsContainer .tool-label,
.tools-container .tool-label {
  display: -webkit-box;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: #334155;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

#toolsContainer .boton-modal,
.tools-container .boton-modal {
  width: 100% !important;
  height: 100% !important;
  min-width: 44px;
  min-height: 48px;
  max-height: 72px;
  border-radius: 12px !important;
  margin: 0 !important;
  background: #f1f5f4;
  color: var(--map-accent-dark, #004792);
  box-shadow: none;
  border: 1px solid rgba(0, 86, 179, 0.12);
  font-size: 16px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#toolsContainer .boton-modal:hover,
.tools-container .boton-modal:hover {
  background: rgba(0, 86, 179, 0.15);
  border-color: rgba(0, 86, 179, 0.35);
  transform: none;
}

#toolsContainer .boton-modal img,
.tools-container .boton-modal img {
  max-width: 55%;
  max-height: 55%;
  object-fit: contain;
}

.leaflet-top.leaflet-left {
  z-index: 1210;
  top: var(--map-top-offset);
  left: 8px;
  width: calc(var(--map-tool-size) + 12px);
  height: auto;
  max-height: calc(100% - var(--map-top-offset) - var(--map-safe-bottom) - 12px);
  overflow: visible;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--map-tool-gap);
}

.leaflet-draw-section {
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  width: auto !important;
  position: relative !important;
}

.leaflet-draw-toolbar,
.leaflet-draw-toolbar-top {
  margin-top: 0 !important;
}


#herramientas .grupo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 5px;
}

#herramientas .boton-modal {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
}

#herramientas .boton-modal:hover {
  transform: scale(1.1);
}

#herramientas .boton-modal:active {
  transform: scale(0.95);
}

#herramientas .icono-contenedor {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  transition: background-color 0.2s ease;
}

#herramientas .boton-modal:hover .icono-contenedor {
  background-color: rgba(255, 255, 255, 0.25);
}


#herramientas .icono-contenedor img {
  max-width: 200%;
  max-height: 500%;
  width: auto;
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#herramientas .nombre {
  color: #2c3e50;
  font-size: 12px;
  margin-top: 5px;
  text-align: center;
  text-shadow: none;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Asegurar visibilidad en pantallas peque?as */
@media (max-width: 768px) {
  #herramientas {
    bottom: 50px !important;
    padding: 0;
    gap: 0;
    max-width: 96%;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-radius: 12px;
  }
  
  #herramientas .icono-contenedor {
    width: 35px;
    height: 35px;
    padding: 6px;
  }
  
  #herramientas .nombre {
    font-size: 11px;
    max-width: 60px;
  }
}

@media (max-width: 480px) {
  #herramientas {
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin: 0 10px;
    border-radius: 10px;
  }
}

@media (max-width: 360px) {
  #herramientas {
    bottom: 35px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin: 0 8px;
    border-radius: 8px;
  }
}

/* Scroll horizontal t?ctil mejorado para m?viles */
@media (max-width: 768px) {
  #herramientas_mapas {
    /* Scroll t?ctil nativo mejorado */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
  }
  
  /* Snap points para mejor navegaci?n */
  #herramientas_mapas .grupo-icono {
    scroll-snap-align: center;
  }
}

/* Animaci?n de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

#herramientas.show {
  animation: fadeInUp 0.3s ease-out forwards;
}

/* Asegurar posici?n al mostrarse ? ahora usa drawer */
#herramientas.mostrar-herramientas {
  display: none !important;
}
/* Override AdminLTE padding */
.content-header {
  padding: 0 !important;
  margin: 0 !important;
  height: 0 !important;
}

.content-wrapper {
  min-height: 100vh !important; 
  padding: 0 !important;
  margin: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

.container-fluid {
  padding: 0 !important;
  margin: 0 !important;
}

/* Layout containers */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map {
  position: absolute !important;
  top: var(--map-navbar-height) !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100vh - var(--map-navbar-height)) !important;
  height: calc(100dvh - var(--map-navbar-height)) !important;
  z-index: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.leaflet-bottom {
  margin-bottom: var(--map-safe-bottom);
}

#map.map-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 249, 0.55);
  z-index: 2000;
  pointer-events: none;
}

#map-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2001;
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #2c3e50;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--map-control-shadow);
  border: 1px solid rgba(0, 86, 179, 0.3);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

#map.map-loading #map-loader {
  display: flex;
}

#map-loader .spinner-dot {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 86, 179, 0.25);
  border-top-color: var(--map-accent);
  border-radius: 50%;
  animation: map-spin 0.7s linear infinite;
}

@keyframes map-spin {
  to { transform: rotate(360deg); }
}

/* Ocultar el footer */
.main-footer {
  display: none !important;
}

/* Asegurar que los contenedores internos no tengan m?rgenes */
.card, .card-body {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}


.leaflet-control-container {
  z-index: 1000 !important;
}

/* Ajustar el control de escala betterscale */
.leaflet-control-betterscale {
  margin-bottom: 24px !important;
  margin-right: 10px !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  padding: 4px !important;
  border-radius: 6px !important;
  box-shadow: var(--map-control-shadow) !important;
  border: 1px solid rgba(0, 86, 179, 0.2) !important;
  transform: scale(1.15);
  transform-origin: bottom right;
  position: relative !important;
  z-index: 1001 !important;
}

/* Ajustar los botones de zoom / barra izquierda alineada */
.leaflet-top.leaflet-left {
  top: var(--map-top-offset);
  left: 8px;
  width: calc(var(--map-tool-size) + 12px);
  height: auto;
  max-height: calc(100% - var(--map-top-offset) - var(--map-safe-bottom) - 12px);
  overflow: visible;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--map-tool-gap);
}

.leaflet-top.leaflet-left > .leaflet-control {
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
  clear: both !important;
  width: var(--map-tool-size) !important;
  min-width: var(--map-tool-size);
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px !important;
  border-radius: var(--map-control-radius) !important;
  background: var(--map-control-bg) !important;
  box-shadow: var(--map-control-shadow) !important;
  border: 1px solid rgba(0, 86, 179, 0.2) !important;
}

.leaflet-top.leaflet-left > .leaflet-draw {
  width: auto !important;
  min-width: var(--map-tool-size);
  max-width: none !important;
  overflow: visible !important;
  align-items: flex-start !important;
}

.leaflet-control-zoom {
  margin: 0 0 var(--map-tool-gap) 0 !important;
  clear: both !important;
  position: relative !important;
  z-index: 1001 !important;
  border-radius: var(--map-control-radius);
  overflow: visible;
  background: var(--map-control-bg);
  box-shadow: var(--map-control-shadow);
  border: 1px solid rgba(0, 86, 179, 0.2);
  padding: 2px;
}

@media (max-width: 768px) {
  .leaflet-control-zoom {
    margin-top: 0 !important;
  }
}

@media (max-width: 576px) {
  .leaflet-control-zoom {
    margin-top: 0 !important;
  }
}
.leaflet-control-zoom-in, 
.leaflet-control-zoom-out {
  border-radius: 5px !important;
  width: var(--map-tool-size) !important;
  height: var(--map-tool-size) !important;
  line-height: var(--map-tool-size) !important;
  text-align: center;
  font-size: clamp(14px, 1.8vh, 16px);
  font-weight: bold;
  background-color: #fff;
  color: #333;
  border: none !important;
  box-shadow: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  margin-bottom: var(--map-tool-gap) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.leaflet-control-zoom-in {
  margin-bottom: var(--map-tool-gap);
}

/* Controles Leaflet: no anular transforms globales */
.leaflet-control {
  clear: both !important;
  pointer-events: auto !important;
}
/* Ajustar el margin-top para ruler tool */
.leaflet-ruler {
  margin-top: 12px !important;
  position: relative !important;
  z-index: 1001 !important;
}

/* Asegurarse de que los botones y la interfaz del ruler sean visibles */
.leaflet-ruler .leaflet-ruler-clicked {
  margin-top: 5px !important;
}

.leaflet-ruler .result-tooltip {
  background-color: white !important;
  border: 1px solid #ccc !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4) !important;
  font-size: 12px !important;
  z-index: 1002 !important;
}

/* Cancelar medici?n: por encima del drawer (z-index 1200) */
#cancelar-medicion {
  position: absolute !important;
  bottom: 90px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 1300 !important;
  padding: 10px 16px !important;
  background: #dc3545 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  pointer-events: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#cancelar-medicion:hover {
  background: #c82333 !important;
}

#cancelar-medicion button {
  background-color: #f44336 !important;
  color: white !important;
  border: none !important;
  padding: 8px 15px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-weight: bold !important;
  transition: background-color 0.3s !important;
}

#cancelar-medicion button:hover {
  background-color: #d32f2f !important;
}

/* Ajuste para dispositivos m?viles */
@media (max-width: 768px) {
  .leaflet-ruler {
    margin-top: 65px !important;
  }
  
  #cancelar-medicion {
    bottom: 70px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    z-index: 1300 !important;
  }
  
  #cancelar-medicion button {
    padding: 6px 12px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 576px) {
  .leaflet-ruler {
    margin-top: 55px !important;
  }
  
  #cancelar-medicion {
    bottom: 56px !important;
    max-width: calc(100% - 24px);
  }
}


/* Estilos para cada grupo */
.grupo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 10px;
  transition: all 0.2s ease;
}

.grupo:hover {
  transform: translateY(-3px);
}

/* Estilo para el bot?n modal */
.boton-modal {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Contenedor del icono */
.icono-contenedor {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.boton-modal:hover .icono-contenedor {
  background-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Imagen del icono */
.icono-contenedor img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

/* Nombre del grupo */
.nombre {
  margin-top: 5px;
  font-size: 12px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.form-check-layer {
  display: flex;
  align-items: center;
  background-color: #f8faf9;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(0, 86, 179, 0.18);
  cursor: pointer;
  min-height: 48px;
  width: 100%;
  box-sizing: border-box;
}

.form-check-layer:hover {
  background-color: rgba(0, 86, 179, 0.08);
  border-color: rgba(0, 86, 179, 0.4);
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.12);
}

.form-check-label-layer {
  color: #334155;
  font-size: 13px;
  margin-left: 10px;
  font-weight: 600;
  user-select: none;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-check-label-layer i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  color: var(--map-accent-dark, #004792);
}

.form-check-input-layer {
  accent-color: var(--map-accent, #0056b3);
  width: 18px;
  height: 18px;
  cursor: pointer;
  border: 2px solid rgba(0, 86, 179, 0.45);
  border-radius: 4px;
  flex-shrink: 0;
}

/* Responsive para form-check-layer */
@media (max-width: 768px) {
  .form-check-layer {
    padding: 10px 12px;
    min-height: 45px;
  }
  
  .form-check-label-layer {
    font-size: 13px;
  }
  
  .form-check-label-layer i {
    font-size: 14px;
  }
  
  .form-check-input-layer {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .form-check-layer {
    padding: 8px 10px;
    min-height: 42px;
  }
  
  .form-check-label-layer {
    font-size: 12px;
    margin-left: 8px;
    gap: 6px;
  }
  
  .form-check-label-layer i {
    font-size: 13px;
    width: 18px;
  }
  
  .form-check-input-layer {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 360px) {
  .form-check-layer {
    padding: 6px 8px;
    min-height: 38px;
  }
  
  .form-check-label-layer {
    font-size: 11px;
    margin-left: 6px;
    gap: 5px;
  }
  
  .form-check-label-layer i {
    font-size: 12px;
    width: 16px;
  }
  
  .form-check-input-layer {
    width: 14px;
    height: 14px;
  }
}



.info-box-icon {
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 15px;
}

.info-box-content {
  display: flex;
  flex-direction: column;
}

.info-box-text {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

.info-box-number {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

/* Iconos container */
.iconos-container {
  position: relative;
  z-index: 1000;
  padding: 2px !important;
  border-radius: var(--map-control-radius);
  box-shadow: var(--map-control-shadow);
  background: var(--map-control-bg);
  border: 1px solid rgba(0, 86, 179, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: var(--map-tool-gap) 0 0 0 !important;
  overflow: visible;
  width: var(--map-tool-size) !important;
  min-width: var(--map-tool-size);
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Separaci?n entre bot?n A (texto) y men? hamburguesa */
.leaflet-top.leaflet-left > .leaflet-bar {
  margin: 0 0 10px 0 !important;
  width: var(--map-tool-size) !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
}

.leaflet-top.leaflet-left > .leaflet-bar a.leaflet-control-draw-text,
.leaflet-control-draw-text {
  margin: 0 !important;
  border: 1px solid rgba(0, 86, 179, 0.2) !important;
  background: var(--map-control-bg) !important;
  box-shadow: var(--map-control-shadow) !important;
}

/* Button styles */
.toggle-button {
  width: var(--map-tool-size);
  height: var(--map-tool-size);
  border-radius: 5px;
  background-color: #fff;
  border: 1px solid rgba(0, 86, 179, 0.35);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(14px, 1.8vh, 16px);
  color: var(--map-accent-dark);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  margin: 0;
}

.toggle-button:hover {
  background-color: rgba(0, 86, 179, 0.12);
  border-color: var(--map-accent);
}

.boton-modal {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #ffffff;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.boton-modal:hover {
  transform: scale(1.1);
  background-color: #0056b3;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.boton-modal img {
  max-width: 100%;
  max-height: 100%;
  vertical-align: middle;
}

/* Tool containers */
.herramientas-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}

.grupo-herramienta {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#toolsContainer.tools-container,
.tools-container {
  margin-top: 4px;
}

.grupo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 20px;
}

/* Layer tiles: hereda grilla de .map-drawer-grupos; anula lista vertical legacy */
#herramientas_layer.map-drawer-grupos,
#map-drawer #herramientas_layer.map-drawer-layers.map-drawer-grupos {
  display: grid !important;
  flex-direction: unset !important;
  align-items: unset !important;
  align-content: start !important;
}

#herramientas_layer::after {
  display: none !important;
  content: none !important;
}

@media (max-width: 768px) {
  #herramientas_layer::after,
  #herramientas_layer.scroll-hint::after {
    display: none !important;
    content: none !important;
  }
}

@media (max-width: 480px) {
  #herramientas_layer.scroll-hint::after {
    display: none !important;
    content: none !important;
  }
}

@media (max-width: 360px) {
  #herramientas_layer.scroll-hint::after {
    display: none !important;
    content: none !important;
  }
}

/* Drawer Layers: reforzar lista (evita overrides legacy abajo) */
#map-drawer .form-check-layer {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background-color: #f8faf9;
  border: 1px solid rgba(0, 86, 179, 0.18);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 48px;
  width: 100%;
  box-sizing: border-box;
}

#map-drawer .form-check-layer:hover {
  background-color: rgba(0, 86, 179, 0.08);
  border-color: rgba(0, 86, 179, 0.4);
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.12);
}

#map-drawer .form-check-input-layer {
  margin-right: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--map-accent, #0056b3);
  flex-shrink: 0;
}

#map-drawer .form-check-label-layer {
  margin: 0 0 0 10px;
  white-space: normal;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.form-check-label {
  margin: 0;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 500;
}

/* Icon backgrounds */
.icono-background {
  padding: 20px;
  margin-right: 20px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icono-background i {
  color: #000000;
  font-size: 18px;
}

.icono-background:hover {
  background-color: #f4f4f4;
}

.icono-background:hover i {
  transform: scale(1.2);
}

.icono-background.selected {
  background-color: #007bff;
  color: white;
}

.icono-background:last-child {
  margin-right: 0;
}

/* Group containers */
.group-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.group-container h3 {
  margin-left: 10px;
  font-size: 1.5rem;
}

.group-container i {
  font-size: 2rem;
  color: #007bff;
  background-color: #3b3838;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
}

/* Modal styles */
.modal-lg {
  max-width: 80%;
}

.modal-dialog-aside {
  flex: 0 0 auto;
  max-width: none;
}

.modal-content {
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.modal-header {
  background: linear-gradient(135deg, var(--map-accent, #0056b3) 0%, var(--map-accent-deep, #003d82) 100%);
  color: #fff;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.modal-title {
  font-size: 1.5rem;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  background-color: rgba(248, 249, 250, 0.9);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.modal-dialog {
  max-width: 800px;
}

/* List styles */
.lista {
  list-style-type: none;
  padding: 0;
  margin: 20px;
}

.lista-item {
  background-color: #f9f9f9;
  padding: 10px;
  margin-bottom: 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.lista-item:hover {
  background-color: #e9e9e9;
}

.nombre {
  font-weight: bold;
  color: #ece0e0;
}

.coordinates {
  color: #777;
}

.lista-resultados {
  max-height: 200px;
  overflow-y: auto;
}

/* Leaflet controls hover effects */
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background-color: #f0f0f0;
  color: #000;
  transform: scale(1.1);
}

.leaflet-control-zoom-in:active,
.leaflet-control-zoom-out:active {
  background-color: #e0e0e0;
  transform: scale(0.95);
}

.leaflet-control-coordinates {
  position: absolute;
  top: 10px;
  transform: translateX(50%);
}

.leaflet-control-layers {
  display: none;
}

/* Leaflet draw toolbar */
.leaflet-draw-toolbar {
  border-radius: var(--map-control-radius) !important;
  overflow: visible;
  box-shadow: none !important;
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin: 0 0 var(--map-tool-gap) 0 !important;
  width: 100% !important;
}

.leaflet-draw-toolbar a {
  background-color: white;
  border: none;
  width: var(--map-tool-size) !important;
  height: var(--map-tool-size) !important;
  line-height: var(--map-tool-size) !important;
  text-align: center;
  color: #333;
  transition: background-color 0.2s ease, color 0.2s ease;
  border-radius: 5px !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  background-size: 18px 18px !important;
  font-size: clamp(14px, 1.8vh, 16px) !important;
}

.leaflet-draw-toolbar a:hover {
  background-color: #f0f0f0;
  color: #000;
  transform: scale(1.1);
}

.leaflet-draw-toolbar a:active {
  background-color: #e0e0e0;
  transform: scale(0.95);
}

.leaflet-draw-toolbar a.leaflet-draw-draw-polyline,
.leaflet-draw-toolbar a.leaflet-draw-draw-polygon,
.leaflet-draw-toolbar a.leaflet-draw-draw-rectangle,
.leaflet-draw-toolbar a.leaflet-draw-draw-circle,
.leaflet-draw-toolbar a.leaflet-draw-draw-marker,
.leaflet-draw-toolbar a.leaflet-draw-draw-circlemarker,
.leaflet-draw-toolbar a.leaflet-draw-edit-edit,
.leaflet-draw-toolbar a.leaflet-draw-edit-remove {
  width: var(--map-tool-size) !important;
  height: var(--map-tool-size) !important;
  background-size: 18px 18px !important;
  font-size: clamp(14px, 1.8vh, 16px) !important;
}

.leaflet-draw-actions {
  left: calc(var(--map-tool-size) + 8px) !important;
  top: 0 !important;
  z-index: 1300 !important;
  white-space: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 86, 179, 0.2);
}

.leaflet-draw-actions li {
  display: inline-block;
  margin: 0;
}

.leaflet-draw-actions a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 0 !important;
  height: 32px !important;
  line-height: 32px !important;
  padding: 0 12px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: #f8fafc !important;
  color: #334155 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  text-decoration: none;
  transform: none !important;
}

.leaflet-draw-actions a:hover {
  background: #eef4fb !important;
  color: var(--map-accent-dark, #004792) !important;
  transform: none !important;
}

.leaflet-draw-actions li:first-child a {
  background: var(--map-accent, #0056b3) !important;
  color: #fff !important;
}

.leaflet-draw-actions li:first-child a:hover {
  background: var(--map-accent-dark, #004792) !important;
  color: #fff !important;
}

.leaflet-draw-actions li + li a {
  border-left: 1px solid rgba(0, 86, 179, 0.15) !important;
}

/* Leaflet popup styles */
.leaflet-popup-content-wrapper {
  background: white;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
  padding: 10px;
}

.leaflet-popup-content {
  display: flex;
  flex-direction: column;
}

.leaflet-popup-content table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
}

.leaflet-popup-content table th,
.leaflet-popup-content table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.leaflet-popup-content table th {
  background-color: #f2f2f2;
}

/* Button with search icon */
#layerControlModal .btn-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 40px;
  padding: 0 15px;
  background-color: #17a2b8;
  color: #fff;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  cursor: pointer;
  outline: none;
  text-decoration: none;
  font-size: 14px;
}

#layerControlModal .btn-circle:hover,
#layerControlModal .btn-circle:focus {
  background-color: #138496;
  border-color: #138496;
}

#layerControlModal .btn-circle i {
  margin-right: 8px;
  animation: heartbeat 1.5s infinite;
}

/* Marker styles */
.custom-div-icon {
  background: none;
  border: none;
}

.marker-icon {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.marker-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.marker-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(51, 51, 51, 0.8);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.custom-div-icon:hover .marker-icon {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

/* Estilos para marcadores de texto */
.leaflet-text-marker.leaflet-div-icon,
.leaflet-div-icon.leaflet-text-marker {
  background: transparent !important;
  border: none !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
}

.text-marker-wrap {
  position: relative;
  display: inline-block;
  width: max-content;
  max-width: min(320px, 80vw);
  white-space: nowrap;
}

.text-marker-content {
  background-color: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 6px 28px 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  display: inline-block;
  width: max-content;
  max-width: min(300px, 75vw);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid #3388ff;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.text-marker-content:hover {
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: #2e6da4;
}

.text-marker-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #dc3545;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
}

.text-marker-delete:hover {
  background: #c82333;
  transform: scale(1.08);
}

@media (hover: hover) and (pointer: fine) {
  .text-marker-delete {
    opacity: 0.85;
  }
  .text-marker-wrap:hover .text-marker-delete {
    opacity: 1;
  }
}

/* Estilos para popup de informaci?n de ruta */
.route-info-popup .leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25),
              0 5px 15px rgba(0, 0, 0, 0.15) !important;
  padding: 10px !important;
  background: white !important;
  overflow: hidden !important;
}

.route-info-popup .leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.route-info-popup .leaflet-popup-tip-container {
  display: block !important;
}

.route-info-popup .leaflet-popup-tip {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2) !important;
}

/* Estilo para el bot?n de texto en el control */
.leaflet-control-draw-text {
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.leaflet-control-draw-text:hover {
  background-color: #f0f0f0;
  border-color: #999;
}

/* Rosa de los vientos animation */
@keyframes subtleHeartbeat {
            0%, 100% {
                transform: scale(1);
            }
            25% {
                transform: scale(1.05);
            }
            50% {
                transform: scale(1);
            }
            75% {
                transform: scale(1.05);
            }
        }

        .rosa-vientos-animada {
            animation: subtleHeartbeat 3s ease-in-out infinite;
            transform-origin: center center;
            position: absolute;
            bottom: var(--map-safe-bottom);
            right: 20px;
            z-index: 1000;
            /* Default size for large screens */
            width: 170px;
            height: 162px;
        }

        .rosa-vientos-animada:hover {
            animation-play-state: paused;
        }

        /* Media queries for responsiveness */
        @media (max-width: 1024px) {
            .rosa-vientos-animada {
                width: 136px; /* 80% of original */
                height: 130px;
                bottom: var(--map-safe-bottom);
                right: 15px;
            }
        }

        @media (max-width: 768px) {
            .rosa-vientos-animada {
                width: 102px; /* 60% of original */
                height: 97px;
                bottom: var(--map-safe-bottom);
                right: 10px;
            }
        }

        @media (max-width: 480px) {
            .rosa-vientos-animada {
                width: 68px; /* 40% of original */
                height: 65px;
                bottom: var(--map-safe-bottom);
                right: 5px;
            }
        }

/* Sweet Alert styles */
.swal-container-top-end {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 10px;
}

.swal-popup-top-end {
  margin-top: 10px !important;
  margin-right: 10px !important;
}

.swal2-styled.swal2-confirm {
  background-color: #3085d6;
}

.swal2-styled.swal2-confirm:focus {
  box-shadow: 0 0 0 3px rgba(48, 133, 214, 0.5);
}

.swal2-popup {
  font-size: 0.9rem;
}

/* Por encima del drawer del mapa (1200) y Cancelar medici?n (1300) */
.swal2-container {
  z-index: 3000 !important;
}

/* Legend styles */
.legend-item {
  margin-bottom: 5px;
}

.legend-item span {
  display: inline-block;
  width: 20px;
  height: 10px;
  margin-right: 5px;
  border: 1px solid #ccc;
}

/* Area and measure styles */
.area-label {
  border: 1px solid #3388ff;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: bold;
  font-size: 16px;
}

.bold {
  font-weight: bold;
}

.measure-marker {
  background-color: white;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
}

/* Weather card */
.card {
  position: absolute;
  top: 50%;
  right: 50px;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  width: 250px;
  text-align: center;
}

h2 {
  color: #333;
  margin: 0 0 15px 0;
  font-size: 1.2em;
}

.temp {
  font-size: 2.5em;
  font-weight: 700;
  color: #1a73e8;
  margin: 10px 0;
}

.weather-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 15px;
  display: block;
}

.weather-info {
  font-size: 0.9em;
  color: #666;
  margin: 5px 0;
}

.loading {
  color: #666;
  font-style: italic;
}

/* Misc helpers */
.fa-check {
  color: #28a745;
  margin-left: 10px;
}

/* ============================================
   ESTILOS MEJORADOS PARA MODAL DE CONTROL DE CAPAS
   ============================================ */

/* Modal content */
.modal-capas-mejorado {
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: none;
  overflow: hidden;
}

/* Header */
.modal-header-capas {
  background: linear-gradient(135deg, var(--map-accent, #0056b3) 0%, var(--map-accent-deep, #003d82) 100%);
  color: white;
  padding: 20px 25px;
  border-bottom: none;
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 24px;
}

.modal-header-capas .modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.modal-close-btn {
  color: white;
  opacity: 1;
  font-size: 28px;
  font-weight: 300;
  text-shadow: none;
  transition: transform 0.3s ease;
}

.modal-close-btn:hover {
  transform: rotate(90deg);
  color: white;
}

/* Body */
.modal-body-capas {
  padding: 25px;
  background-color: #f8f9fa;
}

/* Search container */
.search-container-capas {
  position: relative;
  margin-bottom: 20px;
}

.search-icon-capas {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #0056b3;
  font-size: 16px;
  z-index: 10;
}

.search-input-capas {
  padding: 12px 15px 12px 45px;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-input-capas:focus {
  border-color: #0056b3;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
  outline: none;
}

/* Info box */
.capas-info-box {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #5e35b1;
  border-left: 4px solid #0056b3;
}

.capas-info-box i {
  font-size: 18px;
}

/* Checkbox container */
.checkbox-container-capas {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 5px;
}

.checkbox-container-capas::-webkit-scrollbar {
  width: 6px;
}

.checkbox-container-capas::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 10px;
}

.checkbox-container-capas::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
  border-radius: 10px;
}

.checkbox-container-capas::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #003d82 0%, #0056b3 100%);
}

/* Form check styling */
.checkbox-container-capas .form-check {
  background: white;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  position: relative;
}

.checkbox-container-capas .form-check:hover {
  border-color: #0056b3;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.checkbox-container-capas .form-check-input {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  border: 2px solid #0056b3;
}

.checkbox-container-capas .form-check-input:checked {
  background-color: #0056b3;
  border-color: #0056b3;
}

.checkbox-container-capas .form-check-label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  flex: 1;
  margin: 0;
}

.checkbox-container-capas .fa-check {
  color: #28a745;
  margin-left: 10px;
  animation: checkBounce 0.5s ease;
}

@keyframes checkBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Config button */
.btn-config-layer {
  background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  font-weight: 500;
}

.btn-config-layer:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #003d82 0%, #0056b3 100%);
}


/* Footer */
.modal-footer-capas {
  background-color: #f8f9fa;
  padding: 15px 25px;
  border-top: 1px solid #e0e0e0;
}

.btn-cerrar-capas {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
  border: none;
  border-radius: 20px;
  padding: 10px 25px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-cerrar-capas:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.btn-cerrar-capas i {
  margin-right: 5px;
}

/* Separator */
.checkbox-container-capas hr {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-header-capas {
    padding: 15px 20px;
  }
  
  .modal-body-capas {
    padding: 20px;
  }
  
  .modal-header-capas .modal-title {
    font-size: 18px;
  }
  
  .modal-icon {
    font-size: 20px;
  }
  
  .checkbox-container-capas .form-check {
    padding: 12px;
  }
}

/* Asegurar que los popups y tooltips est?n por encima */
.leaflet-popup, 
.leaflet-tooltip {
  z-index: 1002 !important;
}

/* Responsive styles */
@media (min-width: 992px) {
  .modal-dialog-aside {
    max-width: 30%;
    margin-left: auto;
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  #map {
    height: 100vh !important;
    height: 100dvh !important;
  }

  #herramientas {
    height: auto;
    bottom: 40px;
  }
  
  .form-check-label {
    font-size: 16px;
  }
  
  .grupo {
    margin: 5px 10px;
  }
  
  .icono-background {
    padding: 15px;
    margin-right: 10px;
  }
  
  .modal-lg {
    max-width: 95%;
  }
}

@media (max-width: 576px) {
  .form-check-label-layer {
    font-size: 12px;
  }
  
  #herramientas_layer {
    gap: 10px;
  }
  
  .icono-background {
    padding: 10px;
    margin-right: 5px;
  }
  
  .leaflet-control-zoom-in,
  .leaflet-control-zoom-out {
    width: var(--map-tool-size) !important;
    height: var(--map-tool-size) !important;
    font-size: clamp(14px, 1.8vh, 16px) !important;
  }
  
  .card {
    width: 200px;
    right: 30px;
  }
  
  .temp {
    font-size: 2em;
  }
  
  .weather-icon {
    width: 60px;
    height: 60px;
  }
}
.goodtimes-panel {
  margin: 15px 10px;
  background-color: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.goodtimes-panel:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.goodtimes-header {
  background-color: #007bff;
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: 600;
}

.goodtimes-header h5 {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.goodtimes-content {
  padding: 15px;
}

.goodtimes-logo {
  max-width: 120px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.goodtimes-panel:hover .goodtimes-logo {
  transform: scale(1.05);
}

/* Contenedor principal */
.info-territorial-container {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
  width: 100%;
  padding: 0;
  margin: 0;
}

/* Encabezado con t?tulo y bot?n de cierre */
.info-territorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px 12px 0 0;
  border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.info-territorial-header h3 {
  margin: 0;
  color: white;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive para info-territorial-header */
@media (max-width: 768px) {
  .info-territorial-header {
    padding: 10px 15px;
  }
  
  .info-territorial-header h3 {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .info-territorial-header {
    padding: 8px 12px;
  }
  
  .info-territorial-header h3 {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .info-territorial-header {
    padding: 6px 10px;
  }
  
  .info-territorial-header h3 {
    font-size: 13px;
  }
}

.btn-cerrar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-cerrar:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-cerrar:active {
  transform: scale(0.95);
}

/* Responsive para btn-cerrar */
@media (max-width: 768px) {
  .btn-cerrar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .btn-cerrar {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .btn-cerrar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* Contenedor para los iconos */
.herramientas-iconos-container {
  display: flex;
  flex-wrap: wrap;
  padding: 15px 20px;
  gap: 15px;
  justify-content: flex-start;
  overflow-x: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 0 0 12px 12px;
}

/* Estilo para cada grupo de icono */
.grupo-icono {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  min-width: 80px;
  flex: 0 0 auto;
}

/* Responsive para herramientas-iconos-container */
@media (max-width: 768px) {
  .herramientas-iconos-container {
    padding: 12px 15px;
    gap: 12px;
  }
  
  .grupo-icono {
    min-width: 75px;
  }
}

@media (max-width: 480px) {
  .herramientas-iconos-container {
    padding: 10px;
    gap: 10px;
  }
  
  .grupo-icono {
    min-width: 70px;
  }
}

@media (max-width: 360px) {
  .herramientas-iconos-container {
    padding: 8px;
    gap: 8px;
  }
  
  .grupo-icono {
    min-width: 65px;
  }
}

/* Iconos */
.icono-grande {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.icono-contenedor {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.boton-modal {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.boton-modal:hover {
  transform: scale(1.1);
}

.boton-modal:hover .icono-contenedor {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.boton-modal:hover .icono-grande {
  transform: scale(1.1) rotate(5deg);
}

.boton-modal:active {
  transform: scale(0.95);
}

/* Nombre del icono */
.nombre-icono {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: #334155;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.3;
}

/* Responsive para iconos */
@media (max-width: 768px) {
  .icono-grande {
    width: 44px;
    height: 44px;
  }
  
  .icono-contenedor {
    width: 55px;
    height: 55px;
  }
  
  .nombre-icono {
    font-size: 11px;
    max-width: 75px;
    margin-top: 6px;
  }
}

@media (max-width: 480px) {
  .icono-grande {
    width: 40px;
    height: 40px;
  }
  
  .icono-contenedor {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }
  
  .nombre-icono {
    font-size: 10px;
    max-width: 70px;
    margin-top: 5px;
  }
}

@media (max-width: 360px) {
  .icono-grande {
    width: 36px;
    height: 36px;
  }
  
  .icono-contenedor {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  
  .nombre-icono {
    font-size: 9px;
    max-width: 65px;
    margin-top: 4px;
  }
}


/* Coordenadas ancladas al mapa (no fixed al viewport) */
.leaflet-control-smooth-coordinates {
  position: absolute !important;
  top: 12px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 1000 !important;
  margin: 0 !important;
  max-width: 80% !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
  background-color: rgba(42, 41, 41, 0.85);
  padding: 8px 15px;
  border-radius: 8px;
  box-shadow: var(--map-control-shadow);
  font-size: 13px;
  color: #fff;
  text-align: center;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-weight: 500;
}

.leaflet-control-smooth-coordinates.clicked {
  background-color: rgba(255, 255, 255, 0.95);
  color: #333;
  transform: translateX(-50%) scale(1.03);
}

@media (max-width: 768px) {
  .leaflet-control-smooth-coordinates {
    max-width: 85% !important;
    font-size: 12px !important;
    padding: 6px 12px !important;
  }
}

@media (max-width: 640px) {
  .leaflet-control-smooth-coordinates {
    max-width: 90% !important;
    font-size: 11px !important;
    padding: 5px 10px !important;
    border-radius: 16px !important;
  }
}

/* Botones auth del header (p?gina mapa) */
.main-header .navbar-nav .btn-map-auth,
.main-header .navbar-nav .btn.btn-primary,
.main-header .navbar-nav .btn.btn-success {
  border-radius: 8px !important;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.main-header .navbar-nav .btn.btn-primary {
  background-color: #2b6cb0 !important;
}

.main-header .navbar-nav .btn.btn-success {
  background-color: var(--map-accent) !important;
}

.main-header .navbar-nav .btn.btn-primary:hover,
.main-header .navbar-nav .btn.btn-success:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.leaflet-draw-toolbar a:hover,
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background-color: rgba(0, 86, 179, 0.12) !important;
  color: var(--map-accent-dark) !important;
}

.leaflet-bar a,
.leaflet-control-draw-text {
  width: var(--map-tool-size) !important;
  height: var(--map-tool-size) !important;
  line-height: var(--map-tool-size) !important;
  border-radius: 6px !important;
  font-size: clamp(14px, 1.8vh, 16px) !important;
}

/* Botones del header (PDF / acciones) ? alineados a la paleta del mapa */
.main-header {
  z-index: 1040;
  overflow: visible;
}

.main-header .navbar,
.main-header .navbar-nav,
.main-header .nav-item.dropdown {
  overflow: visible;
}

.main-header .user-menu .dropdown-menu {
  z-index: 1050;
}

.nav-item-session-mapas[hidden],
.nav-item-session-mapas:not(.is-session-ready) {
  display: none !important;
}

.nav-item-session-mapas.is-session-ready {
  display: flex !important;
  align-items: center;
}

.mapas-predeterminados-btn,
.mapas-mis-pdf-btn {
  border-radius: 8px !important;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.mapas-predeterminados-btn:hover,
.mapas-mis-pdf-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#menu_superior .btn,
#menu_superior a.btn {
  border-radius: 8px !important;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  margin-left: 6px;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

#menu_superior .btn-primary {
  background-color: #2b6cb0 !important;
}

#menu_superior .btn-success {
  background-color: var(--map-accent, #0056b3) !important;
}

/* Texto en mapa */
.leaflet-text-marker .text-marker-content,
.text-marker-content {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 86, 179, 0.35);
  border-radius: 6px;
  padding: 4px 28px 4px 8px;
  color: #1a202c;
  font-weight: 600;
  box-shadow: var(--map-control-shadow);
  white-space: nowrap !important;
  word-break: normal !important;
}

.leaflet-control-draw-text {
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: var(--map-accent-dark, #004792) !important;
}
