/* Animations and Eye Candy for BraveKingJames.com */

/* Page Load Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(246, 198, 106, 0.5); }
  50% { box-shadow: 0 0 20px rgba(246, 198, 106, 0.8); }
}

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

/* Element Animations */
.page-load {
  animation: fadeInUp 0.8s ease-out;
}

.card-enter {
  animation: fadeInUp 0.6s ease-out;
}

.button-pulse {
  animation: pulse 2s infinite;
}

.button-glow {
  animation: glow 2s infinite;
}

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

/* Realm-specific Animations */
.realm-fantasy .realm-card {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.realm-fantasy .realm-card:nth-child(1) { animation-delay: 0.1s; }
.realm-fantasy .realm-card:nth-child(2) { animation-delay: 0.2s; }
.realm-fantasy .realm-card:nth-child(3) { animation-delay: 0.3s; }
.realm-fantasy .realm-card:nth-child(4) { animation-delay: 0.4s; }
.realm-fantasy .realm-card:nth-child(5) { animation-delay: 0.5s; }

/* Chat Widget Animations */
.chat-widget {
  animation: slideInRight 0.5s ease-out;
}

.chat-message {
  animation: fadeInUp 0.3s ease-out;
}

.chat-message:nth-child(odd) {
  animation: slideInLeft 0.3s ease-out;
}

.chat-message:nth-child(even) {
  animation: slideInRight 0.3s ease-out;
}

/* Stage Completion Animations */
.victory-glow {
  animation: glow 1.5s ease-in-out infinite;
}

.achievement-pop {
  animation: pulse 0.5s ease-out;
}

/* Button Hover Effects */
.primary, .btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.primary:hover, .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.primary::after, .btn-primary::after {
  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;
}

.primary:hover::after, .btn-primary:hover::after {
  left: 100%;
}

/* Realm Card Hover Effects */
.realm-card {
  transition: all 0.3s ease;
  position: relative;
}

.realm-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.realm-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(45deg, #f6c66a, #5aa9e6, #4CAF50, #9b59b6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
}

.realm-card:hover::before {
  opacity: 1;
  animation: shimmer 2s linear infinite;
}

/* Profile Crest Animation */
#crestSlot svg {
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
}

/* Stage Navigation Animations */
.nav-link {
  transition: all 0.3s ease;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #f6c66a;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::before {
  width: 80%;
}

/* Lesson Section Animations */
.lesson-section {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.franklin-section { animation-delay: 0.1s; }
.bible-section { animation-delay: 0.2s; }
.math-section { animation-delay: 0.3s; }
.empire-section { animation-delay: 0.4s; }

/* Math Input Focus Effect */
.math-input:focus {
  animation: glow 1.5s infinite;
  outline: none;
}

/* Completion Celebration */
.completion-message {
  animation: fadeInUp 0.5s ease-out, pulse 2s infinite 0.5s;
}

/* Daily Notification */
.daily-notification {
  animation: slideInRight 0.5s ease-out, fadeOut 0.5s ease 4.5s forwards;
}

/* Loading Animation */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(246, 198, 106, 0.3);
  border-radius: 50%;
  border-top-color: #f6c66a;
  animation: spin 1s linear infinite;
}

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

/* Progress Bar Animation */
.progress-fill {
  transition: width 1s ease-in-out;
}

/* Voice Button Animation */
.voice-btn.active {
  animation: pulse 1.5s infinite;
}

/* Mobile-specific Animations */
@media (max-width: 768px) {
  .realm-card:hover {
    transform: translateY(-5px) scale(1.02);
  }
  
  .nav-link:hover::before {
    width: 60%;
  }
}

/* Print styles - disable animations */
@media print {
  * {
    animation: none !important;
    transition: none !important;
  }
}

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