/* HENNIO-CHAT-AVATAR-1 — avatar nella chat.
   Riusa il cerchio con l'iniziale già usato da `.ad-seller-avatar` nella
   scheda annuncio e nella pagina venditore. Se c'è una foto la mostra sopra
   l'iniziale; `onerror` la toglie e resta il cerchio colorato. */

.ad-seller-avatar.ff-avatar {
  position: relative;
  overflow: hidden;
}
.ad-seller-avatar.ff-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-seller-avatar.ff-avatar .ff-avatar-initial {
  position: relative;
  z-index: 0;
  line-height: 1;
}

/* Colori FotoFatto: accento e inchiostro, sempre con testo leggibile. */
.ad-seller-avatar.ff-avatar-t1 { background: #FF5A36; color: #FFFFFF; }
.ad-seller-avatar.ff-avatar-t2 { background: #C2370F; color: #FFFFFF; }
.ad-seller-avatar.ff-avatar-t3 { background: #3B2A26; color: #FBF6F1; }
.ad-seller-avatar.ff-avatar-t4 { background: #E9C9C1; color: #3B2A26; }
.ad-seller-avatar.ff-avatar-t5 { background: #8A4A3A; color: #FFFFFF; }
.ad-seller-avatar.ff-avatar-t6 { background: #D98263; color: #3B2A26; }

/* Hennio: cacao e rosa antico. */
body.hennio-body .ad-seller-avatar.ff-avatar-t1 { background: #3B2A26; color: #FBF6F1; }
body.hennio-body .ad-seller-avatar.ff-avatar-t2 { background: #6E4B43; color: #FBF6F1; }
body.hennio-body .ad-seller-avatar.ff-avatar-t3 { background: #A97466; color: #FFFFFF; }
body.hennio-body .ad-seller-avatar.ff-avatar-t4 { background: #E9C9C1; color: #3B2A26; }
body.hennio-body .ad-seller-avatar.ff-avatar-t5 { background: #C68E80; color: #3B2A26; }
body.hennio-body .ad-seller-avatar.ff-avatar-t6 { background: #8A5A4F; color: #FBF6F1; }

/* Elenco conversazioni: avatar dell'altra persona + miniatura del capo. */
.chat-row-faces {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-seller-avatar.ff-avatar-list {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  font-size: 19px;
}
.chat-row-listing {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border: 2px solid var(--paper);
  border-radius: 7px;
  background: #DDD9D0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}
.chat-row-listing img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body.hennio-body .chat-row-listing { border-color: #FBF6F1; }

/* Testata: avatar, nome, bandierina. */
body.chat-page .chat-head-person {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}
body.chat-page .chat-head-person .chat-who {
  flex: 0 1 auto;
  min-width: 0;
}
.chat-head-flag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.chat-who-link {
  color: inherit;
  text-decoration: none;
}
.chat-who-link:hover { text-decoration: underline; }
.ad-seller-avatar.ff-avatar-head {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 16px;
}

/* Messaggi: 30 px accanto ai messaggi dell'altra persona. */
.chat-msg { align-items: flex-start; gap: 6px; }
.ad-seller-avatar.ff-avatar-msg {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-top: 1px;
  font-size: 13px;
}
.chat-msg-avatar-space {
  flex: 0 0 30px;
  width: 30px;
  height: 1px;
}

/* Telefono stretto (375 px): elenco un filo più compatto, niente righe storte. */
@media (max-width: 380px) {
  .chat-row { gap: 9px; }
  .chat-row-faces { flex-basis: 47px; width: 47px; height: 47px; }
  .ad-seller-avatar.ff-avatar-list { width: 42px; height: 42px; flex-basis: 42px; font-size: 17px; }
  .chat-row-listing { width: 22px; height: 22px; }
  .ad-seller-avatar.ff-avatar-head { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; }
}
