/* ══════════════════════════════════════════════════════════════════════════
   ventura-signature.css — Efectos "marca de la casa" para home.php / slot.php
   ───────────────────────────────────────────────────────────────────────────
   Dos piezas:
   A) AURORA — hero vivo: malla de gradiente que deriva lento + reacciona al
      cursor. Reemplaza la foto Unsplash genérica. Marca de toda la app.
   B) INVEST DIAL — control interactivo en slot.php: arrastra y ve tu
      probabilidad crecer con física de muelle. La mecánica del juego, tangible.

   Depende de tokens.css. Respeta prefers-reduced-motion.
   ══════════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════
   A · AURORA — hero vivo
   Estructura HTML mínima:
     <div class="vfx-aurora">
       <span class="vfx-aurora-blob b1"></span>
       <span class="vfx-aurora-blob b2"></span>
       <span class="vfx-aurora-blob b3"></span>
       <div class="vfx-aurora-grain"></div>
       ... tu contenido hero ...
     </div>
   ════════════════════════════════════════════════════════════════════ */
.vfx-aurora {
  position: relative;
  overflow: hidden;
  background: var(--slate-900, var(--slate-900));
  isolation: isolate;
}

/* Blobs de color que derivan — cada uno con su órbita */
.vfx-aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.vfx-aurora-blob.b1 {
  width: 460px; height: 460px;
  background: radial-gradient(circle, var(--brand-blue), transparent 70%);
  top: -160px; left: -80px;
  animation: vfx-drift-1 18s ease-in-out infinite;
}
.vfx-aurora-blob.b2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--success-bright), transparent 70%);
  bottom: -140px; right: 10%;
  opacity: 0.38;
  animation: vfx-drift-2 22s ease-in-out infinite;
}
.vfx-aurora-blob.b3 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--brand-violet), transparent 70%);
  top: 20%; right: -120px;
  opacity: 0.42;
  animation: vfx-drift-3 26s ease-in-out infinite;
}

@keyframes vfx-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(60px, 40px) scale(1.12); }
  66%      { transform: translate(30px, 80px) scale(0.95); }
}
@keyframes vfx-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-70px, -50px) scale(1.15); }
}
@keyframes vfx-drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(-50px, 60px) scale(0.9); }
  75%      { transform: translate(-30px, -40px) scale(1.1); }
}

/* Capa de grano sutil — da textura premium, evita el banding del blur */
.vfx-aurora-grain {
  position: absolute; inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
  background-size: 3px 3px;
}

/* Reacción al cursor — JS mueve --mx / --my (0..1). Una capa extra de luz
   sigue al puntero, como un foco suave. */
.vfx-aurora-glow {
  position: absolute; inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    340px circle at calc(var(--mx, 0.5) * 100%) calc(var(--my, 0.3) * 100%),
    rgba(125, 211, 252, 0.12),
    transparent 60%
  );
  transition: background 0.18s ease;
}

/* El contenido del hero va por encima de todo */
.vfx-aurora > *:not(.vfx-aurora-blob):not(.vfx-aurora-grain):not(.vfx-aurora-glow) {
  position: relative;
  z-index: 2;
}

/* ── Aurora reutilizable (drop-in) ──────────────────────────────────────
   Convierte cualquier contenedor (hero, panel) en anfitrión de la aurora
   SIN tocar su fondo: la capa es transparente y solo aloja los blobs.
   Uso:  <div class="mi-hero vfx-aurora-host">
           <div class="vfx-aurora-layer" aria-hidden="true">
             <span class="vfx-aurora-blob b1"></span> … grain … glow
           </div>
           … contenido del hero …
         </div>
   El JS (SIG.initAurora) engancha el seguimiento de cursor automáticamente. */
.vfx-aurora-host { position: relative; isolation: isolate; }
.vfx-aurora-host > *:not(.vfx-aurora-layer) { position: relative; z-index: 1; }
.vfx-aurora-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;          /* recorta los blobs al rectángulo del hero */
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;    /* respeta esquinas redondeadas del hero */
}
/* Dentro de la capa los blobs se posicionan respecto a ella (= al hero) */
.vfx-aurora-layer .vfx-aurora-blob,
.vfx-aurora-layer .vfx-aurora-grain,
.vfx-aurora-layer .vfx-aurora-glow { z-index: 0; }

/* ════════════════════════════════════════════════════════════════════
   B · INVEST DIAL — control de inversión interactivo
   ════════════════════════════════════════════════════════════════════ */
.vfx-dial {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--slate-200, var(--slate-200));
  border-radius: 22px;
  padding: 26px 28px;
  box-shadow: var(--ring-premium, 0 4px 24px rgba(99,102,241,.10));
}
@media (max-width: 640px) { .vfx-dial { grid-template-columns: 1fr; gap: 18px; } }

