/* ==========================================================================
   Onboarding de la tarjeta: "Tu tarjeta en 3 pasos" + aviso de navegador interno
   Animaciones vivas (rebote, monedas, confeti) con la identidad rekompra:
   amarillo solo en la acción y la recompensa, texto sobre amarillo en carbón.
   ========================================================================== */

.onb-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(35, 39, 43, 0.62);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: onb-fade 0.25s ease-out;
}
.onb-overlay[hidden] { display: none; }

.onb-sheet {
  position: relative; width: 100%; max-width: 440px; max-height: 94dvh; overflow-y: auto;
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--rk-white); color: var(--rk-ink);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.35);
  animation: onb-sheet-in 0.55s cubic-bezier(0.2, 1.35, 0.4, 1);
}
@media (min-width: 560px) {
  .onb-overlay { align-items: center; }
  .onb-sheet { border-radius: 22px; }
}

/* Progreso de 3 pasos con brillo que recorre la barra */
.onb-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.onb-progress { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.onb-progress span { position: relative; height: 7px; border-radius: 99px; background: var(--rk-gray-200); overflow: hidden; }
.onb-progress span.done { background: var(--rk-yellow); }
.onb-progress span.current { background: var(--rk-gray-300); }
.onb-progress span.current::after {
  content: ''; position: absolute; inset: 0; width: 45%;
  background: linear-gradient(90deg, transparent, var(--rk-yellow), transparent);
  animation: onb-shimmer 1.3s ease-in-out infinite;
}
.onb-close {
  width: 34px; height: 34px; border: none; border-radius: 50%; background: var(--rk-gray-100);
  color: var(--rk-gray-700); font-size: 1rem; cursor: pointer;
}
.onb-step-label { font-size: var(--rk-text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rk-gray-500); }

.onb-body { animation: onb-pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
.onb-title { font-family: var(--rk-font-display); font-size: 1.45rem; line-height: 1.2; margin: 6px 0 8px; }
.onb-text { color: var(--rk-gray-700); font-size: 0.95rem; line-height: 1.45; margin: 0 0 14px; }

/* Botón principal: pulso y "wiggle" periódico para invitar al toque */
.onb-cta {
  width: 100%; border: none; border-radius: 14px; padding: 15px 18px; margin-top: 6px;
  background: var(--rk-yellow); color: var(--rk-ink);
  font-family: var(--rk-font-display); font-size: 1.05rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 210, 0, 0.45);
  animation: onb-pulse 1.8s ease-in-out infinite, onb-wiggle 4s ease-in-out 1.5s infinite;
}
.onb-cta:active { transform: scale(0.96); }
.onb-cta:disabled { opacity: 0.6; animation: none; }
.onb-secondary {
  display: block; width: 100%; margin-top: 10px; padding: 10px; border: none; background: none;
  color: var(--rk-gray-500); font-size: 0.9rem; font-weight: 600; cursor: pointer;
}

/* Paso 1: la tarjeta aparece con monedas cayendo */
.onb-card {
  position: relative; margin: 8px 0 16px; padding: 18px; border-radius: 22px;
  background: var(--rk-ink); color: var(--rk-white); overflow: hidden;
  animation: onb-card-in 0.8s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.onb-card small { color: var(--rk-gray-300); font-size: var(--rk-text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.onb-card strong { display: block; font-family: var(--rk-font-display); font-size: 1.25rem; margin: 4px 0 12px; }
.onb-stamps { display: flex; gap: 8px; }
.onb-stamps i {
  width: 30px; height: 30px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.35);
  animation: onb-stamp-in 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.onb-stamps i.gift { border-color: var(--rk-yellow); display: grid; place-items: center; font-style: normal; font-size: 0.9rem; }
.onb-card .onb-reward { margin-top: 12px; font-size: 0.85rem; color: var(--rk-gray-300); }
.onb-card .onb-reward b { color: var(--rk-yellow); }
.onb-coin {
  position: absolute; width: 26px; height: 26px; border-radius: 50%; top: -30px;
  background: radial-gradient(circle at 35% 35%, #FFE45C, var(--rk-yellow) 60%, #D9AE00);
  box-shadow: inset 0 0 0 2px rgba(217, 174, 0, 0.6);
  animation: onb-coin-drop 1.4s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

/* Paso 2 (iPhone): mini teléfono con el gesto Compartir → Agregar a inicio */
.onb-phone {
  position: relative; width: 190px; height: 250px; margin: 4px auto 14px; border-radius: 28px;
  background: var(--rk-gray-100); border: 6px solid var(--rk-ink); overflow: hidden;
}
.onb-phone .bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px; display: flex; align-items: center; justify-content: space-around;
  background: var(--rk-white); border-top: 1px solid var(--rk-border); font-size: 0.95rem;
}
.onb-phone .share { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; animation: onb-target 5s infinite; }
.onb-phone .sheet {
  position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 8px; border-radius: 14px; background: var(--rk-white);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.18); font-size: 0.72rem; transform: translateY(110%);
  animation: onb-share-sheet 5s infinite;
}
.onb-phone .sheet div { padding: 6px 8px; border-radius: 8px; color: var(--rk-gray-700); }
.onb-phone .sheet .add { font-weight: 700; color: var(--rk-ink); animation: onb-row-highlight 5s infinite; }
.onb-phone .home {
  position: absolute; inset: 0; padding: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-content: start;
  background: linear-gradient(160deg, #3A4045, var(--rk-ink)); opacity: 0; animation: onb-home 5s infinite;
}
.onb-phone .home i { width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, 0.14); }
.onb-phone .home .new {
  display: grid; place-items: center; background: var(--rk-ink); box-shadow: 0 0 0 2px var(--rk-yellow);
  animation: onb-icon-pop 5s infinite;
}
.onb-phone .home .new::after { content: ''; width: 22px; height: 22px; border-radius: 50%; background: var(--rk-yellow); }
.onb-finger { position: absolute; font-size: 1.6rem; z-index: 3; animation: onb-finger 5s infinite; }

.onb-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.onb-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; line-height: 1.35; animation: onb-slide-in 0.5s both; }
.onb-steps li:nth-child(2) { animation-delay: 0.12s; }
.onb-steps li:nth-child(3) { animation-delay: 0.24s; }
.onb-steps b.n {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--rk-ink); color: var(--rk-white); font-size: 0.78rem;
}

/* Paso 3: campana que suena y un aviso de ejemplo que baja */
.onb-bell-stage { position: relative; height: 190px; margin: 4px 0 12px; display: grid; place-items: end center; }
.onb-bell { position: relative; z-index: 1; margin-bottom: 14px; font-size: 3.6rem; transform-origin: 50% 8%; animation: onb-ring 2.2s ease-in-out infinite; }
.onb-bell-stage .wave {
  position: absolute; bottom: 8px; left: calc(50% - 45px); width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--rk-yellow);
  animation: onb-wave 2.2s ease-out infinite;
}
.onb-bell-stage .wave:nth-child(2) { animation-delay: 0.5s; }
.onb-notif {
  position: absolute; top: 0; left: 50%; width: 92%; max-width: 330px; padding: 10px 12px;
  border-radius: 16px; background: rgba(255, 255, 255, 0.96); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  display: flex; gap: 10px; align-items: center; text-align: left;
  animation: onb-notif-drop 4.4s cubic-bezier(0.2, 1.3, 0.4, 1) infinite;
}
.onb-notif .ic { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; background: var(--rk-ink); display: grid; place-items: center; }
.onb-notif .ic::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--rk-yellow); }
.onb-notif strong { display: block; font-size: 0.8rem; }
.onb-notif span { font-size: 0.76rem; color: var(--rk-gray-700); }
.onb-perks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.onb-perks li { animation: onb-slide-in 0.45s both; }
.onb-perks li:nth-child(2) { animation-delay: 0.1s; }
.onb-perks li:nth-child(3) { animation-delay: 0.2s; }
.onb-fine { font-size: 0.78rem; color: var(--rk-gray-500); margin: 4px 0 0; text-align: center; }

