/* ============================================
   Bot Launch Experience — Full-screen persona reveal + onboarding
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a14;
  color: #e2e8f0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Stage ─────────────────────────────────────────────────── */
.launch-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.particle-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ─── Bot Persona (centered) ────────────────────────────────── */
.bot-persona {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              margin-top 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.bot-persona.compact {
  transform: scale(0.65);
  margin-top: -8vh;
}

/* Avatar ring + glow */
.bot-avatar-ring {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bot-accent, #8b5cf6) 0%, transparent 70%);
  opacity: 0.25;
  animation: glow-breathe 3s ease-in-out infinite;
  filter: blur(20px);
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.08); }
}

.bot-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.bot-avatar.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Inline SVG after face engine replacement */
.bot-avatar-ring .urbot-face-active {
  width: 200px !important;
  height: 200px !important;
  border-radius: 50% !important;
}

.bot-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
  text-align: center;
}

.bot-name.revealed { opacity: 1; transform: translateY(0); }

.bot-tagline {
  font-size: 1rem;
  color: #94a3b8;
  max-width: 360px;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease 0.5s, transform 0.5s ease 0.5s;
}

.bot-tagline.revealed { opacity: 1; transform: translateY(0); }

/* ─── Onboarding Panel ──────────────────────────────────────── */
.onboard-panel {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  max-height: 55vh;
  background: linear-gradient(180deg, rgba(10, 10, 20, 0) 0%, rgba(10, 10, 20, 0.95) 8%, #0d0d1a 12%);
  padding: 40px 20px 24px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(0);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.5s ease;
}

.onboard-panel.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* Chat messages */
.onboard-chat {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 30vh;
  padding-right: 8px;
  scroll-behavior: smooth;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: msg-in 0.35s ease;
  word-wrap: break-word;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg.bot {
  align-self: flex-start;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.15);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--bot-accent, #8b5cf6);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg .typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 2px 0;
}

.chat-msg .typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.chat-msg .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-msg .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ─── Question Area ─────────────────────────────────────────── */
.question-area {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.question-area.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.question-option {
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.question-option:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #e2e8f0;
  transform: translateY(-1px);
}

.question-option.selected {
  background: var(--bot-accent, #8b5cf6);
  border-color: var(--bot-accent, #8b5cf6);
  color: #fff;
}

/* Text input for open-ended */
.question-input-wrap {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.question-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.question-input:focus {
  border-color: var(--bot-accent, #8b5cf6);
}

.question-input::placeholder { color: #4a5568; }

.btn-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--bot-accent, #8b5cf6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-send:hover { transform: scale(1.05); }
.btn-send:disabled { opacity: 0.4; cursor: default; }

/* ─── Permission Cards ──────────────────────────────────────── */
.permission-area {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.permission-area.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.permission-title {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 12px;
  text-align: center;
}

.permission-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.permission-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s;
}

.permission-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.permission-card.granted {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}

.permission-icon {
  font-size: 24px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.permission-info {
  flex: 1;
  min-width: 0;
}

.permission-name {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.permission-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.permission-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.permission-toggle::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #94a3b8;
  top: 3px; left: 3px;
  transition: transform 0.2s, background 0.2s;
}

.permission-toggle.on {
  background: #22c55e;
}

.permission-toggle.on::after {
  transform: translateX(20px);
  background: #fff;
}

/* ─── Primary Button ────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 14px 24px;
  border-radius: 12px;
  border: none;
  background: var(--bot-accent, #8b5cf6);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

/* ─── Loading Overlay ───────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0a0a14;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--bot-accent, #8b5cf6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: #64748b;
}

/* ─── Completion ────────────────────────────────────────────── */
.completion-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #0a0a14;
  animation: fade-in 0.6s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.completion-check {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  border: 2px solid #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  animation: check-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

@keyframes check-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.completion-message {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  max-width: 360px;
  animation: fade-in 0.5s ease 0.4s both;
}

.completion-cta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  animation: fade-in 0.5s ease 0.6s both;
}

.completion-cta a, .completion-cta button {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s;
}

.completion-cta a:hover, .completion-cta button:hover {
  transform: translateY(-1px);
}

.cta-chat {
  background: var(--bot-accent, #8b5cf6);
  color: #fff;
  border: none;
}

.cta-download {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
.onboard-chat::-webkit-scrollbar { width: 4px; }
.onboard-chat::-webkit-scrollbar-track { background: transparent; }
.onboard-chat::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bot-avatar, .bot-avatar-ring { width: 140px; height: 140px; }
  .bot-avatar-ring .urbot-face-active { width: 140px !important; height: 140px !important; }
  .bot-name { font-size: 1.5rem; }
  .bot-tagline { font-size: 0.9rem; }
  .onboard-panel { max-height: 60vh; padding: 30px 16px 20px; }
  .bot-persona.compact { transform: scale(0.55); margin-top: -5vh; }
}

/* ─── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .bot-avatar-glow { animation: none; }
}
