/* AI Shop Assistant — Chatbot Styles */
:root {
  --aisa-primary: #10b981;
  --aisa-bg: #ffffff;
  --aisa-text: #1f2937;
  --aisa-user-bg: #10b981;
  --aisa-bot-bg: #f3f4f6;
  --aisa-shadow: 0 20px 60px rgba(0,0,0,0.18);
  --aisa-radius: 20px;
}

#aisa-chatbot-wrapper * { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, sans-serif; }

/* Toggle Button */
#aisa-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--aisa-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 30px rgba(16,185,129,0.45);
  z-index: 999998;
  transition: transform 0.3s ease, box-shadow 0.3s;
  animation: aisa-pulse 2.5s infinite;
}
#aisa-toggle-btn:hover { transform: scale(1.12); box-shadow: 0 10px 40px rgba(16,185,129,0.6); }
@keyframes aisa-pulse {
  0%,100% { box-shadow: 0 6px 30px rgba(16,185,129,0.45); }
  50%      { box-shadow: 0 6px 40px rgba(16,185,129,0.75); }
}

/* Badge */
#aisa-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* Chat Window */
#aisa-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: var(--aisa-bg);
  border-radius: var(--aisa-radius);
  box-shadow: var(--aisa-shadow);
  display: flex;
  flex-direction: column;
  z-index: 999999;
  overflow: hidden;
  transform: scale(0.85) translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#aisa-chat-window.aisa-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#aisa-header {
  background: var(--aisa-primary);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#aisa-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
#aisa-header-info h4 { margin:0; font-size:15px; font-weight:700; }
#aisa-header-info span { font-size:12px; opacity:0.85; }
#aisa-close-btn {
  margin-left: auto;
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; opacity: 0.8;
  transition: opacity 0.2s;
}
#aisa-close-btn:hover { opacity: 1; }

/* Quick Replies */
#aisa-quick-replies {
  padding: 10px 14px 4px;
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.aisa-quick-btn {
  background: #fff;
  border: 1.5px solid var(--aisa-primary);
  color: var(--aisa-primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.aisa-quick-btn:hover { background: var(--aisa-primary); color: #fff; }

/* Messages */
#aisa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#aisa-messages::-webkit-scrollbar { width: 4px; }
#aisa-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.aisa-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.aisa-msg.aisa-bot { align-self: flex-start; }
.aisa-msg.aisa-user { align-self: flex-end; flex-direction: row-reverse; }

.aisa-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.aisa-bot .aisa-bubble { background: var(--aisa-bot-bg); color: var(--aisa-text); border-bottom-left-radius: 4px; }
.aisa-user .aisa-bubble { background: var(--aisa-primary); color: #fff; border-bottom-right-radius: 4px; }

.aisa-msg-icon {
  width: 28px; height: 28px;
  background: var(--aisa-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Typing indicator */
.aisa-typing .aisa-bubble { padding: 12px 16px; }
.aisa-dots { display: flex; gap: 4px; }
.aisa-dots span {
  width: 7px; height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: aisa-bounce 1.2s infinite;
}
.aisa-dots span:nth-child(2) { animation-delay: 0.2s; }
.aisa-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aisa-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* Input Area */
#aisa-input-area {
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
}
#aisa-user-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}
#aisa-user-input:focus { border-color: var(--aisa-primary); }
#aisa-send-btn {
  width: 40px; height: 40px;
  background: var(--aisa-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}
#aisa-send-btn:hover { transform: scale(1.1); }

/* WhatsApp button */
#aisa-whatsapp-btn {
  display: block;
  margin: 0 14px 10px;
  background: #25d366;
  color: #fff;
  text-align: center;
  border-radius: 10px;
  padding: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.2s;
}
#aisa-whatsapp-btn:hover { opacity: 0.9; }

/* Mobile */
@media (max-width: 480px) {
  #aisa-chat-window { width: calc(100vw - 20px); right: 10px; bottom: 80px; height: 75vh; }
  #aisa-toggle-btn { bottom: 16px; right: 16px; }
}

/* Left position */
.aisa-left #aisa-toggle-btn,
.aisa-left #aisa-chat-window { right: auto; left: 24px; }
