/* --- Mapa y contenedor --- */
#mapa-container {
  position: relative;
  max-width: 650px;
  height: 751px;
  margin: 1px auto;
  border: 2px solid #faf1f1;
  background-color: #f5f5f5;
  border-radius: 25px;
  box-shadow: 0 0 12px #cee3db;
  font-family: Arial, sans-serif;
}

#mapa-lima {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  user-select: none;
}

/* Canvas debe cubrir todo el contenedor mapa */
#canvas-lineas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* Contenedores de enlaces y logos */
#enlaces-container,
#logos-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Enlaces distritos */
.enlace-distrito {
  position: absolute;
  pointer-events: auto;
  background: #1842B6;
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transform: translate(-50%, -50%);
  cursor: default;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.3s ease, background-color 0.3s ease;
  transform-origin: left center;
  z-index: 5;
}

.enlace-distrito:hover {
  background-color: #26D48C;
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 20;
}

/* Logos pequeños */
#logos-container img {
  position: absolute;
  width: 28px;
  height: 28px;
  user-select: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.3));
}

/* Logo principal */
#logo-principal {
  position: absolute;
  width: 99px;
  height: 99px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  user-select: none;
  animation: latir 1.5s infinite ease-in-out;
  cursor: default;
  filter: drop-shadow(0 0 5px rgba(0,123,255,0.8));
  z-index: 10;
}

@keyframes latir {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

/* Tooltip */
#tooltip {
  position: fixed;
  background: #21e2d4;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  max-width: 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.tooltip-visible {
  opacity: 1;
}

.tooltip-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Selector cobertura */
#selector-distrito {
  max-width: 650px;
  margin: 20px auto;
  padding: 15px;
  background-color: #f3f3f3;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  font-family: Arial, sans-serif;
}

#selector-distrito select {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 15px;
  margin-left: 10px;
}

#resultado-cobertura {
  margin-top: 12px;
  font-size: 16px;
  font-weight: bold;
  color: #1842B6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
}

/* Estilo botón WhatsApp integrado en resultado */
.cobertura-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
}

.cobertura-info a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #25d366;
  text-decoration: none;
  font-weight: bold;
  font-size: 16px;
}

.cobertura-info a img {
  width: 24px;
  height: 24px;
  display: block;
  user-select: none;
}

/* Contenedor principal (mapa + servicios) */
#main-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  max-width: 1000px;
  margin: 0 auto 40px;
}

/* Wrapper mapa */
#mapa-wrapper {
  flex: 0 0 650px;
}

#servicios-container {
  flex: 0 0 280px;
  background: #f9f9f9;
  border-radius: 20px;
  box-shadow: 0 0 12px #c4cac788;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: Arial, sans-serif;
  position: relative;
  overflow: hidden;
}

/* Título de los servicios */
#servicios-container h3 {
  margin: 0 0 10px 0;
  color: #1842B6;
  text-align: center;
  font-weight: bold;
}

/* Estilos para cada item de servicio */
.servicio-item {
  background: white;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 1s forwards;
}

/* Animación de desvanecimiento */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Estilos para las imágenes dentro de cada item */
.servicio-item img {
  max-width: 171%;
  max-height: 163px;
  object-fit: contain;
  border-radius: 9px;
  margin-bottom: 8px;
  transition: opacity 1s ease-in-out;
  opacity: 1;
  position: relative;
  z-index: 1;
}

/* Clase para aplicar el efecto de desvanecimiento */
.servicio-item img.fade-out {
  opacity: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: opacity 1s ease-in-out;
}

/* Responsive: servicios abajo en móvil */
@media (max-width: 700px) {
  #main-container {
    flex-direction: column;
    align-items: center;
  }

  #mapa-wrapper,
  #servicios-container {
    flex: none;
    width: 90%;
    max-width: 650px;
    margin-bottom: 20px;
  }

  #resultado-cobertura {
    flex-direction: column;
  }

  .cobertura-info {
    flex-direction: column;
  }
}

/* Botón centrado */
#boton-mapa-peru-container {
  text-align: center;
  margin-top: 30px;
}

#abrir-modal {
  background-color: #1842B6;
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.3s;
}

#abrir-modal:hover {
  background-color: #26D48C;
}

/* Estilos del modal */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-contenido {
  background-color: #f5f5f5;
  margin: 80px auto;
  padding: 20px;
  border-radius: 20px;
  width: 90%;
  max-width: 720px;
  position: relative;
  box-shadow: 0 0 12px #26D48C;
  text-align: center;
}

.cerrar-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  color: #1842B6;
  font-weight: bold;
  cursor: pointer;
}

.imagen-modal {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 10px;
}
