/* Runtime CSS para mapas de Puntos de Interés */
.poi-map {
  --accent: #c1ab87;
  --bg: #ffffff;
  --fg: #2c3e50;
  --muted: #7f8c8d;
  --font-family: system-ui, -apple-system, sans-serif;
  
  position: relative;
  width: 100%;
  max-width: 100%;
  font-family: var(--font-family);
  color: var(--fg);
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
}

.poi-map__stage {
  position: relative !important;
  width: 100% !important;
  display: block !important;
  line-height: 0 !important; /* evita huecos que desplazan posiciones en porcentajes */
  overflow: visible !important; /* Permitir que los POIs se muestren fuera si es necesario */
}

.poi-map__map-image {
  width: 100% !important;
  display: block !important;
  user-select: none !important;
  vertical-align: top !important; /* elimina gap de línea que altera % */
  position: relative !important;
  z-index: 1 !important;
}

.poi-map__poi {
  position: absolute !important;
  width: 36px !important;
  height: 48px !important;
  cursor: pointer !important;
  transition: transform 0.2s ease, filter 0.2s ease !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  outline: none !important;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  /* Escalado basado en el tamaño del mapa */
  transform-origin: center bottom !important;
  /* Posicionamiento: centrar horizontalmente y anclar desde abajo */
  transform: translate(-50%, -100%) scale(var(--map-scale, 1)) !important;
  /* Asegurar que los POIs estén sobre la imagen */
  pointer-events: auto !important;
}

.poi-map__poi .pin-shape {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
  pointer-events: none !important;
}

.poi-map__poi .pin-shape svg {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

.poi-map__poi .pin-shape svg path {
  fill: var(--accent) !important;
}

.poi-map__poi .pin-rot { 
  position: absolute !important; 
  inset: 0 !important; 
  transform-origin: 50% 50% !important;
  width: 100% !important;
  height: 100% !important;
}

.poi-map__poi:hover {
  transform: translate(-50%, -100%) scale(1.15) !important;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)) !important;
  z-index: 15 !important;
}

.poi-map__poi:focus {
  outline: none;
}

.poi-map__poi .category-icon {
  width: 20px !important;
  height: 20px !important;
  fill: white !important;
  color: white !important;
  position: absolute !important;
  top: var(--icon-top, 6px) !important;
  left: var(--icon-left, 50%) !important;
  transform: translate(var(--icon-translate-x, -50%), var(--icon-translate-y, 0)) !important;
  z-index: 3 !important;
  transition: transform 0.2s !important;
  /* Asegurar que el icono se mantiene centrado en todos los tamaños */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
}

/* Forzar que cualquier path del SVG herede el color configurado y tamaño correcto */
.poi-map__poi .category-icon svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  fill: currentColor !important;
  color: currentColor !important;
  display: block !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
}

.poi-map__poi .category-icon svg * {
  fill: currentColor !important;
  color: currentColor !important;
}

/* Asegurar que los SVGs con viewBox grandes no se rendericen enormes */
.poi-map__poi .category-icon svg[viewBox] {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

.poi-map__poi .pin-arrow {
  position: absolute !important;
  top: 100% !important;
  left: 50% !important;
  transform-origin: center top !important;
  transform: translate(-50%, 4px) !important;
  width: 0 !important;
  height: 0 !important;
  border-left: 6px solid transparent !important;
  border-right: 6px solid transparent !important;
  border-top: 10px solid var(--accent) !important;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)) !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

/* Tarjeta Informativa */
.poi-map__card {
  position: absolute;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
}

.poi-map__card.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.poi-map__card-header {
  padding: 16px;
  border-bottom: 1px solid #ecf0f1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.poi-map__card-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.poi-map__card-icon svg {
  width: 28px;
  height: 28px;
}

/* Forzar que los SVGs de las tarjetas usen el color del contenedor */
.poi-map__card-icon svg,
.poi-map__card-icon svg * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

.poi-map__card-title {
  flex: 1;
}

.poi-map__card-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.poi-map__card-category {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.poi-map__card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.poi-map__card-body {
  padding: 16px;
}

.poi-map__card-distance {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 16px;
  color: var(--muted);
}

.poi-map__card-distance span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poi-map__card-distance svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.poi-map__card-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg);
  margin: 0;
}

.poi-map__card-footer {
  padding: 12px 16px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  gap: 8px;
}

.poi-map__card-link {
  flex: 1;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.poi-map__card-link:hover {
  opacity: 0.9;
}

.poi-map__card-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s;
  z-index: 10;
}

.poi-map__card-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* Overlay para cerrar */
.poi-map__overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.poi-map__overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Responsive */
@media (max-width: 768px) {
  .poi-map__poi {
    width: 30px;
    height: 40px;
  }

  .poi-map__poi::before {
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 40'%3e%3cpath d='M15 0C6.716 0 0 6.716 0 15c0 8.284 15 25 15 25s15-16.716 15-25C30 6.716 23.284 0 15 0z'/%3e%3c/svg%3e");
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 40'%3e%3cpath d='M15 0C6.716 0 0 6.716 0 15c0 8.284 15 25 15 25s15-16.716 15-25C30 6.716 23.284 0 15 0z'/%3e%3c/svg%3e");
  }

  .poi-map__poi .category-icon {
    width: 18px;
    height: 18px;
    top: 5px;
    left: 8px;
  }

  .poi-map__card {
    position: fixed;
    width: 100%;
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    max-height: 60vh;
  }

  .poi-map__card-image {
    height: 150px;
  }

  .poi-map__card-header {
    padding: 12px;
  }

  .poi-map__card-body {
    padding: 12px;
  }

  .poi-map__card-icon {
    width: 40px;
    height: 40px;
  }

  .poi-map__card-icon svg {
    width: 24px;
    height: 24px;
  }
}

/* Animaciones */
@keyframes poi-pulse {
  0%, 100% {
    transform: translate(-50%, -100%) scale(1);
  }
  50% {
    transform: translate(-50%, -100%) scale(1.1);
  }
}

.poi-map__poi--pulse {
  animation: poi-pulse 2s ease-in-out infinite;
}

/* Ajustes específicos para móvil - iconos centrados */
@media (max-width: 768px) {
  .poi-map__poi {
    /* Ajustar el tamaño del pin en móvil */
    width: 32px;
    height: 42px;
  }
  
  .poi-map__poi .category-icon {
    /* Ajustar el tamaño del icono en móvil */
    width: 18px;
    height: 18px;
    /* Asegurar centrado perfecto */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Para pins rotados, ajustar el centro de rotación */
  .poi-map__poi .pin-rot .category-icon {
    transform: translate(-50%, -50%) rotate(var(--rotation, 0deg));
  }
}

@media (max-width: 480px) {
  .poi-map__poi {
    /* Pin aún más pequeño en pantallas muy pequeñas */
    width: 28px;
    height: 38px;
  }
  
  .poi-map__poi .category-icon {
    /* Icono más pequeño pero bien centrado */
    width: 16px;
    height: 16px;
  }
}

