/* ══════════════════════════════════════════════════════════════
   NEXUS — Advanced Animations & Micro-Interactions v4.0
   Staggered reveals · Particle effects · Skeleton loading
   Number counters · Haptic-feel transitions · Premium polish
   ══════════════════════════════════════════════════════════════ */

/* ── Staggered Entrance Animations ──────────────────────────── */
.animate-in {
    opacity: 0;
    transform: translateY(12px);
    animation: staggerIn 0.5s var(--ease-out) forwards;
}

.animate-in:nth-child(1) {
    animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
    animation-delay: 0.1s;
}

.animate-in:nth-child(3) {
    animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
    animation-delay: 0.2s;
}

.animate-in:nth-child(5) {
    animation-delay: 0.25s;
}

.animate-in:nth-child(6) {
    animation-delay: 0.3s;
}

.animate-in:nth-child(7) {
    animation-delay: 0.35s;
}

.animate-in:nth-child(8) {
    animation-delay: 0.4s;
}

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale-in for modals / popups */
.animate-scale-in {
    animation: scaleIn 0.35s var(--ease-spring) forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Skeleton Loading (premium shimmer) ─────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
            var(--surface) 25%,
            rgba(139, 92, 246, 0.06) 50%,
            var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease infinite;
    border-radius: var(--radius-xs);
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 80px;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Number Counter Animation ───────────────────────────────── */
.counter-animate {
    display: inline-block;
    transition: transform 0.2s var(--ease-spring);
}

.counter-animate.bump {
    transform: scale(1.15);
}

/* ── Pulse Glow (live indicator / active states) ────────────── */
.pulse-glow {
    position: relative;
}

.pulse-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: inherit;
    opacity: 0;
    animation: pulseGlow 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulseGlow {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0.15;
    }
}

/* Live dot — small pulsing circle */
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.8);
    }
}

/* ── Ripple Effect (tap feedback) ───────────────────────────── */
.ripple-container {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── Float / Levitate ───────────────────────────────────────── */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* ── Gradient Text Animation ────────────────────────────────── */
.gradient-text-animate {
    background: linear-gradient(90deg, var(--accent), var(--primary), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* ── Win Celebration (confetti-like particles in CSS) ────────── */
.win-celebration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.win-celebration .particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: particleFall 1.5s ease-in forwards;
    opacity: 0.9;
}

.win-celebration .particle:nth-child(odd) {
    border-radius: 2px;
    width: 4px;
    height: 8px;
}

.win-celebration .particle:nth-child(1) {
    left: 10%;
    background: var(--accent);
    animation-delay: 0s;
}

.win-celebration .particle:nth-child(2) {
    left: 20%;
    background: var(--primary);
    animation-delay: 0.1s;
}

.win-celebration .particle:nth-child(3) {
    left: 30%;
    background: var(--gold);
    animation-delay: 0.05s;
}

.win-celebration .particle:nth-child(4) {
    left: 40%;
    background: var(--success);
    animation-delay: 0.15s;
}

.win-celebration .particle:nth-child(5) {
    left: 50%;
    background: var(--accent);
    animation-delay: 0.08s;
}

.win-celebration .particle:nth-child(6) {
    left: 60%;
    background: var(--primary);
    animation-delay: 0.2s;
}

.win-celebration .particle:nth-child(7) {
    left: 70%;
    background: var(--gold);
    animation-delay: 0.12s;
}

.win-celebration .particle:nth-child(8) {
    left: 80%;
    background: var(--success);
    animation-delay: 0.18s;
}

.win-celebration .particle:nth-child(9) {
    left: 90%;
    background: var(--accent);
    animation-delay: 0.07s;
}

.win-celebration .particle:nth-child(10) {
    left: 15%;
    background: var(--primary);
    animation-delay: 0.22s;
}

.win-celebration .particle:nth-child(11) {
    left: 45%;
    background: var(--gold);
    animation-delay: 0.03s;
}

.win-celebration .particle:nth-child(12) {
    left: 75%;
    background: var(--success);
    animation-delay: 0.14s;
}

@keyframes particleFall {
    0% {
        top: -5%;
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        top: 105%;
        transform: translateX(calc(var(--drift, 20px))) rotate(720deg);
        opacity: 0;
    }
}

/* ── Big Win Overlay ────────────────────────────────────────── */
.big-win-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(2, 2, 8, 0.85);
    backdrop-filter: blur(12px);
    animation: scaleIn 0.4s var(--ease-spring);
}

.big-win-amount {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    animation: bigWinPulse 0.8s ease-in-out infinite alternate;
}

.big-win-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes bigWinPulse {
    from {
        transform: scale(1);
        text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    }

    to {
        transform: scale(1.05);
        text-shadow: 0 0 60px rgba(255, 215, 0, 0.8);
    }
}

/* ── Slide transitions (page-level) ─────────────────────────── */
.slide-up-enter {
    animation: slideUpEnter 0.4s var(--ease-out) forwards;
}

@keyframes slideUpEnter {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-down-exit {
    animation: slideDownExit 0.3s var(--ease) forwards;
}

@keyframes slideDownExit {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* ── Orbit Ring (used around profile avatar, wheel center) ──── */
.orbit-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--primary);
    animation: orbit 3s linear infinite;
}

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

/* ── Card Flip (for HiLo / Blackjack reveals) ───────────────── */
.card-flip {
    perspective: 600px;
}

.card-flip-inner {
    transition: transform 0.5s var(--ease);
    transform-style: preserve-3d;
}

.card-flip.flipped .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    backface-visibility: hidden;
    position: absolute;
    inset: 0;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ── Breathing Glow (for active investments / staking) ──────── */
.breathing-glow {
    animation: breatheGlow 2.5s ease-in-out infinite;
}

@keyframes breatheGlow {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(0, 229, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 24px rgba(0, 229, 255, 0.25), 0 0 60px rgba(0, 229, 255, 0.08);
    }
}

/* ── Typewriter effect (for notification texts) ─────────────── */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent);
    animation: typewrite 2s steps(30) forwards, blinkCursor 0.7s step-end infinite;
}

@keyframes typewrite {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blinkCursor {

    0%,
    100% {
        border-color: var(--accent);
    }

    50% {
        border-color: transparent;
    }
}

/* ── Magnetic Hover (desktop only — subtle pull toward cursor) ── */
@media (hover:hover) {
    .magnetic:hover {
        transition: transform 0.2s var(--ease-out);
    }
}

/* ── Count-Up Number Style ──────────────────────────────────── */
.count-up {
    font-variant-numeric: tabular-nums;
    transition: all 0.3s var(--ease-spring);
}

/* ── Notification Badge (animated) ──────────────────────────── */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    border-radius: var(--radius-full);
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
    animation: notifPop 0.4s var(--ease-spring);
}

@keyframes notifPop {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* ── Marquee (for live feed ticker) ─────────────────────────── */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marqueeScroll 20s linear infinite;
}

@keyframes marqueeScroll {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(-100%);
    }
}

/* ── Glass morphism utility ─────────────────────────────────── */
.glass {
    background: rgba(12, 12, 36, 0.6);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--border);
}

/* ── Reduced motion override ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    .animate-in,
    .float,
    .gradient-text-animate,
    .typewriter,
    .orbit-ring,
    .breathing-glow,
    .marquee-content,
    .win-celebration .particle {
        animation: none !important;
    }

    .animate-in {
        opacity: 1;
        transform: none;
    }
}