/* ===== LEVEL SYSTEM CSS ===== */
/* Badges, ranks, and level UI components */

/* ===== RANK BADGE ===== */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Rank tiers */
.rank-badge--rookie {
  background: rgba(156, 163, 175, 0.15);
  border: 1px solid rgba(156, 163, 175, 0.4);
  color: #9ca3af;
}

.rank-badge--bronze {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
  border: 1px solid rgba(205, 127, 50, 0.5);
  color: #cd7f32;
  box-shadow: 0 0 10px rgba(205, 127, 50, 0.2);
}

.rank-badge--silver {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
  border: 1px solid rgba(192, 192, 192, 0.5);
  color: #e5e5e5;
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.2);
}

.rank-badge--gold {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.rank-badge--platinum {
  background: linear-gradient(135deg, rgba(229, 228, 226, 0.15), rgba(229, 228, 226, 0.08));
  border: 1px solid rgba(229, 228, 226, 0.5);
  color: #e5e4e2;
  box-shadow: 0 0 15px rgba(229, 228, 226, 0.2);
}

.rank-badge--diamond {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(6, 182, 212, 0.5);
  color: #06b6d4;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.rank-badge--master {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(236, 72, 153, 0.5);
  color: #ec4899;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

.rank-badge--legend {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #8b5cf6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.rank-badge--mythic {
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.2),
    rgba(6, 182, 212, 0.2),
    rgba(236, 72, 153, 0.2)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
  animation: mythic-glow 3s ease-in-out infinite;
}

.rank-badge--mythic::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4, #ec4899, #fbbf24, #8b5cf6);
  background-size: 300% 100%;
  animation: rainbow-border 3s linear infinite;
  z-index: -1;
}

@keyframes rainbow-border {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

@keyframes mythic-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4),
                0 0 40px rgba(6, 182, 212, 0.2);
  }
  33% {
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.4),
                0 0 40px rgba(236, 72, 153, 0.2);
  }
  66% {
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.4),
                0 0 40px rgba(139, 92, 246, 0.2);
  }
}

/* ===== HEXAGONAL LEVEL BADGE ===== */
.level-hex {
  position: relative;
  width: 60px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: white;
}

.level-hex::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--rank-color, var(--neon-purple));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.level-hex::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.level-hex-value {
  position: relative;
  z-index: 1;
}

/* ===== CIRCULAR LEVEL BADGE ===== */
.level-circle {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  background: var(--gradient-neon);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.level-circle::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient-neon);
  z-index: -1;
  opacity: 0.5;
  animation: level-pulse 2s ease-in-out infinite;
}

@keyframes level-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.3; }
}

/* ===== XP NUMBER ANIMATION ===== */
.xp-animated {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: all 0.3s ease;
}

.xp-animated.counting {
  animation: xp-count 0.3s ease-out;
}

@keyframes xp-count {
  0% { transform: scale(1.2); color: var(--neon-green); }
  100% { transform: scale(1); }
}

/* XP gained popup */
.xp-gain-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26, 29, 46, 0.95);
  border: 2px solid var(--neon-green);
  border-radius: 16px;
  padding: 1.5rem 2.5rem;
  text-align: center;
  z-index: 10001;
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.4);
  animation: xp-popup 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes xp-popup {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.xp-gain-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.xp-gain-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.xp-gain-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ===== STREAK BADGE ===== */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(239, 68, 68, 0.15));
  border: 1px solid rgba(251, 146, 60, 0.4);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fb923c;
}

.streak-badge i {
  animation: flame-flicker 0.5s ease-in-out infinite alternate;
}

@keyframes flame-flicker {
  from { transform: scale(1) rotate(-5deg); }
  to { transform: scale(1.1) rotate(5deg); }
}

/* ===== REWARD UNLOCK BADGE ===== */
.reward-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 12px;
  transition: all 0.3s ease;
}

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

.reward-badge--unlocked {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(6, 182, 212, 0.1));
  border-color: rgba(34, 197, 94, 0.4);
}

.reward-badge:hover:not(.reward-badge--locked) {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.reward-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-neon);
  border-radius: 10px;
  font-size: 1.25rem;
  color: white;
}

.reward-info {
  flex: 1;
}

.reward-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.reward-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reward-level {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neon-purple-light);
  background: rgba(139, 92, 246, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

/* ===== DAILY BONUS BUTTON ===== */
.daily-bonus-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(6, 182, 212, 0.1));
  border: 2px solid rgba(34, 197, 94, 0.4);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.daily-bonus-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 60%
  );
  animation: shine 3s linear infinite;
}

@keyframes shine {
  from { transform: translateX(-100%) rotate(45deg); }
  to { transform: translateX(100%) rotate(45deg); }
}

.daily-bonus-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
}

.daily-bonus-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-style: dashed;
}

.daily-bonus-btn:disabled::before {
  animation: none;
}

.daily-bonus-icon {
  font-size: 2rem;
  animation: daily-bounce 1s ease-in-out infinite;
}

@keyframes daily-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.daily-bonus-info {
  flex: 1;
  text-align: left;
}

.daily-bonus-title {
  font-weight: 700;
  color: var(--neon-green);
  font-size: 1rem;
}

.daily-bonus-xp {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== LEADERBOARD XP STYLING ===== */
.lb-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.lb-xp-badge i {
  color: var(--neon-purple-light);
  font-size: 0.75rem;
}

/* ===== PROFILE LEVEL DISPLAY ===== */
.profile-level-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--gradient-card);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  margin-bottom: 1.5rem;
}

.profile-level-badge {
  flex-shrink: 0;
}

.profile-level-info {
  flex: 1;
  min-width: 0;
}

.profile-level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.profile-level-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.profile-level-xp {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== STATS GRID FOR PROFILE ===== */
.level-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.level-stat-item {
  text-align: center;
  padding: 0.75rem;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 10px;
}

.level-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--neon-purple-light);
}

.level-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .level-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-level-section {
    flex-direction: column;
    text-align: center;
  }

  .profile-level-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-width: 480px) {
  .level-hex {
    width: 50px;
    height: 43px;
    font-size: 1rem;
  }

  .level-circle {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .rank-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
}
