/* Ur Mortgage — Astravyx "Chat Now" assistant widget.
 * Replaces the legacy botsplash widget. Self-mounting; depends on tokens.css for vars
 * (falls back to literal brand values if loaded standalone). */

.ax {
  --ax-green: var(--brand-green, #03c78d);
  --ax-green-700: var(--brand-green-700, #02a576);
  --ax-ink: var(--brand-ink, #282828);
  --ax-font: var(--font-body, "Open Sans", system-ui, sans-serif);
  --ax-display: var(--font-display, "Poppins", system-ui, sans-serif);
  position: fixed; right: 22px; bottom: 22px; z-index: 90; font-family: var(--ax-font);
}
@media (max-width: 480px) { .ax { right: 14px; bottom: 14px; left: 14px; } }

/* launcher */
.ax__launch {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--ax-green); color: #fff; border: none; cursor: pointer;
  font-family: var(--ax-display); font-weight: 600; font-size: 0.98rem;
  padding: 0.85rem 1.25rem 0.85rem 0.95rem; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(3,199,141,0.34), 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 140ms cubic-bezier(.22,1,.36,1), box-shadow 240ms, background-color 140ms;
}
.ax__launch:hover { transform: translateY(-2px); background: var(--ax-green-700); box-shadow: 0 16px 36px rgba(3,199,141,0.4); }
.ax__launch:focus-visible { outline: 3px solid var(--ax-green-700); outline-offset: 3px; }
.ax__launch .av { position: relative; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.18); display: grid; place-items: center; }
.ax__launch .av svg { width: 18px; height: 18px; }
.ax__launch .dot { position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--ax-green); }
.ax[data-open="true"] .ax__launch { display: none; }

