:root {
  --anjos-chat-primary: #ed3a8b;
  --anjos-chat-primary-dark: #c7206e;
  --anjos-chat-secondary: #5c2f91;
  --anjos-chat-text: #20233a;
  --anjos-chat-muted: #6d7287;
  --anjos-chat-bg: #ffffff;
}

.anjos-chatbot,
.anjos-chatbot * {
  box-sizing: border-box;
}

.anjos-chatbot {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: Inter, Arial, sans-serif;
  pointer-events: none;
}

.anjos-chatbot button,
.anjos-chatbot a,
.anjos-chatbot textarea,
.anjos-chatbot-panel {
  pointer-events: auto;
}

.anjos-chatbot-avatar-image {
  display: block;
  object-fit: cover;
  object-position: 50% 16%;
  background: #fff;
  transform-origin: 50% 70%;
  will-change: transform, filter, opacity;
  transition: filter .18s ease, opacity .12s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.anjos-chatbot-avatar-wrap {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: block;
  border-radius: 50%;
  position: relative;
  overflow: visible;
}

.anjos-chatbot-avatar-wrap::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .78);
  pointer-events: none;
  transition: box-shadow .2s ease, transform .2s ease;
}

.anjos-chatbot:not(.lia-is-thinking):not(.lia-is-speaking)
.anjos-chatbot-avatar-image {
  animation: anjos-lia-breathe 6.8s ease-in-out infinite;
}

.anjos-chatbot.lia-is-thinking .anjos-chatbot-avatar-image {
  animation: anjos-lia-thinking 2.8s ease-in-out infinite alternate;
  filter: saturate(1.05) brightness(1.03);
}

.anjos-chatbot.lia-is-speaking .anjos-chatbot-avatar-image {
  animation: anjos-lia-speaking 1.9s ease-in-out infinite alternate;
  filter: saturate(1.08) brightness(1.04);
}

.anjos-chatbot.lia-is-thinking .anjos-chatbot-avatar-wrap::after,
.anjos-chatbot.lia-is-thinking .anjos-chatbot-toggle {
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .12),
              0 0 18px rgba(92, 47, 145, .48);
}

.anjos-chatbot.lia-is-speaking .anjos-chatbot-avatar-wrap::after,
.anjos-chatbot.lia-is-speaking .anjos-chatbot-toggle {
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .14),
              0 0 22px rgba(237, 58, 139, .62);
}

.anjos-chatbot.lia-is-greeting .anjos-chatbot-avatar-image {
  animation: anjos-lia-greeting 1.05s ease both;
}

@keyframes anjos-lia-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-0.8px) scale(1.008);
  }
}

@keyframes anjos-lia-thinking {
  from {
    transform: rotate(-0.35deg) translateY(0) scale(1.003);
  }

  to {
    transform: rotate(0.35deg) translateY(-0.8px) scale(1.012);
  }
}

@keyframes anjos-lia-speaking {
  from {
    transform: rotate(-0.22deg) translateY(0) scale(1.004);
  }

  to {
    transform: rotate(0.22deg) translateY(-0.8px) scale(1.014);
  }
}

@keyframes anjos-lia-greeting {
  0% {
    transform: scale(.97) rotate(-1deg);
  }

  45% {
    transform: scale(1.025) rotate(.7deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

.anjos-chatbot-toggle {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--anjos-chat-primary), var(--anjos-chat-secondary));
  box-shadow: 0 16px 38px rgba(66, 34, 96, .28);
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
  touch-action: manipulation;
}

.anjos-chatbot-toggle:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 20px 45px rgba(66, 34, 96, .35);
}

.anjos-chatbot-toggle img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  margin: 3px;
}

.anjos-chatbot-pulse {
  position: absolute;
  right: 2px;
  top: 4px;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2fc46d;
  box-shadow: 0 0 0 0 rgba(47, 196, 109, .6);
  animation: anjos-chat-pulse 2s infinite;
}

@keyframes anjos-chat-pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(47, 196, 109, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(47, 196, 109, 0);
  }
}

.anjos-chatbot-panel[hidden] {
  display: none !important;
}

