/* Eva chat bubble (assets/eva.js, inc/eva.php). Uses the theme's colour tokens, so dark mode follows. */
.eva { position: fixed; right: 20px; bottom: 20px; z-index: 420; font-family: var(--font-body); }

.eva-launch {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 22px 0 7px; border: 0; border-radius: 26px; cursor: pointer;
  color: #fff; background: var(--gradient); background-size: 200% auto;
  font-family: var(--font-head); font-size: 14px;
  box-shadow: 0 10px 28px rgba(254, 79, 112, .35);
  transition: background-position .4s ease, transform .2s ease, box-shadow .2s ease;
}
.eva-launch:hover { background-position: right center; transform: translateY(-2px); }
.eva-launch:focus-visible { outline: 3px solid var(--heading); outline-offset: 3px; }
.eva.is-open .eva-launch { display: none; }
.eva-dot { position: absolute; top: 4px; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--heading); border: 2px solid #fff; }

.eva-panel {
  display: flex; flex-direction: column;
  width: 370px; height: min(600px, calc(100vh - 40px)); height: min(600px, calc(100dvh - 40px));
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(32, 54, 86, .22); overflow: hidden;
  animation: eva-in .25s ease;
}
.eva-panel[hidden] { display: none; }
@keyframes eva-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.eva-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--heading); color: var(--bg); }
.eva-avatar { flex: none; display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--gradient); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.eva-launch .eva-avatar { width: 38px; height: 38px; }
.eva-teaser .eva-avatar { width: 32px; height: 32px; margin: 2px 2px 0 -6px; box-shadow: none; }
.eva-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.eva-head-text b { font-family: var(--font-head); font-size: 16px; color: inherit; }
.eva-head-text small { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eva-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; }
.eva-x:hover, .eva-x:focus-visible { background: rgba(255, 255, 255, .12); }

.eva-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.eva-msg { max-width: 85%; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.eva-msg > div { padding: 10px 14px; border-radius: 16px; }
.eva-msg a { color: inherit; text-decoration: underline; }
.eva-assistant, .eva-owner { align-self: flex-start; }
.eva-assistant > div, .eva-owner > div { background: var(--avatar-bg); color: var(--heading); border-bottom-left-radius: 4px; }
.eva-owner > div { border: 1px solid var(--primary); }
.eva-who { display: block; font-size: 11px; font-weight: 600; color: var(--primary); margin: 0 0 3px 4px; text-transform: uppercase; letter-spacing: .04em; }
.eva-user { align-self: flex-end; }
.eva-user > div { background: var(--heading); color: var(--bg); border-bottom-right-radius: 4px; }
.eva-pending { opacity: .7; }
.eva-notice { align-self: center; max-width: 90%; text-align: center; font-size: 12.5px; color: var(--text-muted); padding: 2px 8px; }
.eva-notice a { color: var(--primary); }
.eva-err { color: var(--primary); }
.eva-ask { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.eva-ask .eva-restart { align-self: center; margin-top: 6px; }
.eva-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eva-opt {
  padding: 8px 14px; border-radius: 18px; cursor: pointer; text-align: left;
  border: 1px solid var(--primary); background: var(--card); color: var(--primary);
  font: 14px/1.35 var(--font-body); transition: background .15s, color .15s;
}
.eva-opt:hover, .eva-opt:focus-visible, .eva-opt[aria-pressed="true"] { background: var(--primary); color: #fff; }
.eva-opt[aria-pressed="true"]::before { content: "✓ "; }
.eva-opt:disabled { opacity: .55; cursor: default; }
.eva-continue { padding: 10px 24px; }
.eva-continue:disabled { opacity: .5; }
.eva-count { flex-basis: 100%; order: 3; text-align: right; font-size: 11.5px; color: var(--text-muted); margin-top: -4px; }
.eva-count[hidden] { display: none; }

.eva-dots { display: inline-flex; align-items: center; gap: 5px; height: 21px; }
.eva-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .4; animation: eva-dot 1.2s infinite ease-in-out; }
.eva-dots i:nth-child(2) { animation-delay: .15s; }
.eva-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes eva-dot { 0%, 60%, 100% { opacity: .4; transform: none; } 30% { opacity: 1; transform: translateY(-5px); } }

.eva-consent { margin: auto 0; text-align: center; padding: 8px 4px; }
.eva-consent h3 { font-size: 18px; margin: 0 0 10px; }
.eva-consent p { font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.eva-consent a:not(.btn) { color: var(--primary); }
.eva-consent-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 6px; }
.eva-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.eva-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); }
.eva-form[hidden] { display: none; }
.eva-form textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 21px; background: var(--bg); color: var(--heading);
  font: 14px/1.4 var(--font-body);
}
.eva-form textarea:focus { outline: none; border-color: var(--primary); }
.eva-send { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: var(--gradient); display: grid; place-items: center; }
.eva-send:focus-visible { outline: 3px solid var(--heading); outline-offset: 2px; }

