.doubt-chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #198754;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  animation: doubt-chat-nudge 4s ease-in-out infinite, doubt-chat-pulse 2.4s ease-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.doubt-chat-toggle:hover,
.doubt-chat-toggle:focus {
  background: #157347;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  outline: none;
}

.doubt-chat-toggle svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.doubt-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 164px;
  z-index: 1049;
  width: min(350px, calc(100vw - 32px));
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.doubt-chat-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  animation: doubt-panel-pop 0.22s ease-out;
}

.doubt-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #198754;
  color: #fff;
}

.doubt-chat-header strong {
  display: block;
  font-size: 16px;
}

.doubt-chat-header p {
  margin: 3px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.doubt-chat-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.doubt-chat-body {
  padding: 14px;
  background: #f3faf6;
}

.doubt-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.doubt-chat-message {
  align-self: flex-start;
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff;
  color: #1f2933;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  animation: doubt-message-in 0.2s ease-out;
}

.doubt-chat-message.is-user {
  align-self: flex-end;
  background: #dff3e8;
}

.doubt-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.doubt-chat-suggestions button {
  border: 1px solid #b7dec9;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: #146c43;
  font-size: 13px;
  cursor: pointer;
}

.doubt-chat-suggestions button:hover,
.doubt-chat-suggestions button:focus {
  background: #e9f7ef;
}

.doubt-chat-compose {
  display: flex;
  gap: 8px;
}

.doubt-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d5d5d5;
  border-radius: 8px;
  padding: 10px;
  color: #1f2933;
  font: inherit;
  outline: none;
}

.doubt-chat-input:focus {
  border-color: #198754;
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.16);
}

.doubt-chat-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #198754;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.doubt-chat-send:hover,
.doubt-chat-send:focus {
  background: #157347;
}

@keyframes doubt-chat-nudge {
  0%,
  100% {
    transform: translateY(0);
  }

  8% {
    transform: translateY(-4px);
  }

  16% {
    transform: translateY(0);
  }
}

@keyframes doubt-chat-pulse {
  0% {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(25, 135, 84, 0.36);
  }

  70% {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22), 0 0 0 14px rgba(25, 135, 84, 0);
  }

  100% {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(25, 135, 84, 0);
  }
}

@keyframes doubt-panel-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.92);
  }

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

@keyframes doubt-message-in {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 576px) {
  .doubt-chat-toggle {
    right: 14px;
    bottom: 14px;
    width: 54px;
    height: 54px;
  }

  .doubt-chat-panel {
    right: 14px;
    bottom: 148px;
  }
}

body.chatbot-ready .whatsapp-chat {
  bottom: 92px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.86);
}

body.chatbot-ready.show-whatsapp .whatsapp-chat {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

@media (max-width: 576px) {
  body.chatbot-ready .whatsapp-chat {
    bottom: 82px;
  }
}
