/* ==========================================
   YZG STUDIO - ONBOARDING (First Boot)
   ========================================== */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #050507;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.onboarding-overlay.hidden {
  display: none !important;
}

.onboard-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.onboard-scene.active {
  opacity: 1;
  pointer-events: all;
}

/* ========== ESCENA 1: HYPERCUBE ========== */
.hypercube-container {
  width: 140px;
  height: 140px;
  margin-bottom: 40px;
  animation: subtleRotate 12s linear infinite;
}

.hypercube {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
}

.cube-path {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: drawCube 2.2s ease-out forwards;
}

.cube-path.delay-1 { animation-delay: 0.3s; }
.cube-path.delay-2 { animation-delay: 0.5s; }
.cube-path.delay-3 { animation-delay: 0.7s; }
.cube-path.delay-4 { animation-delay: 0.9s; }

@keyframes drawCube {
  to { stroke-dashoffset: 0; }
}

@keyframes subtleRotate {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(8deg) scale(1.03); }
  100% { transform: rotate(0deg) scale(1); }
}

.welcome-title {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: #f8fafc;
  margin: 0 0 12px 0;
  opacity: 0;
  animation: fadeUp 1s ease 1.8s forwards;
}

.welcome-subtitle {
  font-size: 16px;
  color: #94a3b8;
  opacity: 0;
  animation: fadeUp 1s ease 2.4s forwards;
}

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

/* ========== ESCENAS 2 & 3: ECOSYSTEM & CONNECTING ========== */

.scene-title {
  font-size: 28px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s ease forwards;
}

/* Grid de Apps */
.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 500px;
}

.eco-card {
  background: rgba(28, 28, 36, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.3s ease;
}

.eco-card .material-symbols-outlined {
  font-size: 36px;
  color: var(--accent);
}

.eco-card span:last-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Animaciones escalonadas de las tarjetas */
.eco-card.animate-in {
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.eco-card:nth-child(1).animate-in { animation-delay: 0.2s; }
.eco-card:nth-child(2).animate-in { animation-delay: 0.4s; }
.eco-card:nth-child(3).animate-in { animation-delay: 0.6s; }
.eco-card:nth-child(4).animate-in { animation-delay: 0.8s; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Lista de Conexiones (Escena 3) */
.connection-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 40px;
  text-align: left;
}

.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(28, 28, 36, 0.6);
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.4s ease;
}

.connection-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.connection-item.connected {
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.1);
}

.conn-icon-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conn-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinExt 0.8s linear infinite;
}

/* Barra de Progreso */
.progress-container {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.5s;
}

.progress-container.visible { opacity: 1; }

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a8c7fa);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-text {
  font-family: var(--code-font);
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.5s;
}
.progress-text.visible { opacity: 1; }

/* ========== ESCENA 4: THE GLOW ========== */

#scene-4 {
  background: #000;
}

.glow-input-container {
  position: relative;
  width: 100%;
  max-width: 560px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Anillo de glow que respira */
.glow-ring {
  position: absolute;
  width: 100%;
  height: 70px;
  border-radius: 20px;
  background: transparent;
  box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6);
  animation: glowPulse 2.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5),
                0 0 20px 4px rgba(99, 102, 241, 0.3);
    opacity: 0.8;
  }
  50% {
    box-shadow: 0 0 0 12px rgba(99, 102, 241, 0),
                0 0 40px 10px rgba(99, 102, 241, 0.5);
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0),
                0 0 20px 4px rgba(99, 102, 241, 0.3);
    opacity: 0.8;
  }
}

#glow-input {
  position: relative;
  z-index: 2;
  width: 100%;
  background: rgba(18, 18, 23, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 16px;
  padding: 18px 24px;
  font-size: 17px;
  color: #f8fafc;
  outline: none;
  font-family: var(--font-family);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.25);
  transition: all 0.4s ease;
}

#glow-input:focus {
  border-color: #a8c7fa;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
}

#glow-input::placeholder {
  color: #64748b;
}

.glow-hint {
  margin-top: 24px;
  font-size: 14px;
  color: #64748b;
  opacity: 0;
  animation: fadeUp 1s ease 1.2s forwards;
}

/* Efecto de iluminación total cuando el usuario escribe */
.onboarding-overlay.illuminated {
  background: radial-gradient(circle at center, #0f0f15 0%, #050507 70%);
  transition: background 1.2s ease;
}

.onboarding-overlay.illuminated .glow-ring {
  animation: none;
  box-shadow: 0 0 60px 20px rgba(99, 102, 241, 0.4);
}

/* ========== ESCENA 5: AUTH GATE ========== */
.auth-card {
  background: rgba(18, 18, 23, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: popIn 0.5s ease;
}

.auth-logo {
  margin-bottom: 16px;
}

.auth-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 6px;
}

.auth-card p {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.auth-btn.google:hover { border-color: #4285f4; }
.auth-btn.microsoft:hover { border-color: #00a4ef; }
.auth-btn.email:hover { border-color: var(--accent); }

/* ==========================================
   ESCENA 6: PERSONALIZACIÓN & ENCUESTA (SURVEY)
   ========================================== */
.survey-card {
  background: rgba(18, 18, 23, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 36px 30px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* Indicadores de Pasos (Puntos de arriba) */
.survey-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.survey-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.survey-dot.active {
  background: var(--accent, #818cf8);
  width: 24px;
  border-radius: 10px;
  box-shadow: 0 0 12px var(--accent, #818cf8);
}

/* Ocultar/Mostrar Pasos */
.survey-step {
  display: none;
  flex-direction: column;
  align-items: center;
}

.survey-step.active {
  display: flex;
  animation: fadeInStep 0.4s ease forwards;
}

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

.survey-step h2 {
  font-size: 22px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* Pregunta 1: Input Nombre */
#survey-name {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 18px;
  color: #fff;
  font-size: 16px;
  outline: none;
  text-align: center;
  margin-bottom: 24px;
  font-family: inherit;
  transition: all 0.3s ease;
}

#survey-name:focus {
  border-color: var(--accent, #818cf8);
  box-shadow: 0 0 20px rgba(129, 140, 248, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

/* Pregunta 2: Paleta de Colores */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  width: 100%;
  padding: 0 10px;
}

.color-swatch {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  margin: 0 auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 3px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  transform: scale(1.22);
  border-color: #ffffff;
  box-shadow: 0 0 20px currentColor;
}

/* Pregunta 3: Chips de Interés */
.interest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.chip.selected {
  background: rgba(129, 140, 248, 0.25);
  border-color: var(--accent, #818cf8);
  color: #fff;
  box-shadow: 0 0 14px rgba(129, 140, 248, 0.35);
  font-weight: 500;
}

/* Botón Continuar / Finalizar */
.survey-next {
  background: #f8fafc;
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.survey-next:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
}
