/* Trusti Eva public widget v0.2.0 */
:root {
  --eva-orange: #f26422;
  --eva-orange-dark: #dc4d12;
  --eva-purple: #32105d;
  --eva-purple-deep: #170625;
  --eva-lilac: #eadfff;
  --eva-ink: #2c2832;
  --eva-muted: #6e6876;
  --eva-line: #e8e2ef;
  --eva-surface: #ffffff;
  --eva-soft: #f8f5fb;
}

.eva-widget,
.eva-widget * {
  box-sizing: border-box;
}

.eva-widget {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 9500;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--eva-ink);
}

.eva-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--eva-orange), #ff7a32);
  color: #fff;
  box-shadow: 0 16px 42px rgba(39, 12, 62, .24), 0 4px 14px rgba(242, 100, 34, .28);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.eva-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(39, 12, 62, .28), 0 8px 20px rgba(242, 100, 34, .32);
}

.eva-launcher:focus-visible,
.eva-icon-button:focus-visible,
.eva-choice:focus-visible,
.eva-send:focus-visible,
.eva-primary-action:focus-visible,
.eva-secondary-action:focus-visible,
.eva-input:focus-visible {
  outline: 3px solid rgba(242, 100, 34, .28);
  outline-offset: 3px;
}

.eva-launcher-avatar,
.eva-header-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
}

.eva-launcher-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.42);
}

.eva-launcher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eva-launcher-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.eva-launcher-copy strong {
  font-family: Sora, Inter, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.eva-launcher-copy span {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  opacity: .9;
}

.eva-launcher-pulse {
  position: absolute;
  top: 6px;
  left: 42px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #42c982;
  box-shadow: 0 0 0 0 rgba(66, 201, 130, .65);
  animation: evaPulse 2.2s infinite;
}

@keyframes evaPulse {
  0% { box-shadow: 0 0 0 0 rgba(66, 201, 130, .55); }
  70% { box-shadow: 0 0 0 9px rgba(66, 201, 130, 0); }
  100% { box-shadow: 0 0 0 0 rgba(66, 201, 130, 0); }
}

.eva-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(392px, calc(100vw - 28px));
  height: min(680px, calc(100svh - 118px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(53, 20, 86, .12);
  border-radius: 24px;
  background: var(--eva-surface);
  box-shadow: 0 28px 90px rgba(22, 5, 38, .28), 0 6px 22px rgba(22, 5, 38, .12);
  transform-origin: bottom right;
  animation: evaPanelIn .22s ease both;
}

@keyframes evaPanelIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.eva-panel[hidden],
.eva-launcher[hidden] {
  display: none !important;
}

.eva-header {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 16px 16px 15px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 88% 10%, rgba(242,100,34,.45), transparent 30%),
    linear-gradient(135deg, #190629 0%, #3b1467 70%, #4b1b78 100%);
}

.eva-header::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -54px;
  width: 150px;
  height: 170px;
  background: url('/assets/img/eva-avatar.svg') center / contain no-repeat;
  opacity: .08;
  transform: rotate(-8deg);
  pointer-events: none;
}

.eva-header-avatar {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.06);
}

.eva-header-avatar img {
  width: 100%;
  height: 100%;
}

.eva-header-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.eva-header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eva-header-copy strong {
  font-family: Sora, Inter, sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.eva-beta {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.17);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eva-header-copy p {
  margin: 5px 0 0;
  color: rgba(255,255,255,.78);
  font-size: 12px;
  line-height: 1.3;
}

.eva-header-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.eva-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  transition: background .18s ease;
}

.eva-icon-button:hover {
  background: rgba(255,255,255,.17);
}

.eva-messages {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 12px;
  background:
    linear-gradient(180deg, rgba(249,247,252,.92), rgba(255,255,255,1) 45%),
    var(--eva-surface);
  scroll-behavior: smooth;
}

.eva-day-label {
  width: max-content;
  margin: 0 auto 16px;
  padding: 4px 9px;
  border: 1px solid var(--eva-line);
  border-radius: 999px;
  color: #887f90;
  background: rgba(255,255,255,.9);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.eva-message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}

.eva-message-row.user {
  justify-content: flex-end;
}

.eva-mini-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--eva-purple);
  box-shadow: 0 3px 10px rgba(50, 16, 93, .16);
}

.eva-mini-avatar img {
  width: 100%;
  height: 100%;
}

