/* Allegra Homes Chat. Mismas clases y estilo que el chat anterior, más botones de enlace y sugerencias. */
:root { --ah-gold: #C9A46D; --ah-gold-dark: #8a6a36; --ah-bg: #F8F5F2; --ah-border: #eee; --ah-shadow: 0 10px 22px rgba(0,0,0,0.05); }

/* Burbuja flotante */
.ah-float { position: fixed; right: 18px; bottom: 18px; z-index: 9999; font-family: inherit; }
.ah-float-btn {
  display: inline-flex; align-items: center; gap: .5rem; border-radius: 999px; border: 1px solid var(--ah-border);
  padding: .7rem 1rem; background: #fff; cursor: pointer; box-shadow: var(--ah-shadow); color: #222; font-size: .98rem;
}
.ah-float-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--ah-gold); display: inline-block; }
.ah-float-panel {
  position: absolute; right: 0; bottom: calc(100% + 10px);
  width: 360px; max-width: calc(100vw - 36px);
  background: #fff; border: 1px solid var(--ah-border); border-radius: 1rem; box-shadow: var(--ah-shadow);
  overflow: hidden; display: none;
}
.ah-float-panel.is-open { display: block; }
.ah-float-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem .9rem; background: var(--ah-bg); border-bottom: 1px solid #f0ece6; }
.ah-float-title { font-weight: 600; color: #222; }
.ah-float-close { border: none; background: transparent; font-size: 1.3rem; cursor: pointer; line-height: 1; color: #555; }
.ah-float-win { padding: .8rem; max-height: min(420px, 60vh); overflow: auto; }
.ah-float-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid #f0ece6; background: #fff; }
.ah-float-input { flex: 1; min-width: 0; border-radius: 999px; border: 1px solid var(--ah-border); padding: .6rem .9rem; outline: none; font-size: 16px; }
.ah-float-input:focus { border-color: rgba(201,164,109,0.8); }
.ah-float-send { border-radius: 999px; border: 1px solid var(--ah-border); padding: .6rem .9rem; cursor: pointer; background: var(--ah-gold); color: #fff; }
.ah-float-send:disabled { opacity: .65; cursor: not-allowed; }
.ah-float-msg { display: flex; flex-direction: column; margin: .5rem 0; }
.ah-float-msg.user { align-items: flex-end; }
.ah-float-msg.bot { align-items: flex-start; }
.ah-float-bubble {
  max-width: 90%; padding: .65rem .8rem; border-radius: 1rem; white-space: pre-wrap; line-height: 1.45;
  background: var(--ah-bg); border: 1px solid #f0ece6; color: #222; font-size: .93rem; overflow-wrap: anywhere;
}
.ah-float-msg.user .ah-float-bubble { background: #fff; border: 1px solid rgba(201,164,109,0.35); }

/* Chat de página completa (si existe el shortcode anterior) */
.ah-msg { display: flex; flex-direction: column; margin: .6rem 0; }
.ah-msg-user { align-items: flex-end; }
.ah-msg-bot { align-items: flex-start; }
.ah-bubble { overflow-wrap: anywhere; }

/* Elementos nuevos */
.ahc-title { display: block; margin-bottom: .3rem; white-space: normal; }
.ahc-answer { white-space: pre-wrap; }
.ahc-inline-link { color: var(--ah-gold-dark); text-decoration: underline; word-break: break-all; }
.ahc-actions, .ahc-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; max-width: 90%; }
.ahc-related { width: 100%; font-size: .82rem; color: #666; }
.ahc-btn, .ahc-chip {
  display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--ah-border); background: #fff;
  color: #333; text-decoration: none; font: inherit; font-size: .85rem; line-height: 1.3; padding: .4rem .7rem; cursor: pointer; text-align: left;
}
.ahc-btn:hover, .ahc-chip:hover, .ahc-btn:focus-visible, .ahc-chip:focus-visible { border-color: rgba(201,164,109,0.8); }
/* El tema pinta los enlaces de dorado: se fija el color con más especificidad para que no gane. */
.ah-float a.ahc-btn-wa, a.ahc-btn.ahc-btn-wa, a.ahc-btn.ahc-btn-wa:visited { background: #25d366; border-color: #25d366; color: #111 !important; font-weight: 600; }
.ah-float a.ahc-btn-wa:hover, a.ahc-btn.ahc-btn-wa:hover, a.ahc-btn.ahc-btn-wa:focus-visible { background: #1ebe5d; border-color: #1ebe5d; color: #111 !important; }
.ahc-typing .ah-float-bubble, .ahc-typing .ah-bubble { color: #777; font-style: italic; }
.ahc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ah-float button:focus-visible, .ah-float a:focus-visible, .ah-float input:focus-visible { outline: 2px solid var(--ah-gold-dark); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .ah-float * { transition: none !important; animation: none !important; } }
@media (max-width: 480px) {
  .ah-float { right: 12px; bottom: 12px; }
  .ah-float-panel { width: calc(100vw - 24px); }
}
