/* Ultimo update: 04/08/2026 16:25 */

/* =========================================================
   CONTENITORE GENERALE
   ========================================================= */

#eai-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  box-sizing: border-box;
}

#eai-chat *,
#eai-chat *::before,
#eai-chat *::after {
  box-sizing: border-box;
}


/* =========================================================
   PULSANTE DI APERTURA CHAT
   ========================================================= */

#eai-toggle {
  display: block;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background-color: #004eae;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: 0 5px 18px rgba(0, 78, 174, 0.28);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition:
          background-color 0.18s ease,
          color 0.18s ease,
          transform 0.18s ease,
          box-shadow 0.18s ease;
}

#eai-toggle:hover,
#eai-toggle:focus {
  background-color: #7fdb63;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  box-shadow: 0 6px 20px rgba(0, 78, 174, 0.34);
  outline: none;
}

#eai-toggle:active {
  transform: translateY(1px);
}


/* =========================================================
   PANNELLO CHAT
   ========================================================= */

#eai-panel {
  width: 360px;
  height: 500px;
  margin-bottom: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid #d9dee5;
  border-radius: 16px 0 16px 16px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.22);
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}

#eai-panel[hidden] {
  display: none !important;
}


/* =========================================================
   HEADER
   ========================================================= */

#eai-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 11px 14px;
  background-color: #fff;
  border-bottom: 1px solid #e1e5ea;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}

#eai-chat #eai-header > strong {
  color: #004eae !important;
  -webkit-text-fill-color: #004eae !important;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.2px;
}

#eai-new-chat {
  border: 0;
  border-radius: 7px;
  padding: 6px 9px;
  background-color: transparent;
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition:
          background-color 0.18s ease,
          color 0.18s ease;
}

#eai-new-chat:hover,
#eai-new-chat:focus {
  background-color: #edf4fc;
  color: #004eae !important;
  -webkit-text-fill-color: #004eae !important;
  outline: none;
}

#eai-new-chat:active {
  background-color: #e2edf9;
}


/* =========================================================
   AREA MESSAGGI
   ========================================================= */

#eai-messages {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: #f5f7fa;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #bcc5cf transparent;
}

#eai-messages::-webkit-scrollbar {
  width: 7px;
}

#eai-messages::-webkit-scrollbar-track {
  background: transparent;
}

#eai-messages::-webkit-scrollbar-thumb {
  background-color: #bcc5cf;
  border-radius: 999px;
}

#eai-messages::-webkit-scrollbar-thumb:hover {
  background-color: #9faab6;
}


/* =========================================================
   STILE BASE DEI MESSAGGI
   ========================================================= */

#eai-chat .eai-message {
  display: block;
  width: fit-content;
  max-width: 84%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: normal;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

#eai-chat .eai-message:last-child {
  margin-bottom: 10px;
}


/* =========================================================
   MESSAGGI DELL’ASSISTENTE
   ========================================================= */

#eai-chat .eai-message-assistant {
  margin-right: auto;
  margin-left: 0;
  background-color: #eaf3ff;
  border: 1px solid #d6e7fa;
  border-bottom-left-radius: 4px;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}

/*
 * Seleziona soltanto il primo strong, cioè il nome "DribblAI".
 * Gli eventuali <strong> presenti nella risposta restano neri.
 */
#eai-chat .eai-message-assistant > strong:first-child {
  color: #004eae !important;
  -webkit-text-fill-color: #004eae !important;
  font-weight: 700;
}

/* Testo ed elementi HTML prodotti dall’assistente */

#eai-chat .eai-message-assistant p,
#eai-chat .eai-message-assistant em,
#eai-chat .eai-message-assistant span,
#eai-chat .eai-message-assistant ul,
#eai-chat .eai-message-assistant ol,
#eai-chat .eai-message-assistant li,
#eai-chat .eai-message-assistant strong:not(:first-child) {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}


/* =========================================================
   MESSAGGI DELL’UTENTE
   ========================================================= */

#eai-chat .eai-message-user {
  margin-right: 0;
  margin-left: auto;
  background-color: #e2e6eb;
  border: 1px solid #d6dbe1;
  border-bottom-right-radius: 4px;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}

#eai-chat .eai-message-user > strong:first-child {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  font-weight: 700;
}