.anjos-chatbot.is-open .anjos-chatbot-toggle,
.anjos-chatbot.is-minimized .anjos-chatbot-toggle {
  display: none;
}

.anjos-chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 120px));
  min-height: 470px;
  background: var(--anjos-chat-bg);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(31, 24, 48, .28);
  border: 1px solid rgba(83, 48, 120, .12);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  transform-origin: bottom right;
  animation: anjos-chat-in .2s ease-out;
}

@keyframes anjos-chat-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.anjos-chatbot-header {
  min-height: 78px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--anjos-chat-secondary), var(--anjos-chat-primary));
  position: relative;
  z-index: 20;
}

.anjos-chatbot-header img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.anjos-chatbot-header-info {
  min-width: 0;
  flex: 1;
}

.anjos-chatbot-header-info strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.anjos-chatbot-header-info span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  opacity: .95;
}

.anjos-chatbot-header-info span i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ee88f;
}

.anjos-chatbot-header-info .anjos-chatbot-status b {
  min-width: 0;
  font: inherit;
  font-weight: 400;
  line-height: 1.25;
}

.anjos-chatbot.lia-is-thinking
.anjos-chatbot-header-info .anjos-chatbot-status i {
  background: #ffd166;
  animation: anjos-lia-status-pulse 1.6s ease-in-out infinite alternate;
}

.anjos-chatbot.lia-is-speaking
.anjos-chatbot-header-info .anjos-chatbot-status i {
  background: #7df7ad;
  animation: anjos-lia-status-pulse 1.15s ease-in-out infinite alternate;
}

@keyframes anjos-lia-status-pulse {
  from {
    opacity: .55;
    transform: scale(.8);
  }

  to {
    opacity: 1;
    transform: scale(1.25);
  }
}

.anjos-chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

.anjos-chatbot-close,
.anjos-chatbot-minimize,
.anjos-chatbot-reset {
  width: 36px;
  height: 36px;
  border: 0;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 31;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.anjos-chatbot-close {
  font-size: 27px;
}

.anjos-chatbot-minimize {
  font-size: 23px;
  font-weight: 700;
}

.anjos-chatbot-reset {
  font-size: 22px;
}

.anjos-chatbot-close:hover,
.anjos-chatbot-minimize:hover,
.anjos-chatbot-reset:hover {
  background: rgba(255, 255, 255, .24);
  transform: translateY(-1px);
}

.anjos-chatbot-close:focus-visible,
.anjos-chatbot-minimize:focus-visible,
.anjos-chatbot-reset:focus-visible,
.anjos-chatbot-toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.anjos-chatbot-messages {
  overflow-y: auto;
  padding: 18px 14px 10px;
  background: linear-gradient(180deg, #fff 0%, #faf8fd 100%);
  scrollbar-width: thin;
}

.anjos-chatbot-message {
  display: flex;
  flex-direction: column;
  margin: 0 0 12px;
}

.anjos-chatbot-message.user {
  align-items: flex-end;
}

.anjos-chatbot-message.assistant {
  align-items: flex-start;
}

.anjos-chatbot-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.48;
  word-break: break-word;
}

.anjos-chatbot-message.assistant .anjos-chatbot-bubble {
  background: #fff;
  color: var(--anjos-chat-text);
  border: 1px solid #ece7f2;
  border-bottom-left-radius: 5px;
  box-shadow: 0 5px 14px rgba(42, 28, 66, .06);
}

.anjos-chatbot-message.user .anjos-chatbot-bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--anjos-chat-primary), var(--anjos-chat-primary-dark));
  border-bottom-right-radius: 5px;
}

.anjos-chatbot-bubble a {
  color: inherit;
  text-decoration: underline;
  font-weight: 700;
}

.anjos-chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  max-width: 92%;
}

.anjos-chatbot-actions a,
.anjos-chatbot-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--anjos-chat-secondary);
  background: #fff;
  border: 1px solid #dcd2e9;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}

.anjos-chatbot-actions button:hover,
.anjos-chatbot-actions a:hover {
  border-color: var(--anjos-chat-primary);
  color: var(--anjos-chat-primary);
  transform: translateY(-1px);
}

