/* ─────────────────────────────────────────────────────────────
   Mi VIRAL — Design tokens
   ───────────────────────────────────────────────────────────── */

:root {
  /* ── Palette ─────────────────────────────── */
  --navy-900:        #0A0C28;   /* fondo principal */
  --navy-700:        #1A1D52;   /* cards / superficies elevadas */
  --navy-500:        #2A2F6E;   /* hover states / overlays */
  --cream:           #F5F5F0;   /* áreas claras */
  --cream-dim:       #E8E8E0;
  --orange:          #FC5A00;   /* CTA, progreso activo */
  --orange-soft:     rgba(252, 90, 0, 0.14);
  --lime:            #D8FF4B;   /* éxito, completado */
  --lime-soft:       rgba(216, 255, 75, 0.16);
  --red:             #DC2626;   /* error, atención */
  --red-soft:        rgba(220, 38, 38, 0.16);
  --ink:             #12152E;   /* texto sobre cream */

  /* ── Text on dark ────────────────────────── */
  --text-1:          #FFFFFF;
  --text-2:          rgba(255, 255, 255, 0.72);
  --text-3:          rgba(255, 255, 255, 0.50);
  --text-4:          rgba(255, 255, 255, 0.32);

  /* ── Hairlines ───────────────────────────── */
  --line:            rgba(255, 255, 255, 0.06);
  --line-strong:     rgba(255, 255, 255, 0.12);

  /* ── Radius ──────────────────────────────── */
  --r-sm:            10px;
  --r-md:            16px;
  --r-lg:            20px;
  --r-xl:            24px;
  --r-pill:          999px;

  /* ── Shadow (very subtle) ────────────────── */
  --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-md:       0 8px 32px rgba(0, 0, 0, 0.28);
  --shadow-card:     0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 12px 32px rgba(0, 0, 0, 0.22);

  /* ── Motion (semantic durations) ─────────── */
  --d-quick:         120ms;        /* hover, focus, taps */
  --d-base:          180ms;        /* card transitions */
  --d-slow:          280ms;        /* modal entry, drawer */
  --ease-out:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:     cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Surface gradients ── */
  --surface-card:    linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.015) 100%), var(--navy-700);
  --surface-elev:    linear-gradient(180deg, rgba(255, 255, 255, 0.065) 0%, rgba(255, 255, 255, 0.022) 100%), var(--navy-700);
  --surface-hover:   linear-gradient(180deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.030) 100%), var(--navy-700);
}

/* ── Reset / base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.viral-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  background: var(--navy-900);
  color: var(--text-1);
  width: 100%;
  height: 100%;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

/* Titulares premium — letter-spacing negativo + features tipográficas. */
.viral-app h1, .viral-app h2, .viral-app h3,
.viral-title {
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'tnum', 'kern';
  letter-spacing: -0.025em;
  text-rendering: optimizeLegibility;
}

.viral-app .num,
.viral-app .tabular { font-variant-numeric: tabular-nums; }

/* hide native scrollbars inside the app — iOS feel.
   ::-webkit-scrollbar con width:0 (NO display:none) preserva el comportamiento de scroll
   sin que el scrollbar ocupe ancho, evitando que el contenido "recorra" a la derecha. */
.viral-app *::-webkit-scrollbar { width: 0; height: 0; background: transparent; }
.viral-app * { scrollbar-width: none; -ms-overflow-style: none; }

/* ── Microinteractions ────────────────────── */
@keyframes viral-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(252, 90, 0, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(252, 90, 0, 0); }
}

@keyframes viral-pulse-lime {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 255, 75, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(216, 255, 75, 0); }
}

@keyframes viral-fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes viral-shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

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

@keyframes viral-swap-flow {
  from { transform: translateX(-100%); }
  to   { transform: translateX(350%); }
}

@keyframes viral-confetti-fall {
  0%   { transform: translate3d(0, -20px, 0) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.9; }
  100% { transform: translate3d(var(--drift, 0px), 110vh, 0) rotate(720deg); opacity: 0.9; }
}

@keyframes viral-splash-breathe {
  0%, 100% { transform: scale(1);    opacity: 0.98; }
  50%      { transform: scale(1.04); opacity: 1; }
}

/* ── Helpers ──────────────────────────────── */
.viral-card {
  position: relative;
  background: var(--surface-card);
  border-radius: var(--r-xl);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 20px 48px -16px rgba(0, 0, 0, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.18);
}
/* Highlight delgado en la parte alta — efecto "vidrio con reflejo" tipo iOS. */
.viral-card::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  pointer-events: none;
}

/* Variante tappable — añadir a un .viral-card que sea clickable.
   Hover sube ligeramente la luminosidad sin animar la card entera (no JS). */
.viral-card-tap {
  transition: background var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out),
              transform var(--d-quick) var(--ease-out);
  cursor: pointer;
}
.viral-card-tap:hover {
  background: var(--surface-hover);
  box-shadow:
    inset 0 0 0 1px var(--line-strong),
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 14px 36px rgba(0, 0, 0, 0.28);
}
.viral-card-tap:active { transform: translateY(1px); }

