/* CHATBOT.CSS — Gemini-Powered Chat Interface */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  max-height: 700px;
}

/* Chat Header */
.chat-header {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.chat-header-info h3 {
  font-size: 1rem;
  font-weight: 700;
}

.chat-header-info p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--color-success);
  font-weight: 600;
}

.chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

/* Message Bubble */
.chat-msg {
  display: flex;
  gap: var(--space-sm);
  max-width: 85%;
  animation: msgSlideIn 0.3s ease;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.bot { align-self: flex-start; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chat-msg.bot .msg-avatar {
  background: var(--gradient-primary);
  color: white;
}

.chat-msg.user .msg-avatar {
  background: rgba(79, 70, 229, 0.15);
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-msg.bot .msg-bubble {
  background: var(--color-surface);
  border: var(--glass-border);
  border-radius: 16px 16px 16px 4px;
  color: var(--color-text);
}

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

.msg-time {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-msg.user .msg-time { text-align: right; }

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
  padding: 12px 20px;
  background: var(--color-surface);
  border: var(--glass-border);
  border-radius: 16px 16px 16px 4px;
}

.typing-indicator.active { display: flex; gap: 4px; align-items: center; }

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: typingBounce 1.4s infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Chat Input */
.chat-input-area {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: var(--glass-border);
}

.chat-input-wrapper {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 1.4;
  transition: border-color var(--transition-fast);
}

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

.chat-input::placeholder { color: var(--color-text-muted); }

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-xs);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  border: none;
  font-size: 1.1rem;
}

.chat-send-btn:hover { background: var(--color-primary-dark); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Quick Suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0 var(--space-lg) var(--space-sm);
}

.suggestion-chip {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(79, 70, 229, 0.06);
  color: var(--color-primary);
  border: 1px solid rgba(79, 70, 229, 0.15);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--color-primary);
}

/* Sidebar Info */
.chat-sidebar-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.info-card {
  padding: var(--space-md);
}

.info-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.info-card p, .info-card li {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.info-card ul {
  list-style: none;
  padding: 0;
}

.info-card li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.info-card li::before {
  content: '→';
  color: var(--color-primary);
  font-weight: 700;
}

/* Responsive */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar-info { display: none; }
  .chat-container { max-height: calc(100vh - 100px); }
}

/* Markdown formatting in bot messages */
.msg-bubble code {
  background: rgba(79, 70, 229, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.msg-bubble strong { font-weight: 700; }

.msg-bubble ul, .msg-bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.msg-bubble li { margin: 4px 0; }