.anjos-chatbot-message.typing .anjos-chatbot-bubble {
  display: flex;
  gap: 4px;
  padding: 13px 15px;
}

.anjos-chatbot-message.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9c8cab;
  animation: anjos-chat-dot 1.2s infinite;
}

.anjos-chatbot-message.typing span:nth-child(2) {
  animation-delay: .15s;
}

.anjos-chatbot-message.typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes anjos-chat-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .5;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.anjos-chatbot-quick {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 12px 10px;
  background: #faf8fd;
  border-top: 1px solid #eee8f4;
}

.anjos-chatbot-quick button {
  flex: 0 0 auto;
  border: 1px solid #ddd2e9;
  background: #fff;
  color: #543174;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.anjos-chatbot-quick button:hover {
  border-color: var(--anjos-chat-primary);
  background: #fff8fc;
}

.anjos-chatbot-quick button:disabled,
.anjos-chatbot-form button:disabled,
.anjos-chatbot-form textarea:disabled {
  cursor: wait;
  opacity: .62;
}

.anjos-chatbot-form {
  display: grid;
  grid-template-columns: 1fr 45px;
  gap: 8px;
  padding: 10px 11px 7px;
  background: #fff;
  border-top: 1px solid #eee8f4;
}

.anjos-chatbot-form textarea {
  width: 100%;
  max-height: 110px;
  resize: none;
  border: 1px solid #dcd5e4;
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--anjos-chat-text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.anjos-chatbot-form textarea:focus {
  border-color: var(--anjos-chat-primary);
  box-shadow: 0 0 0 3px rgba(237, 58, 139, .10);
}

.anjos-chatbot-form button {
  width: 45px;
  height: 45px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--anjos-chat-primary), var(--anjos-chat-secondary));
  cursor: pointer;
  font-size: 18px;
}

.anjos-chatbot-privacy {
  display: block;
  padding: 0 12px 9px;
  color: var(--anjos-chat-muted);
  background: #fff;
  font-size: 10px;
  line-height: 1.3;
}

.anjos-chatbot .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Estado minimizado: deixa somente o cabeçalho compacto. */
.anjos-chatbot.is-minimized .anjos-chatbot-panel {
  width: min(330px, calc(100vw - 28px));
  height: auto;
  min-height: 0;
  bottom: 0;
  grid-template-rows: auto;
  cursor: pointer;
}

.anjos-chatbot.is-minimized .anjos-chatbot-header {
  min-height: 68px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.anjos-chatbot.is-minimized .anjos-chatbot-avatar-wrap {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
}

.anjos-chatbot.is-minimized .anjos-chatbot-header img {
  width: 46px;
  height: 46px;
}

.anjos-chatbot.is-minimized .anjos-chatbot-messages,
.anjos-chatbot.is-minimized .anjos-chatbot-quick,
.anjos-chatbot.is-minimized .anjos-chatbot-form,
.anjos-chatbot.is-minimized .anjos-chatbot-privacy,
.anjos-chatbot.is-minimized .anjos-chatbot-reset {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .anjos-chatbot-avatar-image,
  .anjos-chatbot-pulse,
  .anjos-chatbot-header-info .anjos-chatbot-status i {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 600px) {
  .anjos-chatbot {
    right: 12px;
    bottom: 82px;
  }

  .anjos-chatbot-toggle {
    width: 62px;
    height: 62px;
  }

  .anjos-chatbot-toggle img {
    width: 56px;
    height: 56px;
  }

  .anjos-chatbot-panel {
    position: fixed;
    inset: 10px 10px 80px 10px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
  }

  .anjos-chatbot.is-minimized .anjos-chatbot-panel {
    inset: auto 10px 82px 10px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
  }

  .anjos-chatbot-header {
    padding-left: 12px;
    padding-right: 10px;
    gap: 8px;
  }

  .anjos-chatbot-header-actions {
    gap: 4px;
  }

  .anjos-chatbot-close,
  .anjos-chatbot-minimize,
  .anjos-chatbot-reset {
    width: 34px;
    height: 34px;
  }
}
