/* ============================================
   FamTubeX — Animations & Effects (Premium)
   ============================================ */

/* ============================================
   Gift Animations
   ============================================ */

.gift-animation-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}

/* Rose — floating petals */
.gift-anim-rose {
  animation: roseFloat 3s ease-out forwards;
}

@keyframes roseFloat {
  0% { opacity: 1; transform: translateY(100vh) scale(0.5) rotate(0deg); }
  50% { opacity: 1; transform: translateY(30vh) scale(1.2) rotate(180deg); }
  100% { opacity: 0; transform: translateY(-20vh) scale(0.3) rotate(360deg); }
}

/* Wine — rise and fade */
.gift-anim-wine {
  animation: wineRise 2.5s ease-out forwards;
}

@keyframes wineRise {
  0% { opacity: 0; transform: translateY(50vh) scale(0); }
  30% { opacity: 1; transform: translateY(20vh) scale(1.5); }
  70% { opacity: 1; transform: translateY(10vh) scale(1.2); }
  100% { opacity: 0; transform: translateY(-10vh) scale(0.5); }
}

/* Ring — spinning sparkle */
.gift-anim-ring {
  animation: ringSpin 3s ease-out forwards;
}

@keyframes ringSpin {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  20% { opacity: 1; transform: scale(2) rotate(180deg); }
  60% { opacity: 1; transform: scale(1.5) rotate(360deg); }
  100% { opacity: 0; transform: scale(0.5) rotate(720deg); }
}

/* Crown — golden descent */
.gift-anim-crown {
  animation: crownDescent 3s ease-out forwards;
}

@keyframes crownDescent {
  0% { opacity: 0; transform: translateY(-100px) scale(3); }
  30% { opacity: 1; transform: translateY(40vh) scale(1.5); }
  60% { opacity: 1; transform: translateY(45vh) scale(1.3); }
  100% { opacity: 0; transform: translateY(60vh) scale(0.5); }
}

/* Diamond — sparkle explosion */
.gift-anim-diamond {
  animation: diamondExplode 3s ease-out forwards;
}

@keyframes diamondExplode {
  0% { opacity: 0; transform: scale(0); }
  20% { opacity: 1; transform: scale(3); filter: brightness(2); }
  50% { opacity: 1; transform: scale(1.5); filter: brightness(1.5); }
  100% { opacity: 0; transform: scale(0.3); filter: brightness(0.5); }
}

/* Gift emoji particle */
.gift-particle {
  position: fixed;
  font-size: 3rem;
  pointer-events: none;
  z-index: 501;
}

/* ============================================
   Neon Glow Effects
   ============================================ */

.neon-glow {
  text-shadow: 0 0 10px rgba(255, 77, 141, 0.7), 0 0 40px rgba(255, 77, 141, 0.3);
}

.neon-glow-pink {
  text-shadow: 0 0 10px rgba(255, 77, 141, 0.7), 0 0 40px rgba(255, 77, 141, 0.3);
}

.neon-glow-purple {
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.7), 0 0 40px rgba(168, 85, 247, 0.3);
}

.neon-border {
  box-shadow: 0 0 15px rgba(255, 77, 141, 0.3), inset 0 0 15px rgba(255, 77, 141, 0.05);
}

.neon-border-red {
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.3), inset 0 0 15px rgba(255, 23, 68, 0.05);
}

/* ============================================
   Pulse / Heartbeat
   ============================================ */

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================
   Shimmer Loading
   ============================================ */

.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.04) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-card {
  aspect-ratio: 3/4;
  border-radius: var(--radius-lg, 22px);
}

/* ── Card shine on hover ── */
@keyframes cardShine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.profile-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  z-index: 2;
  pointer-events: none;
}

.profile-card:hover::after {
  animation: cardShine 0.8s ease-out;
}

/* ============================================
   Confetti / Sparkles (for gift sends)
   ============================================ */

.sparkle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 502;
  animation: sparkleFloat 1.5s ease-out forwards;
}

@keyframes sparkleFloat {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translateY(-100px) scale(0); }
}

/* ============================================
   Ripple Effect (buttons)
   ============================================ */

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.2) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
}

