#chatbot-button {
  width: 56px;
  height: 56px;
  padding: 0;                    /* niente padding: usiamo flex per centrare */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;            /* cerchio perfetto con width=height */
  background: #2F6596 50%;
  color: #fff;
  cursor: pointer;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 999999;
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
  box-sizing: border-box;
}

#chatbot-bubble {
  position: fixed;
  bottom: 30px;
  left: 85px;           /* spostato a sinistra del pulsante */
  background: #fff;
  color: #152a48;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  font-size: 14px;
  max-width: 300px;
  z-index: 999998;
  animation: fadeInUp .4s ease-out;
}

.intro-list ul{
	padding-bottom: 0px;
}

.intro-list li{
	padding-left: 0px;
  list-style: disc;
	line-height: 1.5;
}

/* freccetta fumetto */
#chatbot-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 12px;
  border-width: 6px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,.1));
}

/* animazione ingresso */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#chatbot-button i{
  font-size: 24px;
  line-height: 1;
}


#chatbot-window {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 375px;
  height: 550px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  z-index: 999999;
}

.hidden { display: none !important; }

#chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 12px;
  background: radial-gradient(circle farthest-corner at 100% 110%, #3197A0 10%, #2F6596 50%);
  color: #fff;
  font-weight: bold;
  border-radius: 12px 12px 0 0;
  font-size: 16px;
}

.chat-title { display: flex; align-items: center; }

.chat-icon {
  width: 32px; height: 32px; border-radius: 50%; margin-right: 8px;
}

#close-btn {
  cursor: pointer; font-size: 18px; background: transparent; border: 0; color: #fff;padding: 0px; height:25px; box-shadow: none;
}

#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f9f9f9;
  
  border-radius: 10px;
}

.message {
  margin: 12px 0;
  padding: 8px 5px;
  border-radius: 10px;
  max-width: 82%;
  line-height: 1.50 !important;
  word-wrap: break-word;
  width: fit-content;
}



.user { background: #3197A0 10%; color: #fff; margin-left: auto; font-size: 14px;}
.bot  { background: #eee;    color: #000; margin-right: auto; font-size: 14px;}

#chat-input {
  display: flex;
  border-top: 1px solid #ddd;
}

#chat-input input {
  flex: 1;
  border: none;
  padding: 12px;
  outline: none;
  font-size: 14px;
}

#chat-input button {
  background: #3197A0 10%;
  color: #fff;
  border: none;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 0px;
}

/* Riga messaggio con avatar a lato (solo bot) */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
  border-radius: 10px;
}

/* Manteniamo la grafica dei bubble esistenti (.message .bot/.user) */
/* L'avatar sta fuori dal container del messaggio */
.msg-row .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 28px;
  margin-top: 15px;
  margin-left: 10px;
}

/* Il bubble bot resta identico: usa .message.bot già definito */
.msg-row.bot .message.bot {
  margin-right: auto; /* già presente su .bot, lo confermiamo */
}

/* Il container messaggi ospita ora righe: rimuovi margini verticali duplicati dai bubble */

.message.bot .intro-list { margin: 8px 0 0; padding-left: 18px; }
.message.bot .intro-list li { margin: 4px 0; }

/* Animazioni fade */
.fade-in  { animation: fadeIn .3s forwards;  }
.fade-out { animation: fadeOut .3s forwards; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}

/* Mobile responsive */
@media (max-width: 480px) {
  #chatbot-window {
    right: 10px;
    left: 10px;
    width: auto;
    height: 70vh;
    bottom: 90px;
  }
}

/* Stile rapido del form */
.message.bot fieldset { border-radius: 8px; border:1px solid #e3e7ee; }
.message.bot .form-group { margin-bottom: 10px; }
.message.bot .form-label { display:block; font-weight:600; margin-bottom:4px; font-size: 12px; }
.message.bot input[type="text"],
.message.bot input[type="email"]{
  width:100%; padding:10px; border-radius:8px; border:1px solid #d7dce2; font:inherit; height: 30px;
}
.message.bot .btn.btn-primary{
  background:#2F6596; border:0; border-radius:8px; padding:8px 14px; color:#fff; cursor:pointer;
}
.message.bot .invalid-feedback{font-size:10px}
.message.bot p { margin: 0 0 6px; }
.message.bot p:last-child { margin-bottom: 0; }
.message.bot .custom-control-label {font-size:12px}