/* ============================================================
   VOKLY — main.css
   Variables globales, reset, layout y vistas principales
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* --- Variables de diseño --- */
:root {
  /* Brand colors */
  --color-yellow:        #FFD400;
  --color-yellow-dim:    rgba(255, 212, 0, 0.12);
  --color-yellow-glow:   rgba(255, 212, 0, 0.25);
  --color-purple:        #7B2FFF;
  --color-purple-dim:    rgba(123, 47, 255, 0.15);
  --color-purple-glow:   rgba(123, 47, 255, 0.3);

  /* Aliases semánticos */
  --color-primary:       var(--color-yellow);
  --color-secondary:     var(--color-purple);
  --color-success:       #22C55E;
  --color-error:         #EF4444;
  --color-warning:       #F59E0B;
  --color-xp:            var(--color-yellow);

  /* Fondos */
  --bg-base:             #090A10;
  --bg-primary:          #090A10;
  --bg-surface:          #0F1120;
  --bg-card:             #13162A;
  --bg-card-hover:       #1A1F38;
  --bg-border:           #1E2340;

  /* Texto */
  --text-primary:        #F1F5F9;
  --text-secondary:      #8892B0;
  --text-muted:          #4A5568;

  /* Tipografía */
  --font-display:        'Space Grotesk', system-ui, sans-serif;
  --font-main:           'Inter', system-ui, sans-serif;
  --font-mono:           'JetBrains Mono', 'Fira Code', monospace;

  /* Espaciados */
  --spacing-xs:          4px;
  --spacing-sm:          8px;
  --spacing-md:          16px;
  --spacing-lg:          24px;
  --spacing-xl:          32px;
  --spacing-2xl:         48px;

  /* Border radius */
  --radius-sm:           6px;
  --radius-md:           12px;
  --radius-lg:           20px;
  --radius-xl:           28px;
  --radius-full:         9999px;

  /* Sombras */
  --shadow-card:         0 0 0 1px var(--bg-border);
  --shadow-yellow:       0 0 24px var(--color-yellow-glow);
  --shadow-purple:       0 0 24px var(--color-purple-glow);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.2;
}

/* --- Utilidades --- */
.hidden { display: none !important; }

/* ============================================================
   LANDING — index.html
   ============================================================ */

.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Glow de fondo decorativo */
.landing::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(123, 47, 255, 0.12) 0%, transparent 70%);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.landing::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 212, 0, 0.07) 0%, transparent 70%);
  bottom: -80px;
  right: -80px;
  pointer-events: none;
}

.landing__content {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  position: relative;
  z-index: 1;
}

.landing__logo-img {
  max-height: 48px;
  width: auto;
  display: block;
}

.landing__title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  color: var(--color-yellow);
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: var(--shadow-yellow);
}

.landing__tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 360px;
}

.landing__hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: var(--spacing-sm);
}

/* ============================================================
   AUTH FORMS — index.html
   ============================================================ */

.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-lg);
}

.auth-form__card {
  background-color: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.auth-form__card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-form__switch {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-form__switch a {
  color: var(--color-yellow);
  text-decoration: none;
  font-weight: 600;
}

/* Formularios */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  padding: var(--spacing-sm) var(--spacing-md);
  transition: border-color 0.2s;
  width: 100%;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-yellow);
  box-shadow: 0 0 0 3px var(--color-yellow-dim);
}

.form-error {
  color: var(--color-error);
  font-size: 0.875rem;
}

/* ============================================================
   APP HEADER — app.html
   ============================================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: var(--spacing-sm);
}

.app-header__logo {
  max-height: 40px;
  width: auto;
  display: block;
}

.app-header a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.app-header__stats {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.stat {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.stat--streak { color: #FF6B35; }
.stat--xp     { color: var(--color-yellow); }
.stat--lives  { color: #FF4D6D; }

/* ============================================================
   VISTAS — estructura base
   ============================================================ */

.view {
  padding: var(--spacing-md);
  max-width: 680px;
  margin: 0 auto;
}

/* ============================================================
   DASHBOARD — app.html
   ============================================================ */

.dashboard {
  padding-top: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.dashboard__welcome {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.dashboard__welcome h2 {
  font-size: 1.75rem;
  font-weight: 700;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background-color: var(--color-yellow-dim);
  border: 1px solid var(--color-yellow-glow);
  color: var(--color-yellow);
  border-radius: var(--radius-full);
  padding: 2px var(--spacing-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  width: fit-content;
  font-family: var(--font-display);
}

.dashboard__section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.dashboard__modules {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

@media (min-width: 500px) {
  .dashboard__modules {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   ONBOARDING — selección de perfil
   ============================================================ */

.onboarding {
  padding: var(--spacing-lg) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  text-align: center;
}

.onboarding__logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-yellow);
}

.onboarding__title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
}

.onboarding__subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 320px;
  line-height: 1.6;
}

.profiles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  width: 100%;
  max-width: 560px;
}

@media (min-width: 480px) {
  .profiles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tarjeta de perfil */
.profile-card {
  background-color: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-sm);
  text-align: left;
}

.profile-card:hover {
  border-color: var(--color-yellow);
  background-color: var(--bg-card-hover);
  box-shadow: var(--shadow-yellow);
  transform: translateY(-2px);
}

.profile-card:active {
  transform: translateY(0);
}

.profile-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--color-yellow-dim);
  border-radius: var(--radius-md);
  color: var(--color-yellow);
}

.profile-card__icon svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 1.75;
}

.profile-card__name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-card__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================
   POPUP DE XP
   ============================================================ */

.xp-popup {
  position: fixed;
  bottom: var(--spacing-xl);
  right: var(--spacing-xl);
  background-color: var(--color-yellow);
  color: #000;
  font-family: var(--font-display);
  font-weight: 800;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-full);
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow-yellow);
}

.xp-popup.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  top: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background-color: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-border);
  border-top-color: var(--color-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--spacing-xl) auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE — breakpoint principal 390px (iPhone 14)
   ============================================================ */

/* mobile base: <= 390px */
@media (max-width: 390px) {
  .view {
    padding: var(--spacing-sm);
  }

  .app-header {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .app-header__logo {
    max-height: 32px;
  }

  .app-header__stats {
    gap: var(--spacing-sm);
  }

  .stat {
    font-size: 0.8rem;
  }

  .profile-card {
    padding: var(--spacing-md);
  }

  .dashboard__welcome h2 {
    font-size: 1.4rem;
  }

  .xp-popup {
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    font-size: 1rem;
  }
}

/* > 390px: profile-cards y módulos en columna única */
/* > 480px: 2 columnas (ver .profiles-grid y .dashboard__modules) */
