/* ============================================================
   Sanskrit Guru AI Chatbot
   ============================================================ */

.ai-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  color: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.3s ease;
}

.ai-fab:hover {
  transform: scale(1.1);
}

.ai-chat-window {
  position: fixed;
  bottom: 145px;
  right: 20px;
  width: 320px;
  height: 450px;
  max-height: calc(100vh - 200px);
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: bottom right;
}

.ai-chat-window.hidden {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.ai-chat-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.ai-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
}

.ai-close-btn:hover {
  opacity: 1;
}

.ai-chat-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-deep);
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.ai-msg-user {
  align-self: flex-end;
}

.ai-msg-bot {
  align-self: flex-start;
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.ai-msg-user .ai-msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-msg-bot .ai-msg-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
}

.ai-chat-footer {
  padding: 10px;
  background: var(--bg-elevated);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

.ai-chat-footer input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 8px 15px;
  color: var(--text-primary);
  outline: none;
}

.ai-chat-footer input:focus {
  border-color: var(--primary);
}

.ai-chat-footer button {
  background: var(--primary);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.ai-chat-footer button:hover {
  transform: scale(1.05);
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px !important;
  align-items: center;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 768px) {
  .ai-chat-window {
    width: calc(100% - 40px);
    height: 400px;
  }
}