/* panel */
.ax__panel {
  position: absolute; right: 0; bottom: 0; width: 384px; max-width: calc(100vw - 28px);
  height: 588px; max-height: calc(100dvh - 44px);
  background: #fff; border-radius: 20px; overflow: hidden; display: none; flex-direction: column;
  box-shadow: 0 28px 64px rgba(10,40,32,0.28), 0 8px 20px rgba(10,40,32,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}
.ax[data-open="true"] .ax__panel { display: flex; animation: ax-pop 280ms cubic-bezier(.22,1,.36,1); }
@keyframes ax-pop { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .ax__panel { width: 100%; height: calc(100dvh - 28px); } }
@media (prefers-reduced-motion: reduce) { .ax[data-open="true"] .ax__panel { animation: none; } }

.ax__head { background: linear-gradient(135deg, var(--ax-green), var(--ax-green-700)); color: #fff; padding: 1rem 1.1rem; display: flex; align-items: center; gap: 0.75rem; }
.ax__head .av { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.18); display: grid; place-items: center; flex: 0 0 auto; }
.ax__head .av svg { width: 24px; height: 24px; }
.ax__head .who { line-height: 1.2; }
.ax__head .who b { font-family: var(--ax-display); font-size: 1.02rem; display: block; }
.ax__head .who span { font-size: 0.78rem; opacity: 0.9; display: inline-flex; align-items: center; gap: 0.35rem; }
.ax__head .who span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #c6ffe9; box-shadow: 0 0 0 0 rgba(198,255,233,0.7); animation: ax-live 2s infinite; }
@keyframes ax-live { 0%{box-shadow:0 0 0 0 rgba(198,255,233,.6);} 70%{box-shadow:0 0 0 6px rgba(198,255,233,0);} 100%{box-shadow:0 0 0 0 rgba(198,255,233,0);} }
.ax__close { margin-left: auto; background: rgba(255,255,255,0.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: background 140ms; }
.ax__close:hover { background: rgba(255,255,255,0.3); }
.ax__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* message log */
.ax__log { flex: 1; overflow-y: auto; padding: 1.1rem; background: #f7faf9; display: flex; flex-direction: column; gap: 0.7rem; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { .ax__log { scroll-behavior: auto; } }
.ax__msg { max-width: 84%; padding: 0.7rem 0.9rem; border-radius: 16px; font-size: 0.93rem; line-height: 1.5; animation: ax-msg 260ms cubic-bezier(.22,1,.36,1); overflow-wrap: anywhere; }
@keyframes ax-msg { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ax__msg { animation: none; } }
.ax__msg.bot { background: #fff; color: var(--ax-ink); border: 1px solid rgba(0,0,0,0.07); border-bottom-left-radius: 5px; align-self: flex-start; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.ax__msg.user { background: var(--ax-green); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.ax__msg.bot a { color: var(--ax-green-700); text-decoration: underline; text-underline-offset: 2px; }
.ax__msg.bot .cite { display: block; margin-top: 0.4rem; font-size: 0.72rem; color: #8a9290; }

/* typing */
.ax__typing { align-self: flex-start; background: #fff; border: 1px solid rgba(0,0,0,0.07); border-bottom-left-radius: 5px; border-radius: 16px; padding: 0.75rem 0.95rem; display: inline-flex; gap: 4px; }
.ax__typing i { width: 7px; height: 7px; border-radius: 50%; background: #bcc6c3; animation: ax-bounce 1.2s infinite; }
.ax__typing i:nth-child(2){ animation-delay: .15s; } .ax__typing i:nth-child(3){ animation-delay: .3s; }
@keyframes ax-bounce { 0%,60%,100%{ transform: translateY(0); opacity: .5; } 30%{ transform: translateY(-5px); opacity: 1; } }

/* quick replies */
.ax__chips { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0 1.1rem 0.4rem; }
.ax__chip { background: #fff; border: 1.5px solid var(--ax-green); color: var(--ax-green-700); border-radius: 999px; padding: 0.5rem 0.9rem; font-size: 0.86rem; font-family: var(--ax-display); font-weight: 600; cursor: pointer; transition: background 140ms, transform 140ms; }
.ax__chip:hover { background: var(--brand-green-050, #e6faf3); transform: translateY(-1px); }
.ax__chip:focus-visible { outline: 3px solid var(--ax-green-700); outline-offset: 2px; }

/* consent card in-chat */
.ax__consent { align-self: stretch; background: #fff; border: 1.5px solid rgba(0,0,0,0.1); border-radius: 14px; padding: 0.85rem; font-size: 0.82rem; color: var(--ax-ink); }
.ax__consent .body { max-height: 120px; overflow-y: auto; color: #555b59; line-height: 1.5; margin-bottom: 0.6rem; }
.ax__consent label { display: flex; gap: 0.55rem; align-items: flex-start; cursor: pointer; }
.ax__consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ax-green); flex: 0 0 auto; }
.ax__consent a { color: var(--ax-green-700); text-decoration: underline; }
.ax__consent .go { margin-top: 0.6rem; width: 100%; background: var(--ax-green); color: #fff; border: none; border-radius: 10px; padding: 0.6rem; font-family: var(--ax-display); font-weight: 600; cursor: pointer; opacity: 0.5; pointer-events: none; transition: opacity 140ms; }
.ax__consent .go.on { opacity: 1; pointer-events: auto; }
.ax__consent .go:hover.on { background: var(--ax-green-700); }

/* input */
.ax__input { display: flex; gap: 0.5rem; padding: 0.7rem; border-top: 1px solid rgba(0,0,0,0.07); background: #fff; align-items: flex-end; }
.ax__input textarea { flex: 1; resize: none; border: 1px solid rgba(0,0,0,0.14); border-radius: 14px; padding: 0.6rem 0.8rem; font-family: inherit; font-size: 0.92rem; max-height: 96px; line-height: 1.4; }
.ax__input textarea:focus { outline: none; border-color: var(--ax-green); box-shadow: 0 0 0 3px var(--brand-green-050, #e6faf3); }
.ax__send { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: var(--ax-green); color: #fff; border: none; cursor: pointer; display: grid; place-items: center; transition: background 140ms, transform 140ms; }
.ax__send:hover { background: var(--ax-green-700); transform: translateY(-1px); }
.ax__send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.ax__send:focus-visible { outline: 3px solid var(--ax-green-700); outline-offset: 2px; }
.ax__foot { text-align: center; font-size: 0.68rem; color: #9aa3a0; padding: 0 0.7rem 0.6rem; background: #fff; }
.ax__foot b { color: var(--ax-green-700); }

.ax__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