/* El arco de probabilidad (SVG) */
.vfx-dial-gauge { position: relative; width: 220px; height: 220px; margin: 0 auto; }
.vfx-dial-gauge svg { transform: rotate(-90deg); display: block; }
.vfx-dial-arc-bg { stroke: var(--slate-100, var(--slate-100)); }
.vfx-dial-arc-fill {
  stroke: url(#vfx-dial-grad);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vfx-dial-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.vfx-dial-pct {
  font-size: 2.6rem; font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--fg-1, var(--slate-900));
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.vfx-dial-pct .u { font-size: 0.42em; color: var(--fg-4, var(--slate-400)); }
.vfx-dial-pct-label {
  font-size: 0.62rem; font-weight: 850;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-3, var(--slate-500));
  margin-top: 4px;
}
.vfx-dial-delta {
  margin-top: 6px;
  font-size: 0.74rem; font-weight: 800;
  color: var(--success, var(--success));
  opacity: 0;
  transition: opacity 0.3s;
}
.vfx-dial-delta.show { opacity: 1; }

/* Controles a la derecha */
.vfx-dial-controls { min-width: 0; }
.vfx-dial-title { font-size: 1.05rem; font-weight: 850; margin-bottom: 4px; }
.vfx-dial-sub { font-size: 0.82rem; color: var(--fg-3, var(--slate-500)); margin-bottom: 18px; line-height: 1.5; }

/* Slider custom */
.vfx-dial-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px;
  border-radius: 999px;
  background: var(--slate-200, var(--slate-200));
  outline: none;
  margin: 12px 0;
}
.vfx-dial-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-blue, var(--brand-blue));
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.4);
  cursor: grab;
  transition: transform 0.1s;
}
.vfx-dial-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
.vfx-dial-slider::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-blue, var(--brand-blue));
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.4);
  cursor: grab;
}

.vfx-dial-amount {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 4px;
}
.vfx-dial-amount .val {
  font-size: 1.8rem; font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--brand-blue, var(--brand-blue));
  font-variant-numeric: tabular-nums;
}
.vfx-dial-amount .ccy { font-size: 0.8rem; color: var(--fg-3); font-weight: 700; }

.vfx-dial-quick { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.vfx-dial-quick button {
  border: 1px solid var(--slate-200, var(--slate-200));
  background: var(--slate-50, var(--slate-50));
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 0.8rem; font-weight: 800;
  color: var(--fg-2, var(--slate-600));
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}
.vfx-dial-quick button:hover { background: var(--slate-100); }
.vfx-dial-quick button.active {
  background: var(--brand-blue, var(--brand-blue)); color: #fff; border-color: var(--brand-blue, var(--brand-blue));
}

.vfx-dial-rows { margin-top: 16px; display: grid; gap: 8px; }
.vfx-dial-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.84rem;
  padding: 8px 12px;
  background: var(--slate-50, var(--slate-50));
  border-radius: 10px;
}
.vfx-dial-row .k { color: var(--fg-3, var(--slate-500)); font-weight: 600; }
.vfx-dial-row .v { font-weight: 900; color: var(--fg-1); font-variant-numeric: tabular-nums; }

/* Campo de cantidad personalizada — inline dentro de .vfx-dial-quick */
.vfx-dial-custom-input {
  flex: 1 1 70px;          /* crece para ocupar el espacio restante de la fila */
  min-width: 60px;
  max-width: 110px;
  padding: 6px 10px;       /* misma altura visual que los botones (6px arriba/abajo) */
  border: 1px solid var(--slate-200, var(--slate-200));
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fg-2, var(--slate-600));
  background: var(--slate-50, var(--slate-50));
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, background 0.12s;
  -moz-appearance: textfield;
}
.vfx-dial-custom-input::-webkit-inner-spin-button,
.vfx-dial-custom-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.vfx-dial-custom-input:focus {
  border-color: var(--brand-blue, var(--brand-blue));
  background: #fff;
}

/* Fila de ranking destacada (fila lateral — mantenida por si acaso) */
.vfx-dial-row--rank .v { color: var(--brand-blue, var(--brand-blue)); }

/* Ranking — dentro de .vfx-dial-center, justo bajo "Tu aumento" */
.vfx-dial-rank-below {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
  pointer-events: none;
}
.vfx-dial-rank-val {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--brand-blue, var(--brand-blue));
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.vfx-dial-rank-lbl {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-3, var(--slate-500));
  margin-top: 2px;
}

/* Resumen económico inline (reemplaza al antiguo .vfx-dial-balance) */
.vfx-dial-summary {
  margin-top: 12px;
  border: 1px solid var(--slate-200, var(--slate-200));
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.82rem;
}
.vfx-dial-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: var(--slate-50, var(--slate-50));
}
.vfx-dial-summary-row + .vfx-dial-summary-row {
  border-top: 1px solid var(--slate-200, var(--slate-200));
}
.vfx-dial-summary-row--total { background: var(--slate-100, var(--slate-100)); }
.vfx-dial-summary-lbl { color: var(--fg-3, var(--slate-500)); font-weight: 600; }
.vfx-dial-summary-val {
  font-weight: 800;
  color: var(--fg-1, var(--slate-900));
  font-variant-numeric: tabular-nums;
}
.vfx-dial-summary-val.text-success { color: var(--success) !important; }
.vfx-dial-summary-val.text-danger  { color: var(--danger) !important; }

