/* Pulsante flottante dell'assistente AI */
#ai-assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1002;
  width: 58px;
  height: 58px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #68855e, #3e5d40);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 8px 24px rgba(42, 65, 39, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.24);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Stile per l'icona all'interno del bottone */
#ai-assistant-fab i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* Centra l'icona perfettamente */

  font-size: 21px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

#ai-assistant-fab .ai-fab-icon {
  position: relative;
  inset: auto;
  width: 22px;
  height: 22px;
  transform: none;
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
  stroke-width: 2;
  z-index: 2;
}

/* Effetto al passaggio del mouse */
#ai-assistant-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px rgba(42, 65, 39, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.24);
}

/* Sovrascrive lo stile generico per mantenere l'icona verde anche in hover */
#ai-assistant-fab:hover i {
  color: #ffffff !important;
}

#ai-assistant-fab:hover .ai-fab-icon { color: #ffffff !important; }

#ai-assistant-fab.is-chat-open {
  pointer-events: none;
  opacity: 0;
  transform: scale(.84);
}

/* Icona di chiusura */
#ai-assistant-fab .fa-times {
  font-size: 23px;
}

.ai-assistant-hint {
  position: fixed;
  right: 94px;
  bottom: 27px;
  z-index: 1002;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 9px;
  min-width: 215px;
  padding: 10px 12px 10px 10px;
  border: 1px solid rgba(70, 93, 66, 0.12);
  border-radius: 17px;
  color: #344432;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 9px 25px rgba(42, 60, 39, 0.16), 0 1px 2px rgba(42, 60, 39, 0.06);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  animation: aiHintAppear .5s .35s both cubic-bezier(.22, .9, .3, 1.08);
  transition: opacity .2s ease, transform .2s ease, box-shadow .2s ease;
}

.ai-assistant-hint::after {
  content: '';
  position: absolute;
  right: -6px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(70, 93, 66, 0.12);
  border-right: 1px solid rgba(70, 93, 66, 0.12);
  transform: rotate(45deg);
}

.ai-assistant-hint > .ai-assistant-hint-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #82a173, #55754f);
  font-size: .68rem;
}
.ai-assistant-hint > .ai-assistant-hint-icon { box-sizing: border-box; padding: 6px; stroke-width: 2.1; }

.ai-assistant-hint > span { display: grid; gap: 2px; }
.ai-assistant-hint strong { font-size: .78rem; line-height: 1.1; }
.ai-assistant-hint small { color: #788574; font-size: .67rem; line-height: 1.15; }
.ai-assistant-hint > .ai-assistant-hint-arrow { width: 14px; height: 14px; color: #96a391; stroke-width: 2.3; }
.ai-assistant-hint:hover { box-shadow: 0 13px 29px rgba(42, 60, 39, 0.22); transform: translateY(-2px); }
.ai-assistant-hint:focus-visible { outline: 3px solid rgba(100, 143, 88, .38); outline-offset: 3px; }
.ai-assistant-hint.is-hidden { pointer-events: none; opacity: 0; transform: translateX(10px) scale(.96); }

@keyframes aiHintAppear {
  from { opacity: 0; transform: translateX(12px) scale(.94); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@media (max-width: 520px) {
  #ai-assistant-fab { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .ai-assistant-hint { right: 78px; bottom: 19px; min-width: 192px; padding-right: 9px; }
  .ai-assistant-hint small { font-size: .63rem; }
}
