
#chatwithus {
  position: fixed;
  padding: 10px;
  background: #fff;
  z-index: 9999999;
  border-radius: 50%; /* Rende il contenitore rotondo */
  box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* Aggiunge un'ombra per un effetto flottante */
}
 
@media only screen and (max-width: 960px) {
  #chatwithus {
    bottom: 15px;
    left: 15px;
    top: auto;
    right: auto;
  }
}
  
#chatwithus #popup {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 100%;
  min-width: 300px; /* Larghezza minima per desktop */
  height: auto;
  background-color: #fff;
  z-index: 1000;
  padding: 20px;
  -webkit-box-shadow: 10px 10px 20px 0 rgba(0, 0, 0, 0.2);
  box-shadow: 10px 10px 20px 0 rgba(0, 0, 0, 0.2);
  text-align: center;
  border-radius: 8px; /* Bordi arrotondati */
}
#chatwithus #popup #arrow {
  content="";
  position:absolute;
  bottom:0;
  left:0;
  width: 100px;
  height: 100px;
  background-size: cover;
}
#chatwithus #popup img {
  max-width: 100%; /* Immagine responsive */
  height: auto;
  border-radius: 8px 8px 0 0; /* Arrotonda gli angoli superiori dell'immagine */
  display: block;
}
#chatwithus #popup h3 {
  margin: 0 auto;
  padding: 10px 0;
}

/* --- Posizionamento Desktop --- */

/* Default: Bottom Left (bl) */
.dcw-position-bl {
  bottom: 20px;
  left: 20px;
}
.dcw-position-bl #popup {
  bottom: 100%;
  left: 100%;
}
.dcw-position-bl #popup #arrow {
  bottom: 0;
  left: 0;
}

/* Bottom Right (br) */
.dcw-position-br {
  bottom: 20px;
  right: 20px;
}
.dcw-position-br #popup {
  bottom: 100%;
  right: 100%;
  left: auto;
}
.dcw-position-br #popup #arrow {
  bottom: 0;
  right: 0;
  left: auto;
  transform: scaleX(-1);
}

/* Top Right (tr) */
.dcw-position-tr {
  top: 20px;
  right: 20px;
}
.dcw-position-tr #popup {
  top: 100%;
  right: 100%;
  bottom: auto;
  left: auto;
}
.dcw-position-tr #popup #arrow {
  top: 0;
  right: 0;
  bottom: auto;
  left: auto;
  transform: rotate(180deg);
}

/* Top Left (tl) */
.dcw-position-tl {
  top: 20px;
  left: 20px;
}
.dcw-position-tl #popup {
  top: 100%;
  left: 100%;
  bottom: auto;
}
.dcw-position-tl #popup #arrow {
  top: 0;
  left: 0;
  bottom: auto;
  transform: scaleY(-1);
}

@media only screen and (max-width: 960px) {
  #chatwithus #popup {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100px;
    width: 90vw;
    max-width: 350px;
    min-width: 280px;
    border-radius: 15px;
  }
  /* Nascondiamo la freccia decorativa su mobile perché è posizionata per desktop */
  #chatwithus #popup #arrow {
    display: none;
  }
  #chatwithus #popup img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
  }
  #chatwithus #popup .close {
    font-size: 36px;
    padding: 10px;
  }
}

#chatwithus #popup .close {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}