@media (max-width: 600px) {
  .eva { right: 16px; bottom: 16px; }
  .eva-launch { width: 58px; height: 58px; padding: 0; justify-content: center; border-radius: 50%; }
  .eva-launch .eva-avatar { width: 50px; height: 50px; }
  .eva-launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .eva.is-open { inset: 0; }
  .eva-panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .eva-form textarea { font-size: 16px; } /* no zoom on iPhone */
}
@media (prefers-reduced-motion: reduce) {
  .eva-panel, .eva-dots i { animation: none !important; }
}
@media print { .eva { display: none; } }
.eva-waiting { align-self: center; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 18px; background: var(--avatar-bg); color: var(--heading); font-size: 13px; }
.eva-talkbar { padding: 6px 12px 0; text-align: center; border-top: 1px solid var(--border); }
.eva-talkbar[hidden] { display: none; }
.eva-talkbar + .eva-form { border-top: 0; }
.eva-talk { border: 0; background: none; padding: 4px 6px; color: var(--primary); font: 600 13px var(--font-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.eva-talk:hover, .eva-talk:focus-visible { color: var(--heading); }

/* Greeting bubble next to the chat button (after a few seconds, once per visit) */
.eva-teaser { position: absolute; right: 0; bottom: 66px; width: max-content; max-width: min(290px, calc(100vw - 32px));
  display: flex; align-items: flex-start; gap: 4px; padding: 12px 8px 12px 16px; border-radius: 16px 16px 4px 16px;
  background: var(--card); color: var(--heading); border: 1px solid var(--border); box-shadow: 0 12px 34px rgba(32, 54, 86, .16);
  animation: eva-teaser-in .45s cubic-bezier(.22, .61, .36, 1); }
.eva-teaser[hidden], .eva.is-open .eva-teaser { display: none; }
.eva-teaser-text { flex: 1; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; font: 14px/1.5 var(--font-body); }
.eva-teaser-text:hover { color: var(--primary); }
.eva-teaser-x { flex: none; width: 26px; height: 26px; margin-top: -4px; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.eva-teaser-x svg { width: 14px; height: 14px; }
.eva-teaser-x:hover, .eva-teaser-x:focus-visible { background: var(--avatar-bg); color: var(--heading); }
@keyframes eva-teaser-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .eva-teaser { bottom: 66px; } }
@media (prefers-reduced-motion: reduce) { .eva-teaser { animation: none; } }

/* "Connect me" form and the email code, inside the chat */
.eva-agent { align-items: stretch; }
.eva-card { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.eva-card-title { font-family: var(--font-head); font-size: 16px; color: var(--heading); }
.eva-card p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.eva-field { display: grid; gap: 5px; }
.eva-field > span { font-size: 12.5px; font-weight: 600; color: var(--heading); }
.eva-field input, .eva-field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--heading); font: 14px/1.4 var(--font-body); resize: vertical; }
.eva-field input:focus, .eva-field textarea:focus { outline: none; border-color: var(--primary); }
.eva-field .eva-code { font: 600 22px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .4em; text-align: center; }
.eva-field-msg { font-size: 12.5px; line-height: 1.4; }
.eva-field-msg:empty { display: none; }
.eva-field-msg.is-error { color: #c42b4a; }
.eva-field-msg.is-ok { color: #12805c; }
.eva-card .btn { justify-self: stretch; padding: 11px 18px; }
.eva-card-links { text-align: center; font-size: 12.5px !important; }
.eva-card-links button { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
@media (max-width: 600px) { .eva-field input, .eva-field textarea { font-size: 16px; } }
/* The chat button fades in once the page has settled, instead of being there before the content */
.eva-launch { animation: eva-launch-in .5s ease .8s both; }
@keyframes eva-launch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .eva-launch { animation: none; } }
