/* ================================================
   TOTO QUIZ - Animations
   tq-animations.css
   ================================================ */

/* ---- Keyframe Definitions ---- */

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

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

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

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

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

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

@keyframes tq-pulse-ring {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(232,98,42,0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 18px rgba(232,98,42,0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(232,98,42,0); }
}

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

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

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

@keyframes tq-hero-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes tq-text-reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0% 0 0);
  }
}

@keyframes tq-draw-line {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

@keyframes tq-blob {
  0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes tq-count-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tq-confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}

/* ---- Scroll Reveal Classes ---- */

.tq-reveal {
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.tq-reveal.tq-reveal-up {
  transform: translateY(40px);
}

.tq-reveal.tq-reveal-left {
  transform: translateX(-40px);
}

.tq-reveal.tq-reveal-right {
  transform: translateX(40px);
}

.tq-reveal.tq-reveal-scale {
  transform: scale(0.9);
}

.tq-reveal.tq-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays */
.tq-stagger-1 { transition-delay: 0.1s; }
.tq-stagger-2 { transition-delay: 0.2s; }
.tq-stagger-3 { transition-delay: 0.3s; }
.tq-stagger-4 { transition-delay: 0.4s; }
.tq-stagger-5 { transition-delay: 0.5s; }
.tq-stagger-6 { transition-delay: 0.6s; }

/* ---- Floating Elements ---- */

.tq-float-anim {
  animation: tq-float 5s ease-in-out infinite;
}

.tq-float-anim-delay {
  animation: tq-float 5s ease-in-out infinite;
  animation-delay: 1.5s;
}

.tq-float-anim-slow {
  animation: tq-float 8s ease-in-out infinite;
  animation-delay: 0.8s;
}

/* ---- Blob Shapes ---- */

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

.tq-blob-2 {
  animation: tq-blob 10s ease-in-out infinite reverse;
  animation-delay: 2s;
}

/* ---- Shimmer Effect ---- */

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

/* ---- Pulse Ring ---- */

.tq-pulse-ring {
  animation: tq-pulse-ring 2.5s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

/* ---- Hero Animated Text ---- */

.tq-hero-word {
  display: inline-block;
  animation: tq-fadeInUp 0.8s ease both;
}

.tq-hero-word:nth-child(1) { animation-delay: 0.1s; }
.tq-hero-word:nth-child(2) { animation-delay: 0.2s; }
.tq-hero-word:nth-child(3) { animation-delay: 0.3s; }
.tq-hero-word:nth-child(4) { animation-delay: 0.4s; }
.tq-hero-word:nth-child(5) { animation-delay: 0.5s; }

/* ---- Hero Section Animated BG ---- */

.tq-hero-bg-animated {
  background-size: 400% 400%;
  animation: tq-hero-gradient 12s ease infinite;
}

/* ---- Spin ---- */
.tq-spin-slow {
  animation: tq-spin-slow 20s linear infinite;
}

/* ---- Bounce In ---- */
.tq-bounce-in {
  animation: tq-bounce-in 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ---- SVG Drawing ---- */
.tq-draw path,
.tq-draw circle,
.tq-draw line,
.tq-draw polyline {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: tq-draw-line 2s ease forwards;
}

/* ---- Quiz Answer Feedback Animations ---- */

.tq-answer-option.tq-correct {
  animation: tq-bounce-in 0.4s ease both;
}

.tq-answer-option.tq-incorrect {
  animation: tq-shake 0.4s ease both;
}

@keyframes tq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---- Progress Bar Animation ---- */

.tq-quiz-progress-bar-fill {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Result Screen ---- */

.tq-result-score-circle {
  animation: tq-scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
  animation-delay: 0.2s;
}

/* ---- Page Transitions ---- */

.tq-page-enter {
  animation: tq-fadeInUp 0.5s ease both;
}

/* ---- Hover underline animation ---- */

.tq-hover-underline {
  position: relative;
}

.tq-hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--tq-secondary);
  transition: width 0.3s ease;
}

.tq-hover-underline:hover::after {
  width: 100%;
}

/* ---- Card Appear Animations ---- */

.tq-card-appear {
  animation: tq-fadeInUp 0.6s ease both;
}

/* ---- Confetti pieces (for quiz results) ---- */

.tq-confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: tq-confetti-fall 1.5s ease-out forwards;
}

/* ---- Loading Spinner ---- */

.tq-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(42,157,143,0.2);
  border-top-color: var(--tq-teal);
  border-radius: 50%;
  animation: tq-spin-slow 0.8s linear infinite;
}

/* ---- SVG Deco Animations ---- */

.tq-svg-deco {
  position: absolute;
  pointer-events: none;
  opacity: 0.07;
}

.tq-svg-deco-rotate {
  animation: tq-spin-slow 30s linear infinite;
}

/* ---- Typewriter effect ---- */

.tq-typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--tq-accent);
  animation: 
    tq-typing 3s steps(40, end),
    tq-blink-caret 0.8s step-end infinite;
}

@keyframes tq-typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes tq-blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--tq-accent); }
}

/* ---- Filter Tab Transition ---- */

.tq-quiz-grid-item {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.tq-quiz-grid-item.tq-hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  display: none;
}