/* =========================================================
   FORMATTAZIONE DEL CONTENUTO
   ========================================================= */

#eai-chat .eai-message p {
  margin: 0 0 8px;
}

#eai-chat .eai-message p:last-child {
  margin-bottom: 0;
}

#eai-chat .eai-message ul,
#eai-chat .eai-message ol {
  margin: 8px 0 4px;
  padding-left: 21px;
}

#eai-chat .eai-message li {
  margin: 3px 0;
}

#eai-chat .eai-message br {
  line-height: 1.6;
}

#eai-chat .eai-message a {
  color: #004eae !important;
  -webkit-text-fill-color: #004eae !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#eai-chat .eai-message a:hover,
#eai-chat .eai-message a:focus {
  color: #003779 !important;
  -webkit-text-fill-color: #003779 !important;
}


/* =========================================================
   INDICATORE "STA SCRIVENDO"
   ========================================================= */

#eai-chat .eai-typing {
  background-color: #eaf3ff;
  border-color: #d6e7fa;
  color: #5d6773 !important;
  -webkit-text-fill-color: #5d6773 !important;
  font-size: 13px;
  font-style: italic;
  opacity: 0.85;
}


/* =========================================================
   FORM DI INVIO
   ========================================================= */

#eai-form {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  background-color: #fff;
  border-top: 1px solid #e1e5ea;
}


/* =========================================================
   INPUT
   ========================================================= */

#eai-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 10px 11px;
  border: 1px solid #cbd2da;
  border-radius: 9px;
  background-color: #fff !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  outline: none;
  box-shadow: none;
  appearance: none;
  transition:
          border-color 0.18s ease,
          box-shadow 0.18s ease;
}

#eai-input:hover {
  border-color: #aeb8c3;
}

#eai-input:focus {
  border-color: #004eae;
  box-shadow: 0 0 0 3px rgba(0, 78, 174, 0.12);
}

#eai-chat #eai-input::placeholder {
  color: #747d87 !important;
  -webkit-text-fill-color: #747d87 !important;
  opacity: 1;
}

#eai-input:disabled {
  background-color: #f2f3f5 !important;
  color: #666 !important;
  -webkit-text-fill-color: #666 !important;
  opacity: 0.75;
  cursor: default;
}


/* =========================================================
   PULSANTE INVIA
   ========================================================= */

#eai-chat #eai-submit {
  flex: 0 0 auto;
  min-width: 70px;
  height: 42px;
  margin: 0;
  padding: 0 15px;
  border: 0 !important;
  border-radius: 9px;
  background-color: #004eae !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: none !important;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 42px;
  text-align: center;
  appearance: none;
  transition:
          background-color 0.18s ease,
          color 0.18s ease,
          transform 0.1s ease;
}

#eai-chat #eai-submit:hover,
#eai-chat #eai-submit:focus {
  background-color: #7fdb63 !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  outline: none;
}

#eai-chat #eai-submit:active {
  background-color: #004eae !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  transform: translateY(1px);
}

#eai-chat #eai-submit:disabled {
  background-color: #7894b8 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  opacity: 0.7;
  cursor: default;
  transform: none;
}


/* =========================================================
   ACCESSIBILITÀ
   ========================================================= */

#eai-chat button:focus-visible,
#eai-chat input:focus-visible,
#eai-chat a:focus-visible {
  outline: 2px solid #004eae;
  outline-offset: 2px;
}


/* =========================================================
   RESPONSIVE MOBILE
   ========================================================= */

@media (max-width: 480px) {
  #eai-chat {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  #eai-panel {
    width: 100%;
    height: min(500px, calc(100vh - 90px));
    margin-bottom: 10px;
    border-radius: 14px;
  }

  #eai-toggle {
    margin-left: auto;
  }

  #eai-chat .eai-message {
    max-width: 88%;
  }

  #eai-form {
    gap: 7px;
    padding: 9px;
  }

  #eai-chat #eai-submit {
    min-width: 66px;
    padding-right: 12px;
    padding-left: 12px;
  }
}


/* =========================================================
   UTENTI CON ANIMAZIONI RIDOTTE
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  #eai-chat *,
  #eai-chat *::before,
  #eai-chat *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