/* Éxito final */
.onb-trophy { font-size: 4rem; text-align: center; animation: onb-jump 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) both; }

/* Aviso de navegador interno (WhatsApp, Instagram…) */
.onb-arrow { position: fixed; top: 10px; right: 18px; font-size: 2.2rem; z-index: 9001; animation: onb-point 1s ease-in-out infinite; }
.onb-link-box {
  display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; padding: 10px 12px; border-radius: 14px;
  background: var(--rk-gray-100); font-size: 0.8rem; color: var(--rk-gray-700); word-break: break-all;
}

/* Botón para retomar el onboarding desde la tarjeta */
.onb-chip {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 9px 14px; border: none; border-radius: 99px;
  background: var(--rk-ink); color: var(--rk-white); font-weight: 700; font-size: 0.85rem; cursor: pointer;
  box-shadow: 0 6px 16px rgba(35, 39, 43, 0.25); animation: onb-pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1), onb-wiggle 5s ease-in-out 2s infinite;
}
.onb-chip b { background: var(--rk-yellow); color: var(--rk-ink); border-radius: 99px; padding: 1px 8px; font-size: 0.75rem; }

/* ---------- Animaciones ---------- */
@keyframes onb-fade { from { opacity: 0; } }
@keyframes onb-sheet-in { from { transform: translateY(100%); } }
@keyframes onb-pop-in { from { opacity: 0; transform: scale(0.9) translateY(10px); } }
@keyframes onb-slide-in { from { opacity: 0; transform: translateX(-14px); } }
@keyframes onb-shimmer { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes onb-pulse { 50% { box-shadow: 0 8px 30px rgba(255, 210, 0, 0.75); transform: scale(1.02); } }
@keyframes onb-wiggle { 0%, 88%, 100% { rotate: 0deg; } 91% { rotate: -2.5deg; } 94% { rotate: 2.5deg; } 97% { rotate: -1.5deg; } }
@keyframes onb-card-in { from { opacity: 0; transform: rotate(-6deg) scale(0.7) translateY(40px); } }
@keyframes onb-stamp-in { from { opacity: 0; transform: scale(0); } }
@keyframes onb-coin-drop {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  70% { transform: translateY(150px) rotate(300deg); }
  85% { transform: translateY(128px) rotate(340deg); }
  100% { transform: translateY(150px) rotate(360deg); opacity: 0; }
}
@keyframes onb-target { 0%, 12%, 30%, 100% { background: transparent; } 16%, 26% { background: var(--rk-yellow-soft); } }
@keyframes onb-share-sheet { 0%, 22% { transform: translateY(110%); } 30%, 58% { transform: translateY(0); } 64%, 100% { transform: translateY(110%); } }
@keyframes onb-row-highlight { 0%, 40% { background: transparent; } 46%, 58% { background: var(--rk-yellow); } 64%, 100% { background: transparent; } }
@keyframes onb-home { 0%, 60% { opacity: 0; } 66%, 94% { opacity: 1; } 100% { opacity: 0; } }
@keyframes onb-icon-pop { 0%, 66% { transform: scale(0); } 74% { transform: scale(1.25); } 80%, 100% { transform: scale(1); } }
@keyframes onb-finger {
  0% { left: 60%; top: 70%; opacity: 0; }
  8% { opacity: 1; }
  16% { left: 44%; top: 78%; transform: scale(1); }
  19% { transform: scale(0.8); }
  22% { transform: scale(1); }
  40% { left: 30%; top: 64%; }
  46% { transform: scale(0.8); }
  50% { transform: scale(1); opacity: 1; }
  58%, 100% { opacity: 0; }
}
@keyframes onb-ring { 0%, 50%, 100% { transform: rotate(0); } 8% { transform: rotate(18deg); } 16% { transform: rotate(-16deg); } 24% { transform: rotate(12deg); } 32% { transform: rotate(-8deg); } 40% { transform: rotate(4deg); } }
@keyframes onb-wave { from { transform: scale(0.6); opacity: 0.8; } to { transform: scale(1.8); opacity: 0; } }
@keyframes onb-notif-drop { 0% { transform: translate(-50%, -120%); opacity: 0; } 12%, 78% { transform: translate(-50%, 0); opacity: 1; } 90%, 100% { transform: translate(-50%, -120%); opacity: 0; } }
@keyframes onb-jump { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes onb-point { 50% { transform: translate(4px, -6px); } }

@media (prefers-reduced-motion: reduce) {
  .onb-overlay *, .onb-overlay, .onb-chip, .onb-arrow { animation: none !important; }
  .onb-phone .sheet { transform: none; }
  .onb-phone .home { opacity: 0; }
  .onb-coin, .onb-finger { display: none; }
}
