/* ============================================
   TIMELINE GAMIFICATION - Phase 4
   Achievement Badges, Progress Shimmer, Micro-interactions
   Design: Nobara Kugisaki | Implementation: Yuuji Itadori
   Date: 2026-02-24
   FEAT-TIMELINE-PHASE4-GAMIFICATION
   ============================================ */

/* ---- CSS Custom Properties ---- */
.passport-form-wrapper {
  --badge-gold: #ffb400;
  --badge-bg: #1a1a1a;
  --badge-border: #ffb400;
  --badge-shadow: rgba(255, 180, 0, 0.4);
  --shimmer-color-1: rgba(255, 238, 0, 0);
  --shimmer-color-2: rgba(255, 238, 0, 0.25);
  --shimmer-color-3: rgba(255, 238, 0, 0);
}

/* ============================================
   ACHIEVEMENT BADGE NOTIFICATION
   ============================================ */

/* Container for floating badge notifications */
.badge-notification-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  justify-content: center;
  padding-top: 0.5em;
}

/* Individual badge notification */
.badge-notification {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 1em;
  background: var(--badge-bg);
  border: 2px solid var(--badge-border);
  border-radius: 24px;
  box-shadow: 0 4px 20px var(--badge-shadow);
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.6) translateY(-10px);
  animation: badgeAppear 0.5s ease-out forwards;
}

.badge-notification.badge-exit {
  animation: badgeFadeOut 0.4s ease-in forwards;
}

.badge-emoji {
  font-size: 1.4em;
  line-height: 1;
}

.badge-label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--badge-gold);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Badge appearance animation */
@keyframes badgeAppear {
  0% {
    opacity: 0;
    transform: scale(0.6) translateY(-10px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Badge fade out */
@keyframes badgeFadeOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
  }
}

/* ============================================
   PROGRESS BAR SHIMMER
   ============================================ */

/* Shimmer overlay on the stamp-progress bar connector lines */
.stamp-progress {
  position: relative;
  overflow: visible;
}

.stamp-progress::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(
    90deg,
    var(--shimmer-color-1) 0%,
    var(--shimmer-color-2) 50%,
    var(--shimmer-color-3) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

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

/* ============================================
   MICRO-INTERACTIONS: STAR RATING
   ============================================ */

/* Enhanced star rating fill animation */
.star-rating i {
  transition: transform 0.2s ease, color 0.15s ease;
  cursor: pointer;
  display: inline-block;
}

.star-rating i:hover {
  transform: scale(1.25);
}

.star-rating i.active {
  animation: starFill 0.35s ease-out;
}

@keyframes starFill {
  0% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Star rating label fade-in */
.star-rating-label {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.star-rating-label.visible {
  opacity: 1;
}

/* ============================================
   MICRO-INTERACTIONS: SUBMIT BUTTON PULSE
   ============================================ */

/* Submit button pulse on hover */
.passport-form-wrapper .form-buttons .btn-primary:hover {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

/* ============================================
   IMPACT COUNTER (in success message)
   ============================================ */

.impact-counter-message {
  font-size: 0.95em;
  color: var(--passport-yellow, #ffee00);
  margin-top: 0.75em;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: impactFadeIn 0.6s ease-out 0.5s forwards;
}

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

/* ============================================
   ACCESSIBILITY: prefers-reduced-motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  /* Disable all gamification animations */
  .badge-notification {
    animation: none;
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  .badge-notification.badge-exit {
    animation: none;
    opacity: 0;
  }

  .stamp-progress::before {
    animation: none;
    background: transparent;
  }

  .star-rating i {
    transition: none;
  }

  .star-rating i.active {
    animation: none;
  }

  .star-rating-label {
    transition: none;
  }

  .passport-form-wrapper .form-buttons .btn-primary:hover {
    animation: none;
  }

  .impact-counter-message {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
