/**
 * Hot Wheels Collection - Animation Styles
 * For banners, borders, and achievement effects
 */

/* Keyframe Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

@keyframes glow {
  0% { box-shadow: 0 0 5px currentColor; }
  100% { box-shadow: 0 0 20px currentColor, 0 0 40px currentColor; }
}

@keyframes rainbowGlow {
  0% { box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000; }
  16% { box-shadow: 0 0 10px #ff7f00, 0 0 20px #ff7f00; }
  33% { box-shadow: 0 0 10px #ffff00, 0 0 20px #ffff00; }
  50% { box-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00; }
  66% { box-shadow: 0 0 10px #0000ff, 0 0 20px #0000ff; }
  83% { box-shadow: 0 0 10px #4b0082, 0 0 20px #4b0082; }
  100% { box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000; }
}

@keyframes sparkle {
  0%, 100% { opacity: 1; }
  25% { opacity: 0.8; }
  50% { opacity: 1; }
  75% { opacity: 0.9; }
}

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

@keyframes flame {
  0% { 
    box-shadow: 0 0 20px #ff4500, 0 0 40px #ff4500, 0 0 60px #ff4500;
    filter: brightness(1);
  }
  100% { 
    box-shadow: 0 0 30px #ff4500, 0 0 60px #ff4500, 0 0 90px #ff4500;
    filter: brightness(1.2);
  }
}

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

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

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

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideIn {
  0% { transform: translateX(-100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes scaleIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Achievement Unlock Animation */
.achievement-unlock-animation {
  animation: scaleIn 0.5s ease-out, glow 2s infinite alternate;
}

/* Level Up Animation */
.level-up-animation {
  animation: bounce 1s ease-out, glow 2s infinite alternate;
}

/* Banner Animations */
.banner-pulse {
  animation: pulse 3s infinite;
}

.banner-shimmer {
  background-size: 200% auto;
  animation: shimmer 2s infinite;
}

.banner-glow {
  animation: glow 2s infinite alternate;
}

.banner-sparkle {
  animation: sparkle 2s infinite;
}

.banner-rotate {
  animation: rotate 4s linear infinite;
}

.banner-flame {
  animation: flame 1s infinite alternate;
}

/* Border Animations */
.border-pulse {
  animation: pulse 3s infinite;
}

.border-shimmer {
  animation: shimmer 2s infinite;
}

.border-glow {
  animation: glow 2s infinite alternate;
}

.border-sparkle {
  animation: sparkle 2s infinite;
}

.border-rotate {
  animation: rotate 4s linear infinite;
}

.border-flame {
  animation: flame 1s infinite alternate;
}

/* XP Gain Animation */
.xp-gain {
  animation: float 1s ease-out, fadeIn 0.5s ease-out;
}

/* Notification Animation */
.notification-slide {
  animation: slideIn 0.5s ease-out;
}

/* Reward Unlock Animation */
.reward-unlock {
  animation: scaleIn 0.5s ease-out, glow 2s infinite alternate;
}

/* Profile Banner Styles */
.profile-banner {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 200px;
  background-size: 200% 200%;
  background-position: center;
  transition: all 0.3s ease;
}

/* Mobile banner */
@media (max-width: 768px) {
  .profile-banner {
    height: 120px;
  }
}

/* Unique banner patterns */
.profile-banner-checkered {
  background-image: 
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%) !important;
  background-size: 20px 20px !important;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px !important;
}

.profile-banner-racing {
  background: repeating-linear-gradient(
    45deg,
    #ff0000,
    #ff0000 10px,
    #ffffff 10px,
    #ffffff 20px
  ) !important;
}

.profile-banner-flames {
  background: 
    radial-gradient(ellipse at bottom, #ff6b35 0%, transparent 70%),
    linear-gradient(to top, #ff0000, #ff6b35, #ffd700) !important;
}

.profile-banner-neon {
  background: 
    linear-gradient(135deg, #ff00ff 0%, #00ffff 50%, #ff00ff 100%) !important;
  filter: brightness(1.2);
}

.profile-banner-carbon {
  background: 
    repeating-linear-gradient(
      90deg,
      #1a1a1a,
      #1a1a1a 2px,
      #2a2a2a 2px,
      #2a2a2a 4px
    ) !important;
}

.profile-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  z-index: -1;
}

/* Profile Avatar Border Styles */
.profile-avatar {
  position: relative;
  transition: all 0.3s ease;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar:hover {
  transform: scale(1.05);
}

/* Mobile avatar */
@media (max-width: 768px) {
  .profile-avatar {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }
}

/* Achievement Card Styles */
.achievement-card {
  transition: all 0.3s ease;
}

.achievement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.achievement-card.unlocked {
  border-color: var(--accent-primary);
}

.achievement-card.locked {
  opacity: 0.7;
  filter: grayscale(0.5);
}

/* XP Bar Styles */
.xp-bar {
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.xp-progress {
  transition: width 0.5s ease-out;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
}

/* Level Badge Styles */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 0 15px rgba(var(--accent-primary-rgb), 0.5);
}

/* Tier Badge Styles */
.tier-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.tier-badge.bronze {
  background: rgba(205, 127, 50, 0.2);
  color: #cd7f32;
  border: 1px solid #cd7f32;
}

.tier-badge.silver {
  background: rgba(192, 192, 192, 0.2);
  color: #c0c0c0;
  border: 1px solid #c0c0c0;
}

.tier-badge.gold {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  border: 1px solid #ffd700;
}

.tier-badge.platinum {
  background: rgba(229, 228, 226, 0.2);
  color: #e5e4e2;
  border: 1px solid #e5e4e2;
}

.tier-badge.diamond {
  background: rgba(185, 242, 255, 0.2);
  color: #b9f2ff;
  border: 1px solid #b9f2ff;
}

.tier-badge.legend {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.2), rgba(255, 215, 0, 0.2));
  color: #ffd700;
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, #ff0000, #ffd700) 1;
}

/* Reward Preview Styles */
.reward-preview {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.reward-preview:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.reward-preview.locked {
  filter: grayscale(1);
  opacity: 0.5;
}

.reward-preview.locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
}

/* Celebration Animation */
.celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
}

.celebration-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: float 3s ease-out forwards;
}

/* Settings Page - Banner/Border Options */
.banner-options, .border-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.banner-option, .border-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.banner-option:hover:not(:disabled), .border-option:hover:not(:disabled) {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.banner-option.active, .border-option.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(var(--accent-primary-rgb), 0.3);
}

.banner-option.locked, .border-option.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.banner-option .lock-indicator, .border-option .lock-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 16px;
}

.banner-preview {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.border-preview {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 3px solid var(--border);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .profile-banner {
    height: 180px;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
  }
  
  .level-badge {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .tier-badge {
    padding: 2px 8px;
    font-size: 10px;
  }
  
  .banner-options, .border-options {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
