:root {
  --angela-primary: #6f2cff;
  --angela-primary-dark: #5520c9;
  --angela-green: #16a34a;
  --angela-text: #1f2937;
  --angela-muted: #6b7280;
  --angela-border: #e8ddff;
  --angela-bg: #ffffff;
  --angela-soft: #f7f3ff;
  --angela-shadow: 0 22px 60px rgba(31, 41, 55, .22);
}

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

.angela-chatbot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: 'Poppins', Arial, sans-serif;
  color: var(--angela-text);
}

.angela-chatbot__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--angela-primary), var(--angela-green));
  box-shadow: 0 16px 36px rgba(111, 44, 255, .32);
  cursor: pointer;
  font: 700 14px/1 'Poppins', Arial, sans-serif;
  transition: transform .2s ease, box-shadow .2s ease;
}

.angela-chatbot__launcher:hover,
.angela-chatbot__launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(111, 44, 255, .4);
  outline: none;
}

.angela-chatbot__launcher-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
}

.angela-chatbot__window {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(360px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--angela-border);
  border-radius: 24px;
  background: var(--angela-bg);
  box-shadow: var(--angela-shadow);
}

.angela-chatbot__window[hidden] {
  display: none;
}

.angela-chatbot__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--angela-primary), var(--angela-primary-dark));
}

.angela-chatbot__avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 3px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: #fff;
  object-fit: cover;
}

.angela-chatbot__header strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.angela-chatbot__header span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: .9;
}

.angela-chatbot__close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.angela-chatbot__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  max-height: 390px;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #fbf9ff);
}

.angela-chatbot__message {
  max-width: 86%;
  border-radius: 16px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.angela-chatbot__message--bot {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: var(--angela-soft);
  color: var(--angela-text);
}

.angela-chatbot__message--user {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  color: #fff;
  background: var(--angela-primary);
}

.angela-chatbot__message--loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--angela-muted);
}

.angela-chatbot__message--loading::after {
  content: '';
  width: 28px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle closest-side, currentColor 80%, transparent) 0 50%/33% 100% repeat-x;
  animation: angelaTyping 1s infinite linear;
}

.angela-chatbot__form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--angela-border);
  background: #fff;
}

.angela-chatbot__form textarea {
  width: 100%;
  max-height: 110px;
  resize: none;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px 13px;
  color: var(--angela-text);
  background: #f9fafb;
  font: 500 13px/1.35 'Poppins', Arial, sans-serif;
  outline: none;
}

.angela-chatbot__form textarea:focus {
  border-color: var(--angela-primary);
  box-shadow: 0 0 0 3px rgba(111, 44, 255, .12);
}

.angela-chatbot__send {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--angela-green);
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease;
}

.angela-chatbot__send:hover,
.angela-chatbot__send:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.angela-chatbot__send:disabled,
.angela-chatbot__form textarea:disabled {
  cursor: not-allowed;
  opacity: .65;
}

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

@keyframes angelaTyping {
  0% { opacity: .25; }
  50% { opacity: 1; }
  100% { opacity: .25; }
}

@media (max-width: 640px) {
  .angela-chatbot {
    right: 14px;
    bottom: 14px;
  }

  .angela-chatbot__launcher {
    padding: 12px 14px;
  }

  .angela-chatbot__launcher-text {
    max-width: 138px;
  }

  .angela-chatbot__window {
    right: -2px;
    bottom: 62px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 92px);
    border-radius: 20px;
  }

  .angela-chatbot__messages {
    min-height: 240px;
    max-height: calc(100vh - 270px);
  }
}