/* Interactive primitives — añadidos via className en components.jsx para
   no tocar la lógica JSX. Usan inline styles para variantes (colores) y
   estas clases para los estados de interacción (hover, active, focus). */
.viral-btn {
  transition:
    filter var(--d-quick) var(--ease-out),
    transform var(--d-quick) var(--ease-out),
    box-shadow var(--d-quick) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.viral-btn:hover { filter: brightness(1.08); }
.viral-btn:active { transform: translateY(1px) scale(0.985); }
.viral-btn:focus-visible {
  outline: 2px solid rgba(252, 90, 0, 0.55);
  outline-offset: 2px;
}

.viral-action-card {
  transition:
    filter var(--d-quick) var(--ease-out),
    transform var(--d-quick) var(--ease-out),
    box-shadow var(--d-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.viral-action-card:hover {
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 1px var(--line-strong),
    0 8px 24px rgba(0, 0, 0, 0.18);
}
.viral-action-card:active { transform: scale(0.99) translateY(1px); }
.viral-action-card:focus-visible {
  outline: 2px solid rgba(252, 90, 0, 0.55);
  outline-offset: 2px;
}

/* Skeleton — para usar mientras carga data (en vez del "Cargando…" plano).
   Se aplica como className. Estilizable via --skeleton-h y --skeleton-w. */
.viral-skeleton {
  display: block;
  width: var(--skeleton-w, 100%);
  height: var(--skeleton-h, 14px);
  border-radius: 8px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.10) 50%,
      rgba(255, 255, 255, 0.04) 100%
    );
  background-size: 200% 100%;
  animation: viral-shimmer 1.4s ease-in-out infinite;
}
.viral-skeleton + .viral-skeleton { margin-top: 8px; }

.viral-screen-bg {
  position: relative;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(252, 90, 0, 0.12), transparent 55%),
    radial-gradient(110% 55% at 100% 5%, rgba(216, 255, 75, 0.08), transparent 60%),
    radial-gradient(90% 50% at 50% 100%, rgba(124, 140, 255, 0.06), transparent 60%),
    linear-gradient(180deg, #0B0E2E 0%, #0A0C28 35%, #07091F 100%);
}
/* Glow flotante sutil — agrega "vida" al background sin distraer.
   Se renderiza con un pseudo-elemento para no ensuciar el DOM. */
.viral-screen-bg::before {
  content: '';
  position: absolute;
  top: -10%; left: -10%;
  width: 60%; height: 50%;
  background: radial-gradient(closest-side, rgba(252, 90, 0, 0.18), transparent 70%);
  filter: blur(36px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
  animation: viral-glow-drift 18s ease-in-out infinite alternate;
}
.viral-screen-bg::after {
  content: '';
  position: absolute;
  bottom: -10%; right: -10%;
  width: 55%; height: 45%;
  background: radial-gradient(closest-side, rgba(216, 255, 75, 0.12), transparent 70%);
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  animation: viral-glow-drift 22s ease-in-out -8s infinite alternate-reverse;
}
.viral-screen-bg > * { position: relative; z-index: 1; }

@keyframes viral-glow-drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8%, 6%) scale(1.08); }
}

/* ── Micro-interactions globales ──────────────────────────── */

/* Touch feedback universal — añadir className="viral-tap" a cualquier
   elemento tappable que no use Button o ActionCard. */
.viral-tap {
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--d-quick) var(--ease-out);
  cursor: pointer;
}
.viral-tap:active { transform: scale(0.97); }

/* Entry animation con stagger — aplicar a un contenedor padre con la
   regla y los hijos heredan animación con delay incremental. */
.viral-entry > * {
  animation: viral-fade-in-up var(--d-slow) var(--ease-out) backwards;
}
.viral-entry > *:nth-child(1) { animation-delay: 40ms; }
.viral-entry > *:nth-child(2) { animation-delay: 100ms; }
.viral-entry > *:nth-child(3) { animation-delay: 160ms; }
.viral-entry > *:nth-child(4) { animation-delay: 220ms; }
.viral-entry > *:nth-child(5) { animation-delay: 280ms; }
.viral-entry > *:nth-child(6) { animation-delay: 340ms; }
.viral-entry > *:nth-child(7) { animation-delay: 400ms; }
.viral-entry > *:nth-child(8) { animation-delay: 460ms; }

/* Status badge dot con pulse ring — para indicadores de actividad
   en chips (línea activa, plan vigente, etc). */
.viral-dot-pulse {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--lime);
  flex-shrink: 0;
}
.viral-dot-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: inherit;
  opacity: 0.5;
  animation: viral-pulse-ring 2.2s ease-out infinite;
  pointer-events: none;
}
.viral-dot-pulse.orange { background: var(--orange); }
.viral-dot-pulse.red    { background: var(--red); }

@keyframes viral-pulse-ring {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0;    }
}

/* Respeto a usuarios con prefers-reduced-motion: cero animación. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .viral-screen-bg::before,
  .viral-screen-bg::after { animation: none !important; }
}
