/* ── Chatbot Page ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Heebo', system-ui, sans-serif;
  background: var(--bg-base, #060609);
  color: var(--text-1, #f0f0ff);
  direction: rtl;
  min-height: 100dvh;
}

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  background: rgba(255,255,255,0.01);
  border-inline: 1px solid rgba(255,255,255,0.05);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: rgba(6,6,9,0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.chat-header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar-header {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-header-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.chat-header-status {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.chat-header-close {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.4rem;
  border-radius: 8px;
  transition: color 150ms, background 150ms;
}
.chat-header-close:hover { color: white; background: rgba(255,255,255,0.06); }

/* ── Messages ──────────────────────────────────────────────────────────── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  animation: msgSlide 0.3s cubic-bezier(0.2,0.8,0.2,1) both;
}

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

.msg.bot { flex-direction: row; }
.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.msg.bot .msg-bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom-right-radius: 6px;
}

.msg.user .msg-bubble {
  background: rgba(232,160,32,0.12);
  border: 1px solid rgba(232,160,32,0.2);
  border-bottom-left-radius: 6px;
  color: rgba(255,255,255,0.95);
}

/* Typing indicator */
.typing-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.75rem 1rem;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  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%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* CTA link in messages */
.msg-cta {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: rgba(232,160,32,0.15);
  border: 1px solid rgba(232,160,32,0.3);
  border-radius: 999px;
  color: #E8A020;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 150ms, transform 150ms;
}
.msg-cta:hover { background: rgba(232,160,32,0.25); transform: translateY(-1px); }

/* ── Quick Replies ──────────────────────────────────────────────────────── */

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.quick-reply-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}
.quick-reply-btn:hover {
  background: rgba(232,160,32,0.08);
  border-color: rgba(232,160,32,0.25);
  color: white;
}

/* ── Input Area ────────────────────────────────────────────────────────── */

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(6,6,9,0.9);
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  color: white;
  font-size: 16px;
  font-family: 'Heebo', sans-serif;
  resize: none;
  outline: none;
  min-height: 48px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 150ms;
  direction: rtl;
}
.chat-input:focus { border-color: rgba(139,92,246,0.4); }
.chat-input::placeholder { color: rgba(255,255,255,0.3); }

/* ── Focus visible (a11y H-26: ≥3:1 contrast indicator) ───────────────────── */
.chat-input:focus-visible,
.chat-send-btn:focus-visible,
.quick-reply-btn:focus-visible,
.chat-header-close:focus-visible,
.msg-cta:focus-visible {
  outline: 2px solid #00C4B3;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0,196,179,0.25);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8A020, #d4911a);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: transform 150ms, opacity 150ms;
}
.chat-send-btn:hover { transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .chat-header { padding: 0.75rem 1rem; }
  .chat-messages { padding: 1rem; }
  .msg-bubble { max-width: 88%; }
  .chat-quick-replies { padding: 0.5rem 0.75rem; }
}
