/* ============================================
   Bible Quiz AI - Whimsy & Delight Layer
   Adding personality and joy to the experience
   Created by: Whimsy Injector Agent
   ============================================ */

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

/* Delightful Button Interactions */
.btn-whimsy {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.btn-whimsy:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.3);
}

.btn-whimsy:hover::before {
  left: 100%;
}

.btn-whimsy:active:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
}

/* Bounce animation for primary actions */
@keyframes bounce-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-bounce-in {
  animation: bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================
   QUIZ ELEMENT WHIMSY
   ========================================== */

/* Playful Radio Button Hover */
.quiz-option {
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-option:hover {
  transform: translateX(8px);
  background: linear-gradient(135deg, var(--color-primary-50) 0%, var(--color-secondary-50) 100%);
}

/* Sparkle effect when selecting correct answer */
.quiz-option.correct {
  animation: success-flash 0.6s ease-in-out;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  border-color: var(--color-success) !important;
}

.quiz-option.correct::after {
  content: '✨';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  animation: sparkle-pop 0.6s ease-in-out;
  font-size: 24px;
}

@keyframes success-flash {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(16, 185, 129, 0.3);
  }
}

@keyframes sparkle-pop {
  0% {
    transform: translateY(-50%) scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: translateY(-50%) scale(1.5) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) scale(1) rotate(360deg);
    opacity: 1;
  }
}

/* Wrong answer shake */
.quiz-option.incorrect {
  animation: shake 0.5s ease-in-out;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  border-color: var(--color-error) !important;
}

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

/* ==========================================
   PROGRESS CELEBRATIONS
   ========================================== */

.progress-bar-whimsy {
  position: relative;
  background: linear-gradient(90deg, var(--color-primary-500) 0%, var(--color-secondary-500) 100%);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.progress-bar-whimsy::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Confetti celebration on completion */
.celebration-trigger {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--color-primary-500);
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ==========================================
   HOME PAGE WHIMSY
   ========================================== */

/* Floating animation for hero elements */
.float-animation {
  animation: float 3s ease-in-out infinite;
}

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

/* Difficulty cards with playful hover */
.difficulty-card-whimsy {
  position: relative;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.difficulty-card-whimsy::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg,
    var(--color-primary-400),
    var(--color-secondary-400),
    var(--color-primary-400));
  background-size: 400% 400%;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s;
  animation: gradient-shift 3s ease infinite;
  z-index: -1;
}

.difficulty-card-whimsy:hover::before {
  opacity: 1;
}

.difficulty-card-whimsy:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
}

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

/* Emoji reactions on hover */
.emoji-react {
  position: absolute;
  font-size: 24px;
  pointer-events: none;
  animation: emoji-float 2s ease-out forwards;
}

@keyframes emoji-float {
  0% {
    transform: translateY(0) scale(0);
    opacity: 0;
  }
  10% {
    transform: translateY(-10px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(0.5);
    opacity: 0;
  }
}

/* ==========================================
   LOADING STATES WITH PERSONALITY
   ========================================== */

.loading-whimsy {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary-500);
  animation: bounce-loading 1.4s infinite both;
}

.loading-dot:nth-child(1) { animation-delay: 0s; }
.loading-dot:nth-child(2) { animation-delay: 0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce-loading {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Playful spinner */
.spinner-whimsy {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-primary-100);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin-whimsy 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes spin-whimsy {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================
   ACHIEVEMENT NOTIFICATIONS
   ========================================== */

.achievement-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-secondary-500) 100%);
  color: white;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  animation: slide-in-right 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1070;
  max-width: 320px;
}

.achievement-notification .achievement-icon {
  font-size: 48px;
  animation: bounce-scale 0.6s ease-in-out;
}

@keyframes slide-in-right {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes bounce-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ==========================================
   EASTER EGG ELEMENTS
   ========================================== */

/* Rainbow mode activated by Konami code */
body.rainbow-mode {
  animation: rainbow-bg 3s linear infinite;
}

@keyframes rainbow-bg {
  0% { background: linear-gradient(45deg, #ff0000, #ff7f00); }
  17% { background: linear-gradient(45deg, #ff7f00, #ffff00); }
  33% { background: linear-gradient(45deg, #ffff00, #00ff00); }
  50% { background: linear-gradient(45deg, #00ff00, #0000ff); }
  67% { background: linear-gradient(45deg, #0000ff, #4b0082); }
  83% { background: linear-gradient(45deg, #4b0082, #9400d3); }
  100% { background: linear-gradient(45deg, #9400d3, #ff0000); }
}

/* Floating emojis */
.floating-emoji {
  position: fixed;
  font-size: 40px;
  pointer-events: none;
  animation: float-up 4s linear forwards;
  z-index: 9999;
}

@keyframes float-up {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Secret hover zone */
.easter-egg-zone {
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

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

/* ==========================================
   SCORE CELEBRATION ANIMATIONS
   ========================================== */

.score-reveal {
  animation: score-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes score-pop {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Perfect score celebration */
.perfect-score {
  position: relative;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6);
  }
}

/* ==========================================
   INTERACTIVE FEEDBACK
   ========================================== */

/* Button click ripple effect */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::after {
  width: 300px;
  height: 300px;
}

/* Success checkmark animation */
.checkmark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: var(--color-success);
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px var(--color-success);
  animation: fill-success 0.4s ease-in-out 0.4s forwards,
             scale-checkmark 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: var(--color-success);
  fill: none;
  animation: stroke-checkmark 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke-checkmark 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke-checkmark {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes scale-checkmark {
  0%, 100% {
    transform: none;
  }
  50% {
    transform: scale3d(1.1, 1.1, 1);
  }
}

@keyframes fill-success {
  100% {
    box-shadow: inset 0px 0px 0px 30px var(--color-success);
  }
}

/* ==========================================
   STREAK COUNTER
   ========================================== */

.streak-counter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: var(--radius-full);
  color: white;
  font-weight: var(--font-weight-bold);
  animation: streak-pulse 2s ease-in-out infinite;
}

.streak-counter::before {
  content: '🔥';
  font-size: 20px;
  animation: flame-flicker 1s ease-in-out infinite;
}

@keyframes streak-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
  }
}

@keyframes flame-flicker {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1) rotate(5deg); }
}

/* ==========================================
   ACCESSIBILITY & REDUCED MOTION
   ========================================== */

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

  .float-animation,
  .bounce-in,
  .sparkle-pop,
  .shake,
  .confetti-fall,
  .emoji-float {
    animation: none !important;
  }
}

/* ==========================================
   PLAYFUL EMPTY STATES
   ========================================== */

.empty-state-whimsy {
  text-align: center;
  padding: var(--space-12);
  opacity: 0;
  animation: fade-in-up 0.6s ease-out forwards;
}

.empty-state-whimsy .emoji {
  font-size: 80px;
  display: block;
  margin-bottom: var(--space-4);
  animation: bounce-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   DAILY CHALLENGE SPECIAL STYLING
   ========================================== */

.daily-challenge-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: white;
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-bold);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  animation: badge-shine 3s ease-in-out infinite;
}

.daily-challenge-badge::before {
  content: '⭐';
  animation: star-twinkle 2s ease-in-out infinite;
}

@keyframes badge-shine {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.8);
  }
}

@keyframes star-twinkle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
}
