/* ============================================================
   ANIMATIONS.CSS — Global Animations & Transitions
   Easy eSIM Platform | Powered by Airalo + DESC Token
   ============================================================ */

/* ── Base Keyframes ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(110%); }
  to   { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to   { transform: translateX(110%); }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-5px); }
  30%, 70%  { transform: translateX(5px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes ripple {
  0%   { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0,212,255,0.3); }
  50%       { box-shadow: 0 0 24px rgba(0,212,255,0.7), 0 0 48px rgba(0,212,255,0.3); }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(0,212,255,0.2); }
  50%       { border-color: rgba(0,212,255,0.6); }
}

@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Utility Animation Classes ── */
.anim-fade-in       { animation: fadeIn 0.5s ease both; }
.anim-fade-in-up    { animation: fadeInUp 0.6s ease both; }
.anim-fade-in-down  { animation: fadeInDown 0.6s ease both; }
.anim-fade-in-left  { animation: fadeInLeft 0.6s ease both; }
.anim-fade-in-right { animation: fadeInRight 0.6s ease both; }
.anim-scale-in      { animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.anim-bounce-in     { animation: bounceIn 0.6s ease both; }
.anim-float         { animation: float 4s ease-in-out infinite; }
.anim-breathe       { animation: breathe 3s ease-in-out infinite; }
.anim-pulse         { animation: pulse 2s ease-in-out infinite; }
.anim-spin          { animation: spin 1s linear infinite; }
.anim-glow          { animation: glowPulse 2s ease-in-out infinite; }
.anim-shake         { animation: shake 0.5s ease; }

/* Delay helpers */
.anim-delay-100 { animation-delay: 0.1s; }
.anim-delay-200 { animation-delay: 0.2s; }
.anim-delay-300 { animation-delay: 0.3s; }
.anim-delay-400 { animation-delay: 0.4s; }
.anim-delay-500 { animation-delay: 0.5s; }
.anim-delay-600 { animation-delay: 0.6s; }
.anim-delay-700 { animation-delay: 0.7s; }
.anim-delay-800 { animation-delay: 0.8s; }

/* ── Shimmer Loading Skeleton ── */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card  { height: 180px; border-radius: 18px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-btn   { height: 40px; width: 120px; border-radius: 10px; }

/* ── Page Transition ── */
.page-enter {
  animation: fadeInUp 0.4s ease both;
}

.page-exit {
  animation: fadeIn 0.3s ease reverse both;
}

/* ── Hover Lift ── */
.hover-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

/* ── Shimmer Text (Gradient animated text) ── */
.shimmer-text {
  background: linear-gradient(
    90deg,
    #00d4ff 0%,
    #6366f1 30%,
    #10b981 60%,
    #00d4ff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ── Gradient Border Animation ── */
.gradient-border-anim {
  position: relative;
  border-radius: 18px;
}

.gradient-border-anim::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 19px;
  background: linear-gradient(135deg, #00d4ff, #6366f1, #10b981, #00d4ff);
  background-size: 300% 300%;
  animation: gradientShift 4s ease infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gradient-border-anim:hover::before { opacity: 1; }

/* ── Number Counter Animation ── */
.counter-animate {
  animation: countUp 0.6s ease both;
}

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

.ripple-effect {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
  margin-left: -10px;
  margin-top: -10px;
}

/* ── Scroll Reveal ── */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

/* ── Stagger Children ── */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.in-view > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.in-view > *:nth-child(2) { transition-delay: 0.10s; }
.stagger-children.in-view > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.in-view > *:nth-child(4) { transition-delay: 0.20s; }
.stagger-children.in-view > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.in-view > *:nth-child(6) { transition-delay: 0.30s; }

.stagger-children.in-view > * {
  opacity: 1;
  transform: translateY(0);
}

/* ── Loading Screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #070b14;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hide {
  opacity: 0;
  visibility: hidden;
}

.loading-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #00d4ff, #6366f1);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  animation: breathe 1.5s ease-in-out infinite;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #6366f1);
  border-radius: 10px;
  animation: loadProgress 1.5s ease forwards;
}

@keyframes loadProgress {
  from { width: 0%; }
  to   { width: 100%; }
}

.loading-text {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ── Particle Dots (decorative) ── */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(0,212,255,0.4);
  border-radius: 50%;
  animation: particleFloat var(--duration, 6s) ease-in-out infinite var(--delay, 0s);
}

@keyframes particleFloat {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ── Reduced motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee-track { animation: none; }
  .phone-mockup  { animation: none; }
  .desc-coin     { animation: none; }
}
