/* ===== AI Chat Support ===== */
.ai-chat-page { min-height: 100vh; display: flex; flex-direction: column; }

.ai-chat-header {
  background: rgba(10,10,15,0.97);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.ai-chat-brand { display: flex; align-items: center; gap: 12px; }
.ai-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(139,92,246,0); }
}

.ai-chat-brand h1 { font-size: 16px; font-weight: 800; }
.ai-chat-brand p { font-size: 12px; color: var(--text-muted); }
.ai-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #86efac; }
.ai-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.ai-chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 16px;
}

.ai-quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.topic-chip {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: 0.2s;
}
.topic-chip:hover {
  border-color: var(--purple);
  color: #c4b5fd;
  background: rgba(139,92,246,0.1);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 400px;
  max-height: calc(100vh - 280px);
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}

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

.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.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: 14px;
  flex-shrink: 0;
}
.msg.bot .msg-avatar { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.msg.user .msg-avatar { background: var(--bg-card); border: 1px solid var(--border); }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border-top-right-radius: 4px;
}

.msg-bubble.typing {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
}
.msg-bubble.typing span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.msg-bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.ai-input-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: auto;
}
.ai-input-area:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }

.ai-input-area textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}
.ai-input-area textarea:focus { outline: none; }
.ai-input-area textarea::placeholder { color: #6b7280; }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: 0.2s;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ai-disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px;
  line-height: 1.5;
}

.ai-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin: 8px 0;
}

.sos-banner {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.sos-banner a { color: #fca5a5; font-weight: 600; }

@media (max-width: 600px) {
  .msg { max-width: 92%; }
  .ai-messages { max-height: calc(100vh - 320px); }
}
