/**
 * Achievement Modal Styles
 *
 * Animations and custom styles for the achievement modal component
 *
 * Features:
 * - Modal entrance/exit animations
 * - Badge card hover effects
 * - Progress bar animations
 * - Glow effects for legendary badges
 * - Responsive layouts
 */

/* ============================================================================
   MODAL ANIMATIONS
   ============================================================================ */

/* Modal entrance animation */
.modal-enter {
  opacity: 1 !important;
  transform: scale(1) !important;
}

/* Trophy icon subtle pulse animation */
@keyframes trophy-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.modal-enter .material-symbols-outlined.text-yellow-500 {
  animation: trophy-pulse 2s ease-in-out infinite;
}

/* Fade-in content animation */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-content {
  animation: fade-in 0.4s ease-out;
}

.fade-in-content > * {
  animation: fade-in 0.4s ease-out backwards;
}

.fade-in-content > *:nth-child(1) {
  animation-delay: 0.05s;
}

.fade-in-content > *:nth-child(2) {
  animation-delay: 0.1s;
}

.fade-in-content > *:nth-child(3) {
  animation-delay: 0.15s;
}

.fade-in-content > *:nth-child(4) {
  animation-delay: 0.2s;
}

/* Badge unlock celebration animation */
@keyframes badge-unlock {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
  }
}

.badge-unlock-animation {
  animation: badge-unlock 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* XP counter animation */
@keyframes xp-gain {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-20px);
    opacity: 0;
  }
}

.xp-gain-animation {
  animation: xp-gain 1s ease-out forwards;
}

/* Progress bar fill animation */
@keyframes progress-fill {
  from {
    width: 0%;
  }
}

.progress-bar-animated {
  animation: progress-fill 1s ease-out;
}

/* Confetti animation for level-up */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: confetti-fall 3s linear infinite;
}

/* ============================================================================
   BADGE CARD EFFECTS
   ============================================================================ */

/* Badge card hover lift effect */
.badge-card {
  transition: all 0.2s ease;
}

.badge-card:hover {
  transform: translateY(-4px);
}

/* Legendary badge glow pulse */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.8);
  }
}

.legendary-glow {
  animation: glow-pulse 2s ease-in-out infinite;
}

/* ============================================================================
   LEVEL CIRCLE
   ============================================================================ */

/* Level circle pulse on hover */
.level-circle {
  transition: transform 0.3s ease;
}

.level-circle:hover {
  transform: scale(1.05);
}

/* ============================================================================
   STREAK INDICATOR
   ============================================================================ */

/* Streak flame animation */
@keyframes flame-flicker {
  0%, 100% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.1) translateY(-2px);
  }
}

.streak-active .material-symbols-outlined {
  animation: flame-flicker 1.5s ease-in-out infinite;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Reduce modal padding on mobile */
  .modal-content {
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  /* Stack tab buttons vertically on very small screens */
  @media (max-width: 480px) {
    .tab-button {
      font-size: 0.75rem;
      padding: 0.5rem 0.75rem;
    }

    .tab-button .material-symbols-outlined {
      display: none; /* Hide icons on very small screens */
    }
  }

  /* Adjust badge grid for mobile */
  .badge-grid-mobile {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .modal-content {
    max-width: 90% !important;
  }
}

/* ============================================================================
   TAB BUTTON OVERRIDES
   ============================================================================ */

/* Remove all background and outline states from tab buttons - only underline should show */
.tab-button {
  background: transparent !important;
  background-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

.tab-button:hover,
.tab-button:focus,
.tab-button:active,
.tab-button:focus-visible,
.tab-button.active {
  background: transparent !important;
  background-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus indicators for keyboard navigation - disabled for tab buttons (using underline instead) */
.tab-button:focus,
.tab-button:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Keep focus for other buttons */
button:focus:not(.tab-button) {
  outline: 2px solid #EA2831;
  outline-offset: 2px;
}

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

/* ============================================================================
   LOADING STATES
   ============================================================================ */

/* Skeleton loading animation */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ============================================================================
   CUSTOM SCROLLBAR
   ============================================================================ */

/* Custom scrollbar for modal content */
#tab-content::-webkit-scrollbar {
  width: 8px;
}

#tab-content::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

#tab-content::-webkit-scrollbar-thumb {
  background: #EA2831;
  border-radius: 4px;
}

#tab-content::-webkit-scrollbar-thumb:hover {
  background: #ff6b7a;
}

/* ============================================================================
   SHARE MENU
   ============================================================================ */

/* Share menu fade in */
@keyframes share-menu-fade {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.share-menu {
  animation: share-menu-fade 0.2s ease-out;
}

/* ============================================================================
   TIMELINE DOT ANIMATION
   ============================================================================ */

/* Timeline dot pulse */
@keyframes timeline-dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.timeline-dot-recent {
  animation: timeline-dot-pulse 2s ease-in-out infinite;
}
