/* ══════════════════════════════════════════════════════════
   GenDB Demo — Tutorial / Onboarding Styles
   ══════════════════════════════════════════════════════════ */

/* ── Tutorial Overlay (covers everything) ─────────────── */
#tutorial-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: none;
  font-family: 'Inter', system-ui, sans-serif;
}
#tutorial-overlay.active { display: block; }

/* ── Top-right Controls ───────────────────────────────── */
.tut-controls {
  position: fixed; top: 24px; right: 32px; z-index: 10020;
  display: flex; align-items: center; gap: 10px;
}

/* ── Audio Toggle ─────────────────────────────────────── */
.tut-audio-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 0;
}
.tut-audio-btn:hover {
  background: #f9fafb;
  border-color: #6366f1;
  color: #6366f1;
  box-shadow: 0 2px 12px rgba(99,102,241,0.15);
}
.tut-audio-btn svg { display: block; }

/* ── Skip Button ──────────────────────────────────────── */
.tut-skip {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 0.85rem; font-weight: 500;
  padding: 8px 20px; border-radius: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  letter-spacing: 0.02em;
}
.tut-skip:hover {
  background: #f9fafb;
  border-color: #6366f1;
  color: #6366f1;
  box-shadow: 0 2px 12px rgba(99,102,241,0.15);
}