/* Mantener compatibilidad con código que aún oculte .vfx-dial-balance */
.vfx-dial-balance { display: none !important; }

/* ── Pulse del valor central al cambiar ─────────────────────── */
@keyframes vfx-pct-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.09); }
  100% { transform: scale(1); }
}
.vfx-pct-pulse {
  animation: vfx-pct-pulse 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Badge de cambio de ranking ─────────────────────────────── */
@keyframes vfx-rank-badge-in {
  0%   { opacity: 0; transform: translateY(5px) scale(0.8); }
  50%  { opacity: 1; transform: translateY(-2px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes vfx-rank-badge-out {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}
.dial-rank-delta {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
  opacity: 0;
  pointer-events: none;
  vertical-align: middle;
}
.dial-rank-delta--up {
  color: var(--success);
  background: rgba(22,163,74,.14);
  animation: vfx-rank-badge-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.dial-rank-delta--fade {
  animation: vfx-rank-badge-out 0.3s ease-in forwards;
}

@media (prefers-reduced-motion: reduce) {
  .vfx-aurora-blob { animation: none !important; }
  .vfx-dial-arc-fill { transition: none !important; }
  .vfx-pct-pulse, .dial-rank-delta--up, .dial-rank-delta--fade { animation: none !important; }
  body { animation: none !important; }
}

/* ── Móvil: aurora premium y fluida ─────────────────────────────────────
   Mantenemos la deriva animada (aspecto premium) pero con blur + tamaño
   algo menores: reduce el coste de re-rasterizar el desenfoque cada frame,
   así la animación va suave (sin jank) en GPUs móviles. */
@media (max-width: 768px) {
  .vfx-aurora-blob { filter: blur(52px); }
  .vfx-aurora-blob.b1 { width: 320px; height: 320px; }
  .vfx-aurora-blob.b2 { width: 280px; height: 280px; }
  .vfx-aurora-blob.b3 { width: 300px; height: 300px; }
  .vfx-aurora-grain { opacity: 0.4; }
}

/* ════════════════════════════════════════════════════════════════════
   C · PAGE TRANSITIONS — fade-in suave en cada carga de página
   Elimina el parpadeo brusco de "página HTML antigua".
   220ms ease-out + desplazamiento vertical mínimo (6px).
   ════════════════════════════════════════════════════════════════════ */
@keyframes vfx-page-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    /* 'none' (no translateY(0)): así el estado final NO deja un transform
       persistente en <body> que crearía bloque contenedor y rompería
       position:fixed (bottom-nav, bottom-sheets…). La entrada se ve igual. */
    transform: none;
  }
}

body {
  animation: vfx-page-enter 0.22s ease-out both;
  /* "both" → mantiene el estado final; no vuelve a opacity:0 al salir */
}
/* Tras la entrada (page-ready se añade ~300ms tras cargar, la anim dura 0.22s)
   retiramos la animación: su transform "filled" deja una MATRIZ identidad en
   <body> que crea bloque contenedor y rompe position:fixed (bottom-nav,
   bottom-sheets, CTA fija…). Sin animación → transform:none → fixed correcto. */
body.page-ready { animation: none !important; }

/* ════════════════════════════════════════════════════════════════════
   PWA — chips no invasivos (instalar / activar avisos)
   ════════════════════════════════════════════════════════════════════ */
#vpwa-install, #vpwa-push {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 99990;
  max-width: 440px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--slate-900); color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  padding: 12px 14px; box-shadow: 0 12px 40px rgba(2,6,23,.5);
  transform: translateY(140%); opacity: 0;
  transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .35s;
}
#vpwa-install.show, #vpwa-push.show { transform: translateY(0); opacity: 1; }
#vpwa-install img { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.vpwa-tx { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.vpwa-tx strong { font-size: .9rem; font-weight: 800; }
.vpwa-tx span { font-size: .76rem; color: var(--slate-400); }
#vpwa-install .vpwa-ok, #vpwa-push .vpwa-ok {
  background: linear-gradient(135deg,var(--brand-indigo),var(--brand-violet)); color: #fff; border: 0;
  border-radius: 10px; padding: 9px 16px; font-size: .82rem; font-weight: 800; cursor: pointer; white-space: nowrap;
}
#vpwa-install .vpwa-x, #vpwa-push .vpwa-x {
  background: none; border: 0; color: var(--slate-500); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 4px;
}
@media (prefers-reduced-motion: reduce) {
  #vpwa-install, #vpwa-push { transition: none; }
}
