#againcart-ai-chatbot {
  position: fixed;
  z-index: 2147483646;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.4;
}

#againcart-ai-chatbot.againcart-ai-bottom-right {
  right: 24px;
  bottom: 24px;
  left: auto;
  top: auto;
}

#againcart-ai-chatbot.againcart-ai-bottom-left {
  left: 24px;
  bottom: 24px;
  right: auto;
  top: auto;
}

#againcart-ai-chatbot .againcart-ai-toggle,
#againcart-ai-chatbot .againcart-ai-panel {
  pointer-events: auto;
}

.againcart-ai-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--againcart-ai-color, #1e91ff);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(30, 145, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
  padding: 0;
  outline: none;
}

.againcart-ai-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(30, 145, 255, 0.5);
}

#againcart-ai-chatbot.panel-open .againcart-ai-toggle {
  display: none !important;
}

/* Panel fixed to viewport so parent overflow cannot clip it */
.againcart-ai-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  left: auto;
  top: auto;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e8edf3;
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 2147483647;
}

#againcart-ai-chatbot.againcart-ai-bottom-left .againcart-ai-panel {
  left: 24px;
  right: auto;
}

#againcart-ai-chatbot.againcart-ai-bottom-right .againcart-ai-panel {
  right: 24px;
  left: auto;
}

.againcart-ai-panel.is-open {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1);
}

.againcart-ai-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--againcart-ai-color, #1e91ff);
  color: #fff;
  flex-shrink: 0;
  border-radius: 16px 16px 0 0;
}

.againcart-ai-header strong {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.againcart-ai-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.95;
}

.againcart-ai-close:hover {
  opacity: 1;
}

.againcart-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: #fff;
  min-height: 0;
}

.againcart-ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px 12px;
  gap: 14px;
}

.againcart-ai-bot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--againcart-ai-color, #1e91ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.againcart-ai-bot-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.againcart-ai-welcome-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #64748b;
  max-width: 280px;
}

.againcart-ai-message {
  margin-top: 12px;
  padding: 0 16px;
  display: flex;
}

.againcart-ai-user {
  justify-content: flex-end;
}

.againcart-ai-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.againcart-ai-bot .againcart-ai-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.againcart-ai-user .againcart-ai-bubble {
  background: var(--againcart-ai-color, #1e91ff);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.againcart-ai-typing {
  padding: 0 16px 8px;
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.againcart-ai-typing[hidden] {
  display: none !important;
}

.againcart-ai-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  background: var(--againcart-ai-color, #1e91ff);
  border-radius: 50%;
  animation: againcart-ai-bounce 1.2s infinite ease-in-out;
}

.againcart-ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.againcart-ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes againcart-ai-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.againcart-ai-form {
  padding: 12px 14px 16px;
  background: #fff;
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
  border-radius: 0 0 16px 16px;
}

.againcart-ai-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.againcart-ai-input-wrap input {
  width: 100%;
  border: 1px solid #c5d7eb;
  border-radius: 28px;
  padding: 12px 52px 12px 16px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  background: #fff;
}

.againcart-ai-input-wrap input:focus {
  border-color: var(--againcart-ai-color, #1e91ff);
  box-shadow: 0 0 0 3px rgba(30, 145, 255, 0.15);
}

.againcart-ai-send {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--againcart-ai-color, #1e91ff);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.againcart-ai-send:hover {
  filter: brightness(1.06);
}

.againcart-ai-search-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1e91ff;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.againcart-ai-search-label input {
  margin: 0;
}

@media (max-width: 767px) {
  .againcart-ai-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 110px);
    bottom: 88px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  #againcart-ai-chatbot.againcart-ai-bottom-left .againcart-ai-panel,
  #againcart-ai-chatbot.againcart-ai-bottom-right .againcart-ai-panel {
    left: 10px;
    right: 10px;
  }
}
