.ai-bot-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: #2b6cb0;
  color: #fff;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.ai-bot-toggle:hover {
  background: #2c5282;
}

.ai-bot-window {
  position: fixed;
  right: 80px;
  bottom: 70px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform-origin: bottom right;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ai-bot-window[hidden] {
  display: none;
}

.ai-bot-header {
  background: rgb(132, 44, 30);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-bot-header h3 {
  margin: 0;
  font-size: 15px;
}

.ai-bot-header span {
  font-size: 12px;
  opacity: 0.85;
}

.ai-bot-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.ai-bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f7fa;
}

.ai-bot-bubble {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-bot-bubble.user {
  align-self: flex-end;
  background: rgb(132, 44, 30);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.ai-bot-bubble.bot {
  align-self: flex-start;
  background: #fff;
  color: #1a202c;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
}

.ai-bot-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.ai-bot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a0aec0;
  animation: ai-bot-blink 1.2s infinite ease-in-out;
}

.ai-bot-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-bot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-bot-blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.ai-bot-products {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
}

.ai-bot-card {
  display: flex;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

.ai-bot-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #edf2f7;
  flex-shrink: 0;
}

.ai-bot-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ai-bot-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a202c;
}

.ai-bot-card-meta {
  font-size: 12px;
  color: #4a5568;
}

.ai-bot-card-price {
  font-size: 14px;
  font-weight: 700;
  color: rgb(132, 44, 30);
}

.ai-bot-card-desc {
  font-size: 12px;
  color: #718096;
}

.ai-bot-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.ai-bot-card-actions a,
.ai-bot-card-actions button {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid rgb(132, 44, 30);
  background: #fff;
  color: rgb(132, 44, 30);
  text-decoration: none;
  cursor: pointer;
}

.ai-bot-card-actions .primary {
  background: rgb(132, 44, 30);
  color: #fff;
}

.ai-bot-badge {
  display: inline-block;
  font-size: 11px;
  background: #fff5e6;
  color: #b7791f;
  border: 1px solid #f6c453;
  border-radius: 6px;
  padding: 2px 6px;
  margin-bottom: 6px;
  align-self: flex-start;
}

.ai-bot-form {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.ai-bot-form input {
  flex: 1;
  border: 1px solid #cbd5e0;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
}

.ai-bot-form input:focus {
  border-color: #2b6cb0;
}

.ai-bot-form button {
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  background: rgb(132, 44, 30);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.ai-bot-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 480px) {
  .ai-bot-window {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    height: calc(100vh - 140px);
  }

  .ai-bot-toggle {
    right: 12px;
    bottom: 12px;
  }
}