/* ── Subtitle Bar ─────────────────────────────────────── */
.tut-subtitle {
  position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%);
  z-index: 10015;
  max-width: 680px; width: 90%;
  text-align: center;
  padding: 14px 28px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  color: #23272f;
  font-size: 1.05rem; line-height: 1.6;
  font-weight: 400;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.tut-subtitle.visible { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   PART 1: Cinematic Intro
   ══════════════════════════════════════════════════════════ */
.tut-intro {
  position: fixed; inset: 0; z-index: 10010;
  background: linear-gradient(180deg, #eceaff 0%, #f0fdf8 50%, #fafafa 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.tut-intro::before {
  content: '';
  position: absolute; top: -300px; left: 50%; transform: translateX(-50%);
  width: 1200px; height: 1200px;
  background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, rgba(5,150,105,0.05) 40%, transparent 65%);
  pointer-events: none;
}

/* ── Landing (choice screen) ──────────────────────────── */
.tut-landing {
  text-align: center;
  opacity: 0;
  animation: tutFadeIn 0.8s ease 0.3s forwards;
}
.tut-landing-logo {
  font-size: 3.2rem; font-weight: 900;
  letter-spacing: -0.04em;
  color: #23272f;
  margin-bottom: 12px;
}
.tut-landing-logo .gen { color: #6366f1; }
.tut-landing-tagline {
  font-size: 1.1rem; color: #6b7280;
  margin-bottom: 48px; font-weight: 300;
}
.tut-landing-buttons {
  display: flex; gap: 16px; justify-content: center;
}
.tut-btn {
  padding: 14px 36px; border-radius: 12px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
  letter-spacing: 0.01em;
}
.tut-btn-primary {
  background: #6366f1; color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}
.tut-btn-primary:hover {
  background: #4f46e5;
  box-shadow: 0 6px 24px rgba(99,102,241,0.3);
  transform: translateY(-2px);
}
.tut-btn-secondary {
  background: #fff;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.tut-btn-secondary:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #d1d5db;
}

/* ── Scene Container ──────────────────────────────────── */
.tut-scene {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
  padding: 40px;
}
.tut-scene.active { opacity: 1; pointer-events: auto; }

/* ── Scene 1: Logo ────────────────────────────────────── */
.tut-logo-big {
  font-size: 5rem; font-weight: 900;
  letter-spacing: -0.04em;
  color: #23272f;
  text-align: center;
  opacity: 0;
  animation: tutLogoIn 1.2s cubic-bezier(0.16,1,0.3,1) forwards;
}
.tut-logo-big .gen { color: #6366f1; }
.tut-logo-glow {
  position: absolute; width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  animation: tutGlowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tutLogoIn {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes tutGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ── Scene 2: The Problem ─────────────────────────────── */
.tut-problem-visual {
  display: flex; flex-direction: column; align-items: center; gap: 32px;
}
.tut-db-icon {
  width: 80px; height: 100px;
  position: relative;
}
.tut-db-icon svg { width: 100%; height: 100%; }
.tut-problem-text {
  text-align: center; max-width: 560px;
}
.tut-problem-text h2 {
  font-size: 1.8rem; font-weight: 700; color: #23272f;
  margin-bottom: 16px;
  opacity: 0; animation: tutFadeUp 0.7s ease 0.2s forwards;
}
.tut-problem-text p {
  font-size: 1.1rem; color: #6b7280;
  line-height: 1.7;
  opacity: 0; animation: tutFadeUp 0.7s ease 0.5s forwards;
}

/* ── Scene 3: The Insight ─────────────────────────────── */
.tut-insight {
  text-align: center; max-width: 800px;
}
.tut-code-morph {
  display: flex; align-items: stretch; justify-content: center; gap: 24px;
  margin-bottom: 36px;
}
.tut-code-block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #374151;
  text-align: left;
  line-height: 1.6;
  min-width: 200px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  opacity: 0;
}
.tut-code-block.sql-block { animation: tutFadeIn 0.6s ease 0.2s forwards; }
.tut-code-block .kw { color: #6366f1; }
.tut-code-block .fn { color: #059669; }
.tut-code-block .str { color: #d97706; }
.tut-arrow-morph {
  font-size: 1.8rem; color: #6366f1;
  display: flex; align-items: center;
  opacity: 0; animation: tutFadeIn 0.5s ease 0.8s forwards;
}
.tut-code-block.cpp-block { animation: tutFadeIn 0.6s ease 1.2s forwards; }

.tut-insight-headline {
  font-size: 1.5rem; font-weight: 700; color: #23272f;
  white-space: nowrap;
  opacity: 0; animation: tutFadeUp 0.7s ease 1.8s forwards;
}
.tut-insight-headline em {
  font-style: normal;
  background: linear-gradient(135deg, #6366f1, #059669);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Scene 4: Pipeline ────────────────────────────────── */
.tut-pipeline {
  display: flex; align-items: flex-start; gap: 0;
  justify-content: center;
}
.tut-agent {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  width: 110px;       /* fixed width forces uniform layout */
  opacity: 0;
  transform: translateY(20px);
}
.tut-agent.show {
  animation: tutFadeUp 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}
.tut-agent-circle {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.tut-agent-name {
  font-size: 0.78rem; color: #23272f;
  font-weight: 600; text-align: center;
  line-height: 1.3;
  height: 2.6em;       /* fixed height = two lines always */
  display: flex; align-items: center; justify-content: center;
}
.tut-agent-role {
  font-size: 0.68rem; color: #9ca3af;
  text-align: center;
  line-height: 1.3;
  height: 2.6em;       /* fixed height = two lines always */
  display: flex; align-items: center; justify-content: center;
}
.tut-pipe-arrow {
  font-size: 1.2rem; color: #d1d5db;
  margin: 0 2px;
  padding-top: 20px;   /* vertically center with circles */
  opacity: 0;
  flex-shrink: 0;
}
.tut-pipe-arrow.show { animation: tutFadeIn 0.3s ease forwards; }

/* ── Scene 5: Results ─────────────────────────────────── */
.tut-results {
  text-align: center;
  max-width: 700px;
}
.tut-results-title {
  font-size: 1.4rem; font-weight: 700; color: #23272f;
  margin-bottom: 8px;
  opacity: 0; animation: tutFadeUp 0.6s ease forwards;
}
.tut-results-subtitle {
  font-size: 0.95rem; color: #9ca3af;
  margin-bottom: 32px;
  opacity: 0; animation: tutFadeUp 0.6s ease 0.2s forwards;
}
.tut-stats-row {
  display: flex; gap: 48px; justify-content: center; margin-bottom: 36px;
  flex-wrap: wrap;
}
.tut-stat {
  text-align: center;
}
.tut-stat-number {
  font-size: 3.2rem; font-weight: 900;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.tut-stat-number.c-emerald { color: #059669; }
.tut-stat-number.c-indigo { color: #6366f1; }
.tut-stat-number.c-amber { color: #d97706; }
.tut-stat-label {
  font-size: 0.85rem; color: #9ca3af;
  margin-top: 4px;
}
.tut-results-bar {
  display: flex; align-items: flex-end; gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}
.tut-bar-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
}
.tut-bar {
  width: 64px;
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: height 1.2s cubic-bezier(0.16,1,0.3,1);
  height: 0;    /* animated to px value via JS */
  min-height: 0;
}
.tut-bar-ms {
  font-size: 0.62rem; font-weight: 700; color: #fff;
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
}
.tut-bar-break::after {
  content: '';
  position: absolute;
  left: -2px; right: -2px;
  bottom: 28px;
  height: 4px;
  background: repeating-linear-gradient(
    135deg,
    rgba(255,255,255,0.85) 0px, rgba(255,255,255,0.85) 3px,
    transparent 3px, transparent 6px
  );
}
.tut-bar-label {
  font-size: 0.68rem; color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}
.tut-auto-note {
  font-size: 0.95rem; color: #6b7280; font-weight: 500;
  margin-top: 8px;
  opacity: 0; animation: tutFadeIn 0.6s ease 2s forwards;
}

/* ── Scene 6: Transition ──────────────────────────────── */
.tut-transition-text {
  font-size: 1.6rem; font-weight: 600; color: #23272f;
  opacity: 0;
  animation: tutFadeIn 0.8s ease 0.2s forwards;
}

/* ── Intro Next Button ─────────────────────────────────── */
.tut-intro-next {
  position: fixed;
  right: 40px; bottom: 40px;
  z-index: 10016;
  padding: 12px 32px;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}
@media (max-width: 640px) {
  .tut-intro-next { right: 16px; bottom: 88px; padding: 9px 20px; font-size: 0.85rem; }
  .tut-subtitle { bottom: 16px; max-width: 95%; font-size: 0.78rem; padding: 8px 12px; line-height: 1.45; }
}

/* ── Intro fade-out ───────────────────────────────────── */
.tut-intro.fade-out {
  animation: tutFadeOut 0.8s ease forwards;
}
@keyframes tutFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   PART 2: Guided Tour (Spotlight)
   ══════════════════════════════════════════════════════════ */
.tut-spotlight-svg {
  position: fixed; inset: 0; z-index: 10010;
  width: 100%; height: 100%;
}

/* ── Tooltip ──────────────────────────────────────────── */
.tut-tooltip {
  position: fixed; z-index: 10020;
  background: #fff;
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.04);
  max-width: 340px;
  width: max-content;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, top 0.4s ease, left 0.4s ease;
}
.tut-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.tut-tooltip.no-transition {
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.tut-tooltip-text {
  font-size: 0.92rem; color: #23272f;
  line-height: 1.6; margin-bottom: 16px;
}
.tut-tooltip-step {
  font-size: 0.7rem; color: #9ca3af;
  font-weight: 500; margin-bottom: 6px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.tut-tooltip-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.tut-tooltip-next {
  padding: 8px 22px; border-radius: 8px;
  background: #6366f1; color: #fff;
  font-size: 0.85rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.2s ease;
}
.tut-tooltip-next:hover {
  background: #818cf8;
  transform: translateY(-1px);
}
.tut-tooltip-skip {
  padding: 8px 16px; border-radius: 8px;
  background: none; color: #9ca3af;
  font-size: 0.82rem; font-weight: 500;
  border: none; cursor: pointer;
}
.tut-tooltip-skip:hover { color: #6b7280; }

/* ── Tooltip Arrow ────────────────────────────────────── */
.tut-tooltip::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  transform: rotate(45deg);
}
.tut-tooltip.arrow-top::after {
  top: -6px; left: var(--arrow-x, 50%); margin-left: -6px;
}
.tut-tooltip.arrow-bottom::after {
  bottom: -6px; left: var(--arrow-x, 50%); margin-left: -6px;
}
.tut-tooltip.arrow-left::after {
  left: -6px; top: 50%; margin-top: -6px;
}
.tut-tooltip.arrow-right::after {
  right: -6px; top: 50%; margin-top: -6px;
}

/* ── Highlight ring (pulsing border around target) ────── */
.tut-highlight-ring {
  position: fixed; z-index: 10012;
  border: 2px solid #6366f1;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12), 0 0 20px rgba(99,102,241,0.08);
  transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
  animation: tutRingPulse 2.5s ease-in-out infinite;
}
@keyframes tutRingPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(99,102,241,0.12), 0 0 20px rgba(99,102,241,0.08); }
  50% { box-shadow: 0 0 0 6px rgba(99,102,241,0.2), 0 0 28px rgba(99,102,241,0.12); }
}

/* ══════════════════════════════════════════════════════════
   Shared Keyframes
   ══════════════════════════════════════════════════════════ */
@keyframes tutFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes tutFadeUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Guided Tour Button (header) ──────────────────────── */
.tut-tour-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}
.tut-tour-btn:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--indigo-bg);
}

/* ── Responsive: Tablet ────────────────────────────────── */
@media (max-width: 768px) {
  .tut-controls { right: 16px; top: 16px; }
  .tut-skip { padding: 7px 16px; font-size: 0.8rem; }
  .tut-audio-btn { width: 34px; height: 34px; }
  .tut-subtitle { max-width: 90%; padding: 12px 20px; font-size: 0.95rem; bottom: 32px; }
  .tut-tooltip { max-width: 300px; }
  .tut-landing-logo { font-size: 2.6rem; }
  .tut-landing-tagline { font-size: 1rem; margin-bottom: 36px; }
  .tut-scene { padding: 24px; }
}

/* ── Responsive: Phone ────────────────────────────────── */
@media (max-width: 640px) {
  .tut-logo-big { font-size: 2.8rem; }
  .tut-problem-text h2 { font-size: 1.3rem; }
  .tut-problem-text p { font-size: 1rem; }
  .tut-insight { max-width: 100%; }
  .tut-insight-headline { font-size: 1rem; white-space: normal; }
  .tut-code-morph { flex-direction: column; gap: 16px; }
  .tut-code-block { min-width: 0; width: 100%; }
  .tut-arrow-morph { transform: rotate(90deg); margin: -4px auto; align-self: center; }
  .tut-stats-row { gap: 20px; }
  .tut-stat-number { font-size: 2rem; }
  .tut-results { max-width: 100%; }
  .tut-results-bar { gap: 6px; }
  .tut-bar { width: 36px; }
  .tut-bar-ms { font-size: 0.55rem; }
  .tut-bar-label { font-size: 0.6rem; }
  /* Pipeline agents: wrap into 2 rows of 3 on phones */
  .tut-pipeline { flex-wrap: wrap; justify-content: center; gap: 8px 0; max-width: 340px; margin: 0 auto; }
  .tut-agent { width: 52px; }
  .tut-agent-circle { width: 36px; height: 36px; font-size: 0.52rem; }
  .tut-agent-name { font-size: 0.56rem; height: auto; line-height: 1.2; }
  .tut-agent-role { display: none; }
  .tut-pipe-arrow { font-size: 0.7rem; margin: 0 1px; padding-top: 6px; }
  /* Tooltip + subtitle */
  .tut-tooltip { max-width: calc(100vw - 32px); padding: 16px 18px; }
  .tut-tooltip-text { font-size: 0.88rem; }
  .tut-subtitle { font-size: 0.85rem; bottom: 16px; padding: 10px 16px; max-width: 95%; }
  .tut-btn { padding: 12px 24px; font-size: 0.9rem; }
  .tut-landing-buttons { flex-direction: column; align-items: center; gap: 10px; }
  .tut-tour-btn { font-size: 0.72rem; padding: 5px 10px; }
}

/* ── Responsive: Small phone ──────────────────────────── */
@media (max-width: 380px) {
  .tut-logo-big { font-size: 2.2rem; }
  .tut-landing-logo { font-size: 2.2rem; }
  .tut-agent { width: 64px; }
  .tut-agent-circle { width: 40px; height: 40px; font-size: 0.55rem; }
  .tut-agent-name { font-size: 0.6rem; }
  .tut-stat-number { font-size: 1.8rem; }
  .tut-bar { width: 28px; }
  .tut-tooltip { padding: 14px 16px; }
  .tut-tooltip-text { font-size: 0.82rem; line-height: 1.5; }
}
