/* ============================================================
   CHATBOT.CSS — Custom AI Chatbot Widget
   ============================================================ */

/* ---- Toggle Button ---- */
.chatbot-toggle {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--grad-primary, linear-gradient(135deg,#0066FF,#7C3AED));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 8px 32px rgba(0,102,255,0.40);
  border: none;
  transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.3s ease;
  pointer-events: all;
}
.chatbot-toggle:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 16px 48px rgba(0,102,255,0.55);
}
.chatbot-toggle svg { width: 28px; height: 28px; }
.chatbot-toggle-close { display: none; }
.chatbot-toggle.open .chatbot-toggle-open  { display: none; }
.chatbot-toggle.open .chatbot-toggle-close { display: block; }

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: 0; right: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #EF4444;
  border: 2px solid var(--clr-bg, #0A0A0F);
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.4s ease 2s both;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.chatbot-badge.hidden { display: none; }

/* ---- Chat Window ---- */
.chatbot-window {
  position: fixed;
  bottom: 6.5rem;
  left: 2rem;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 9rem));
  background: var(--clr-glass, rgba(22,22,30,0.95));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9997;
  box-shadow: 0 24px 80px rgba(0,0,0,0.50);
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
  transform-origin: bottom left;
}
.chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg,rgba(0,102,255,0.20),rgba(124,58,237,0.15));
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.chatbot-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg,#0066FF,#7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.chatbot-header-info { flex: 1; }
.chatbot-header-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
}
.chatbot-header-status {
  font-size: 0.7rem;
  color: #4ADE80;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.chatbot-header-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ADE80;
  animation: onlineBlink 2.5s infinite alternate;
}
.chatbot-min-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.60);
  font-size: 1rem;
  transition: all 0.2s ease;
  line-height: 1;
}
.chatbot-min-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Message Bubbles */
.chat-msg {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  animation: msgSlideIn 0.3s ease;
}
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg,#0066FF,#7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.chat-msg.user .chat-msg-avatar {
  background: linear-gradient(135deg,#7C3AED,#0066FF);
}
.chat-bubble {
  max-width: 78%;
  padding: 0.65rem 1rem;
  border-radius: 1.2rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.90);
}
.chat-msg.bot  .chat-bubble {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom-left-radius: 0.3rem;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg,#0066FF,#7C3AED);
  border-bottom-right-radius: 0.3rem;
  color: #fff;
}
.chat-time {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.30);
  margin-top: 0.25rem;
  text-align: right;
}
.chat-msg.bot .chat-time { text-align: left; }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.2rem;
  border-bottom-left-radius: 0.3rem;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.40);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%       { transform: translateY(-5px); opacity: 1; }
}

/* Suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.5rem;
}
.chat-chip {
  padding: 0.35rem 0.85rem;
  background: rgba(0,102,255,0.15);
  border: 1px solid rgba(0,102,255,0.30);
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #60A5FA;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.chat-chip:hover {
  background: rgba(0,102,255,0.35);
  color: #fff;
  transform: translateY(-2px);
}

/* Input */
.chatbot-input-wrap {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 9999px;
  padding: 0.65rem 1.1rem;
  color: rgba(255,255,255,0.90);
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
}
.chatbot-input::placeholder { color: rgba(255,255,255,0.30); }
.chatbot-input:focus { border-color: rgba(0,102,255,0.50); }
.chatbot-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg,#0066FF,#7C3AED);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chatbot-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0,102,255,0.40);
}
.chatbot-send svg { width: 18px; height: 18px; color: #fff; }

@media (max-width: 768px) {
  .chatbot-toggle { left: 1.5rem; bottom: 1.5rem; }
  .chatbot-window { left: 1.5rem; right: 1.5rem; width: auto; bottom: 5.5rem; }
}