.eva-bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 17px 17px 17px 5px;
  background: #fff;
  border: 1px solid var(--eva-line);
  box-shadow: 0 4px 14px rgba(34, 19, 47, .05);
  font-size: 13.5px;
  line-height: 1.55;
}

.eva-message-row.user .eva-bubble {
  color: #fff;
  border-color: transparent;
  border-radius: 17px 17px 5px 17px;
  background: linear-gradient(135deg, var(--eva-purple), #4d1b7e);
}

.eva-bubble p {
  margin: 0;
}

.eva-bubble p + p {
  margin-top: 8px;
}

.eva-bubble strong {
  font-weight: 800;
}

.eva-credit-compare {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.eva-credit-compare span {
  display: block;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--eva-soft);
  color: #4d4754;
  font-size: 12px;
  line-height: 1.4;
}

.eva-credit-compare span:last-child {
  color: #6d2d0b;
  background: #fff1e8;
}

.eva-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 16px 36px;
}

.eva-choice {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #ddd2e8;
  border-radius: 999px;
  color: #4b1b74;
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.eva-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(242,100,34,.55);
  background: #fff8f3;
}

.eva-action-card {
  margin: 4px 0 16px 36px;
  padding: 13px;
  border: 1px solid #eadff2;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, #fbf7ff 100%);
  box-shadow: 0 8px 22px rgba(50, 16, 93, .06);
}

.eva-action-card strong {
  display: block;
  margin-bottom: 5px;
  color: #2d123e;
  font-family: Sora, Inter, sans-serif;
  font-size: 14px;
}

.eva-action-card p {
  margin: 0 0 11px;
  color: var(--eva-muted);
  font-size: 12px;
  line-height: 1.45;
}

.eva-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eva-primary-action,
.eva-secondary-action {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.eva-primary-action {
  border: 1px solid var(--eva-orange);
  color: #fff;
  background: var(--eva-orange);
}

.eva-primary-action:hover {
  background: var(--eva-orange-dark);
  border-color: var(--eva-orange-dark);
}

.eva-secondary-action {
  border: 1px solid #dfd2e9;
  color: #4b1b74;
  background: #fff;
}

.eva-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 54px;
}

.eva-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #978d9e;
  animation: evaTyping 1s infinite ease-in-out;
}

.eva-typing i:nth-child(2) { animation-delay: .13s; }
.eva-typing i:nth-child(3) { animation-delay: .26s; }

@keyframes evaTyping {
  0%, 70%, 100% { transform: translateY(0); opacity: .45; }
  35% { transform: translateY(-4px); opacity: 1; }
}

.eva-composer-wrap {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--eva-line);
  background: #fff;
}

.eva-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 5px 5px 5px 13px;
  border: 1px solid #ded6e5;
  border-radius: 15px;
  background: #fbfafc;
}

.eva-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--eva-ink);
  background: transparent;
  font: inherit;
  font-size: 13px;
}

.eva-input::placeholder {
  color: #9a929f;
}

.eva-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--eva-orange);
  cursor: pointer;
}

.eva-send:disabled {
  opacity: .45;
  cursor: default;
}

.eva-disclaimer {
  margin: 7px 5px 0;
  color: #8a828f;
  text-align: center;
  font-size: 9.5px;
  line-height: 1.35;
}

.eva-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 640px) {
  .eva-widget {
    right: 12px;
    bottom: 12px;
  }

  .eva-launcher {
    min-height: 54px;
    padding: 7px;
  }

  .eva-launcher-avatar {
    width: 40px;
    height: 40px;
  }

  .eva-launcher-copy,
  .eva-launcher-pulse {
    display: none;
  }

  .eva-panel {
    position: fixed;
    inset: auto 8px 8px 8px;
    width: auto;
    height: min(760px, calc(100svh - 16px));
    min-height: 0;
    border-radius: 22px;
    transform-origin: bottom center;
  }

  .eva-header {
    min-height: 78px;
    padding: 13px 12px;
  }

  .eva-header-avatar {
    width: 44px;
    height: 44px;
  }

  .eva-header-copy strong {
    font-size: 17px;
  }

  .eva-messages {
    padding: 15px 12px 10px;
  }

  .eva-bubble {
    max-width: 87%;
    font-size: 13px;
  }

  .eva-choices,
  .eva-action-card {
    margin-left: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eva-launcher,
  .eva-choice,
  .eva-panel,
  .eva-launcher-pulse,
  .eva-typing i {
    animation: none !important;
    transition: none !important;
  }
}
