.chatbot-widget {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 12000;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.chatbot-toggle {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 0;
  background: transparent url("/img/bulle_ia.png") center/contain no-repeat;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
  position: relative;
  transform: scale(2.6);
}

.chatbot-toggle-icon {
  display: none;
}

.chatbot-toggle-icon span,
.chatbot-toggle-icon span::before,
.chatbot-toggle-icon span::after {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffffff;
}

.chatbot-toggle-icon span {
  position: relative;
}

.chatbot-toggle-icon span::before {
  position: absolute;
  left: -8px;
  top: 0;
}

.chatbot-toggle-icon span::after {
  position: absolute;
  right: -8px;
  top: 0;
}

.chatbot-toggle:hover {
  transform: scale(2.65);
  filter: saturate(1.05);
}

.chatbot-toggle-dot {
  position: absolute;
  top: 12px;
  right: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.65);
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(420px, calc(100vw - 24px));
  height: min(600px, calc(100vh - 100px));
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #d6e1f2;
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chatbot-widget.is-open .chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid #e6edf8;
  background: linear-gradient(145deg, #edf4ff 0%, #ffffff 70%);
}

.chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.chatbot-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #5f6f84;
}

.chatbot-close {
  border: 0;
  background: #e7efff;
  color: #1e40af;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot-message {
  display: inline-block;
  width: fit-content;
  max-width: 62%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.chatbot-message-bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #d9e5f7;
  color: #1f2a3b;
}

.chatbot-message-typed::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: #1f2a3b;
  animation: chatbotCaretBlink 0.85s steps(1, end) infinite;
}

.chatbot-message-user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
}

.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 11px 12px 12px;
  border-top: 1px solid #e8eef9;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
}

.chatbot-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ccdaef;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.chatbot-form input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.chatbot-form button {
  border: 0;
  border-radius: 10px;
  padding: 0 15px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.chatbot-form button:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.chatbot-message-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
}

.chatbot-message-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b7a91;
  opacity: 0.35;
  animation: chatbotTypingPulse 1s infinite ease-in-out;
}

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

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

@keyframes chatbotTypingPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes chatbotCaretBlink {
  0%, 45% {
    opacity: 1;
  }
  46%, 100% {
    opacity: 0;
  }
}

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

  .chatbot-toggle {
    width: 54px;
    height: 54px;
  }

  .chatbot-panel {
    right: -2px;
    bottom: 66px;
    width: calc(100vw - 16px);
    height: min(72vh, 560px);
    border-radius: 14px;
  }
}