.ripple:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* ============================================
   Slide transitions
   ============================================ */

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Credits pop animation */
.credits-pop {
  animation: creditsPop 0.6s ease-out;
}

@keyframes creditsPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); color: var(--green); }
  100% { transform: scale(1); }
}

/* ============================================
   Floating Action
   ============================================ */

.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 61, 127, 0.4);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.fab:active { transform: scale(0.9); }
.fab:hover { box-shadow: 0 6px 30px rgba(255, 61, 127, 0.5); }

/* ============================================
   Onboarding Animations
   ============================================ */

@keyframes obSlideIn {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes obSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-60px); }
}

@keyframes obFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.ob-animate-in {
  animation: obFadeUp 0.5s ease-out;
}

/* ============================================
   Enhanced Page Transitions
   ============================================ */

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-fade-in {
  animation: pageFadeIn 0.4s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.scale-in {
  animation: scaleIn 0.3s ease-out;
}

/* ============================================
   Glow Pulse (for selected items)
   ============================================ */

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 61, 127, 0.3); }
  50% { box-shadow: 0 0 16px 4px rgba(255, 61, 127, 0.15); }
}

.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

/* ============================================
   Float (for decorative elements)
   ============================================ */

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.float {
  animation: float 3s ease-in-out infinite;
}

/* ============================================
   Enhanced Mobile Animations
   ============================================ */

/* Animated mesh gradient for login background */
@keyframes meshDrift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.mesh-bg {
  background: linear-gradient(
    -45deg,
    rgba(168, 85, 247, 0.08),
    rgba(255, 61, 127, 0.06),
    rgba(14, 14, 20, 1),
    rgba(0, 212, 170, 0.04),
    rgba(255, 77, 141, 0.06)
  );
  background-size: 400% 400%;
  animation: meshDrift 15s ease infinite;
}

/* Gentle floating for decorative elements */
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(1deg); }
  75% { transform: translateY(4px) rotate(-1deg); }
}

.gentle-float { animation: gentleFloat 5s ease-in-out infinite; }
.gentle-float-delayed { animation: gentleFloat 5s ease-in-out 1s infinite; }
.gentle-float-slow { animation: gentleFloat 7s ease-in-out 0.5s infinite; }

/* Bounce in — attention grabber */
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.bounce-in { animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Pull-to-refresh spinner */
@keyframes pullSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Tab switch micro-animation */
@keyframes tabSwitch {
  0% { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.tab-switch { animation: tabSwitch 0.2s ease-out; }

/* Counter rolling animation */
@keyframes countPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); color: var(--green); }
  100% { transform: scale(1); }
}

.count-pulse { animation: countPulse 0.5s ease-out; }

/* Rotating gradient ring for stories */
@keyframes ringRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.story-ring-animated {
  position: relative;
}
.story-ring-animated::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #FF3D7F, #8B5CF6, #F59E0B, #FF3D7F);
  animation: ringRotate 3s linear infinite;
  z-index: -1;
}

/* Floating hearts (TikTok-style) */
@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
  25% {
    transform: translateY(-25vh) scale(1.1) rotate(-15deg) translateX(10px);
  }
  50% {
    transform: translateY(-50vh) scale(0.9) rotate(10deg) translateX(-10px);
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateY(-80vh) scale(0.5) rotate(-5deg);
  }
}

.floating-heart {
  position: fixed;
  font-size: 1.5rem;
  pointer-events: none;
  z-index: 90;
  animation: floatUp 3s ease-out forwards;
}

/* Shimmer border animation for popular plan */
@keyframes shimmerBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.shimmer-border {
  position: relative;
}
.shimmer-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--teal), var(--accent));
  background-size: 300% 100%;
  animation: shimmerBorder 3s ease infinite;
  z-index: -1;
}

/* Slide up entry for bottom elements */
@keyframes slideUpEntry {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up-entry {
  animation: slideUpEntry 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Stagger children (use with data-stagger on parent) */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 80ms; }
.stagger > *:nth-child(3) { animation-delay: 160ms; }
.stagger > *:nth-child(4) { animation-delay: 240ms; }
.stagger > *:nth-child(5) { animation-delay: 320ms; }
.stagger > *:nth-child(6) { animation-delay: 400ms; }
