/* ============================================
   Sahara National Academy - Animations
   ============================================ */

/* ---- Keyframe Animations ---- */

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Rotate In */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

/* Bounce */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translateY(0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-20px);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-10px);
  }
  90% {
    transform: translateY(-4px);
  }
}

/* Pulse */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Float */
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

/* Glow */
@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(21,101,192,0.3); }
  50% { box-shadow: 0 0 20px rgba(21,101,192,0.6), 0 0 40px rgba(21,101,192,0.3); }
  100% { box-shadow: 0 0 5px rgba(21,101,192,0.3); }
}

/* Slide In from Bottom */
@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Ripple Effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Counter Roll */
@keyframes counterRoll {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Wave */
@keyframes wave {
  0% { transform: translateX(0) translateZ(0) scaleY(1); }
  50% { transform: translateX(-25%) translateZ(0) scaleY(0.55); }
  100% { transform: translateX(-50%) translateZ(0) scaleY(1); }
}

/* Icon Spin */
@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---- Animation Classes ---- */
.animate-fadeIn {
  animation: fadeIn 0.8s ease forwards;
}

.animate-fadeInUp {
  animation: fadeInUp 0.8s ease forwards;
}

.animate-fadeInDown {
  animation: fadeInDown 0.8s ease forwards;
}

.animate-fadeInLeft {
  animation: fadeInLeft 0.8s ease forwards;
}

.animate-fadeInRight {
  animation: fadeInRight 0.8s ease forwards;
}

.animate-scaleIn {
  animation: scaleIn 0.6s ease forwards;
}

.animate-bounce {
  animation: bounce 1s ease;
}

.animate-pulse {
  animation: pulse 2s ease infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* ---- Staggered Animation ---- */
.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(11) { animation-delay: 1s; }
.stagger-children > *:nth-child(12) { animation-delay: 1.1s; }
.stagger-children > *:nth-child(13) { animation-delay: 1.2s; }

/* ---- Hover Animation Classes ---- */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(21,101,192,0.4);
}

.hover-shadow {
  transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* ---- Ripple Button Effect ---- */
.ripple-btn {
  position: relative;
  overflow: hidden;
}

.ripple-btn .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ---- Parallax Scroll Effect ---- */
.parallax-bg {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ---- Gradient Background Animation ---- */
.animated-gradient {
  background: linear-gradient(-45deg, #30C9BC, #42D1C7, #0E9E93, #4DD4C8);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
}

/* ---- Card Hover Border Animation ---- */
.border-animation {
  position: relative;
  overflow: hidden;
}

.border-animation::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.border-animation:hover::before {
  left: 100%;
}

/* ---- Typing Cursor ---- */
.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1.2em;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 0.7s infinite;
  vertical-align: text-bottom;
}

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-title {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-image {
  height: 200px;
  border-radius: 8px;
}

/* ---- Scroll Indicator ---- */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
}

.scroll-indicator .mouse {
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 13px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.scroll-indicator .wheel {
  width: 4px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollWheel 1.5s ease infinite;
}

@keyframes scrollWheel {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---- Number Counter Animation ---- */
.counter-value {
  display: inline-block;
  overflow: hidden;
}

.counter-value .counter-digit {
  display: inline-block;
  animation: counterRoll 0.5s ease forwards;
}

/* ---- Image Reveal ---- */
.img-reveal {
  position: relative;
  overflow: hidden;
}

.img-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary);
  transform-origin: right;
  animation: imgReveal 0.8s ease 0.3s forwards;
}

@keyframes imgReveal {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ---- Notification Badge Pulse ---- */
.notification-pulse {
  position: relative;
}

.notification-pulse::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #e53935;
  border-radius: 50%;
  animation: pulse 1.5s ease infinite;
}

/* ---- Smooth Transitions for Dark Mode ---- */
body,
.navbar,
.nav-menu,
.footer,
.facility-card,
.why-card,
.level-card,
.faculty-card,
.news-card,
.achievement-card,
.faq-item,
.contact-form,
.admission-form,
.academic-card,
.stat-card,
.mv-card,
.timeline-content,
.contact-info-card,
.admission-info-card,
.method-card,
.step-card,
.search-overlay,
.popup-overlay {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ---- Hero Ken Burns Effect ---- */
@keyframes kenBurns {
  0% { transform: scale(1); }
  50% { transform: scale(1.1) translateX(-2%); }
  100% { transform: scale(1); }
}

.ken-burns {
  animation: kenBurns 20s ease infinite;
}

/* ---- Text Gradient Animation ---- */
@keyframes textGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animated-text-gradient {
  background: linear-gradient(90deg, var(--accent), var(--white), var(--accent), var(--white));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGradient 4s ease infinite;
}

/* ---- Morphing Blob ---- */
@keyframes morphBlob {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
  75% { border-radius: 60% 40% 60% 30% / 60% 30% 40% 70%; }
}

.morph-blob {
  animation: morphBlob 8s ease-in-out infinite;
}

/* ---- Slide Up Stagger ---- */
@keyframes slideUpStagger {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.slide-up-stagger > *:nth-child(1) { animation: slideUpStagger 0.6s ease 0.05s both; }
.slide-up-stagger > *:nth-child(2) { animation: slideUpStagger 0.6s ease 0.1s both; }
.slide-up-stagger > *:nth-child(3) { animation: slideUpStagger 0.6s ease 0.15s both; }
.slide-up-stagger > *:nth-child(4) { animation: slideUpStagger 0.6s ease 0.2s both; }
.slide-up-stagger > *:nth-child(5) { animation: slideUpStagger 0.6s ease 0.25s both; }
.slide-up-stagger > *:nth-child(6) { animation: slideUpStagger 0.6s ease 0.3s both; }
.slide-up-stagger > *:nth-child(7) { animation: slideUpStagger 0.6s ease 0.35s both; }
.slide-up-stagger > *:nth-child(8) { animation: slideUpStagger 0.6s ease 0.4s both; }

/* ---- Count Up Number ---- */
@keyframes countPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.count-pop {
  animation: countPop 0.4s ease;
}

/* ---- Rotate Icon on Hover ---- */
.rotate-hover i {
  transition: transform 0.4s ease;
}

.rotate-hover:hover i {
  transform: rotate(360deg);
}

/* ---- Elastic Scale ---- */
@keyframes elasticScale {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  50% { transform: scale(0.9); }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ---- Swing ---- */
@keyframes swing {
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}

/* ---- Flash ---- */
@keyframes flash {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* ---- Rubber Band ---- */
@keyframes rubberBand {
  0% { transform: scale3d(1, 1, 1); }
  30% { transform: scale3d(1.25, 0.75, 1); }
  40% { transform: scale3d(0.75, 1.25, 1); }
  50% { transform: scale3d(1.15, 0.85, 1); }
  65% { transform: scale3d(0.95, 1.05, 1); }
  75% { transform: scale3d(1.05, 0.95, 1); }
  100% { transform: scale3d(1, 1, 1); }
}

/* ---- Wobble ---- */
@keyframes wobble {
  0% { transform: translateX(0%); }
  15% { transform: translateX(-25%) rotate(-5deg); }
  30% { transform: translateX(20%) rotate(3deg); }
  45% { transform: translateX(-15%) rotate(-3deg); }
  60% { transform: translateX(10%) rotate(2deg); }
  75% { transform: translateX(-5%) rotate(-1deg); }
  100% { transform: translateX(0%); }
}

/* ---- Heartbeat ---- */
@keyframes heartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.3); }
  28% { transform: scale(1); }
  42% { transform: scale(1.3); }
  70% { transform: scale(1); }
}

/* ---- Flip In X ---- */
@keyframes flipInX {
  from {
    transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    animation-timing-function: ease-in;
    opacity: 0;
  }
  40% {
    transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    animation-timing-function: ease-in;
  }
  60% {
    transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    opacity: 1;
  }
  80% {
    transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
  }
  to {
    transform: perspective(400px);
    opacity: 1;
  }
}

/* ---- Roll In ---- */
@keyframes rollIn {
  from {
    opacity: 0;
    transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Card Shine Sweep ---- */
@keyframes shineSweep {
  0% { left: -100%; }
  100% { left: 200%; }
}

.card-shine {
  position: relative;
  overflow: hidden;
}

.card-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: none;
}

.card-shine:hover::after {
  animation: shineSweep 0.7s ease;
}

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

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
}
