/* =====================================================
   SENSEI LMS SLIDESHOW MOCKUP - ANIMATIONS
   ===================================================== */

/* =====================================================
   KEYFRAME ANIMATIONS
   ===================================================== */

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

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

/* Slide In - Chat messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse - Hotspot markers */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
}

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

/* Bounce - Icons */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Rotate - Loading spinner */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Shimmer - Loading effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Typing Indicator */
@keyframes typing {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* =====================================================
   ANIMATED LIST ITEMS (Objectives, Summary)
   ===================================================== */
.animated-list li {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.animated-list li:nth-child(1) { animation-delay: 0.1s; }
.animated-list li:nth-child(2) { animation-delay: 0.2s; }
.animated-list li:nth-child(3) { animation-delay: 0.3s; }
.animated-list li:nth-child(4) { animation-delay: 0.4s; }
.animated-list li:nth-child(5) { animation-delay: 0.5s; }

/* =====================================================
   SLIDE TRANSITION ANIMATIONS
   ===================================================== */
.slide.slide-enter {
  animation: fadeIn 0.4s ease-in-out;
}

.slide.slide-exit {
  animation: fadeOut 0.4s ease-in-out;
}

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

/* =====================================================
   BUTTON HOVER ANIMATIONS
   ===================================================== */
button {
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::before {
  width: 300px;
  height: 300px;
}

/* =====================================================
   PROGRESS BAR ANIMATIONS
   ===================================================== */
.progress-fill.animated {
  animation: progressGrow 2s ease-out forwards;
}

@keyframes progressGrow {
  from {
    width: 0%;
  }
}

/* =====================================================
   FLASHCARD FLIP ANIMATION
   ===================================================== */
.flashcard {
  transform-style: preserve-3d;
}

.flashcard.flipping {
  animation: cardFlip 0.6s ease-in-out;
}

@keyframes cardFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

/* =====================================================
   HOTSPOT REVEAL ANIMATION
   ===================================================== */
.hotspot-popup {
  animation: popupReveal 0.3s ease-out;
}

@keyframes popupReveal {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-5px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* =====================================================
   QUIZ FEEDBACK ANIMATION
   ===================================================== */
.quiz-feedback {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 200px;
    transform: translateY(0);
  }
}

/* =====================================================
   QUIZ OPTION FEEDBACK ANIMATIONS
   ===================================================== */
.quiz-option.correct {
  animation: correctPulse 0.5s ease-out;
}

.quiz-option.incorrect {
  animation: shake 0.5s ease-out;
}

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

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* =====================================================
   ACCORDION OPEN/CLOSE ANIMATION
   ===================================================== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.accordion-content:not(.hidden) {
  max-height: 500px;
}

/* =====================================================
   EXPANDABLE CONTENT ANIMATION
   ===================================================== */
.expand-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  padding: 0 var(--spacing-md);
}

.expand-content:not(.hidden) {
  max-height: 500px;
  padding: var(--spacing-md);
}

/* =====================================================
   TASK CHECKBOX ANIMATION
   ===================================================== */
.task-checkbox {
  transition: all 0.2s ease-out;
}

.task-checkbox:checked {
  animation: checkBounce 0.3s ease-out;
}

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

/* =====================================================
   VIDEO PLAY BUTTON ANIMATION
   ===================================================== */
.play-button {
  animation: pulseSlow 2s ease-in-out infinite;
}

@keyframes pulseSlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
  }
}

/* =====================================================
   AI CHAT WIDGET ANIMATIONS
   ===================================================== */
.chat-toggle {
  animation: bounce 2s ease-in-out infinite;
}

.chat-window {
  animation: slideUpChat 0.3s ease-out;
}

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

/* Typing indicator animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--spacing-sm);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* =====================================================
   STAT HIGHLIGHT ANIMATION
   ===================================================== */
.stat-highlight {
  animation: highlightGlow 3s ease-in-out infinite;
}

@keyframes highlightGlow {
  0%, 100% {
    background: rgba(255, 255, 255, 0.15);
  }
  50% {
    background: rgba(255, 255, 255, 0.25);
  }
}

/* =====================================================
   COMPLETION SCREEN ANIMATIONS
   ===================================================== */
.completion-screen h1 {
  animation: fadeInUp 0.8s ease-out;
}

.completion-message {
  animation: fadeInUp 1s ease-out 0.2s both;
}

.completion-progress {
  animation: scaleIn 0.8s ease-out 0.4s both;
}

.next-chapter {
  animation: fadeInUp 1s ease-out 0.6s both;
}

/* =====================================================
   LOADING SKELETON ANIMATION
   ===================================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

/* =====================================================
   MICRO-INTERACTIONS
   ===================================================== */

/* Button Press Effect */
.nav-button:active,
.quiz-option:active,
.expand-trigger:active,
.accordion-trigger:active {
  transform: scale(0.98);
}

/* Card Lift on Hover */
.flashcard:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

/* Icon Rotation on Hover */
.expand-trigger:hover::after,
.accordion-trigger:hover::after {
  transform: rotate(90deg);
}

/* Glossary Term Underline Animation */
.glossary-term {
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease-in-out;
}

.glossary-term:hover {
  background-size: 100% 2px;
}

/* =====================================================
   NAVIGATION TRANSITION EFFECTS
   ===================================================== */
.slide.transitioning-out {
  animation: slideOutLeft 0.4s ease-in-out forwards;
}

.slide.transitioning-in {
  animation: slideInRight 0.4s ease-in-out forwards;
}

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

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

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

  .slide {
    transition: opacity 0.01ms;
  }

  .flashcard-front,
  .flashcard-back {
    transition: transform 0.01ms;
  }
}

/* =====================================================
   PERFORMANCE OPTIMIZATIONS
   ===================================================== */

/* GPU Acceleration for animations */
.slide,
.flashcard,
.hotspot-popup,
.chat-window {
  will-change: transform, opacity;
}

/* Prevent layout shift during animations */
.progress-fill {
  will-change: width;
}

/* Smooth text rendering during animations */
.slide {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
