/* gamification.css - XP, Badges, Daily Challenges Styling */
/* Version 1.0.0 */

/* ============================================
   HEADER XP DISPLAY
   ============================================ */
.xp-header-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(91, 138, 255, 0.15);
  border: 1px solid rgba(91, 138, 255, 0.3);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
}

.xp-header-display:hover {
  background: rgba(91, 138, 255, 0.25);
  transform: scale(1.02);
}

.xp-level-badge {
  background: linear-gradient(135deg, #5b8aff, #76ddff);
  color: #000;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.75rem;
}

.xp-total {
  color: var(--text-muted, #a0a0a0);
  font-weight: 500;
}

/* ============================================
   XP POPUP
   ============================================ */
.xp-popup {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: linear-gradient(135deg, rgba(91, 138, 255, 0.95), rgba(118, 221, 255, 0.95));
  color: #000;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(91, 138, 255, 0.4);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  min-width: 220px;
  max-width: 300px;
}

.xp-popup.show {
  transform: translateX(0);
}

.xp-amount {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.xp-reason {
  font-size: 0.9rem;
  opacity: 0.85;
}

.xp-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: #000;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.xp-level-info {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  opacity: 0.7;
}

/* ============================================
   XP STATS POPUP
   ============================================ */
.xp-stats-popup {
  position: fixed;
  top: 70px;
  right: 20px;
  background: var(--bg-2, #1a1a2e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  min-width: 280px;
  max-width: 320px;
  animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xp-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-stats-header h4 {
  margin: 0;
  font-size: 1rem;
}

.xp-stats-close {
  background: none;
  border: none;
  color: var(--text-muted, #a0a0a0);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.xp-stats-close:hover {
  color: #fff;
}

.xp-stats-body {
  padding: 1rem;
}

.xp-stats-level-num {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #5b8aff, #76ddff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.xp-stats-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.xp-stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5b8aff, #76ddff);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.xp-stats-xp {
  font-size: 0.8rem;
  color: var(--text-muted, #a0a0a0);
}

.xp-stats-total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

.xp-stats-recent {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-stats-recent h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted, #a0a0a0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.xp-transaction {
  font-size: 0.85rem;
  padding: 0.25rem 0;
  color: #00d4aa;
}

/* ============================================
   LEVEL UP MODAL
   ============================================ */
.level-up-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.level-up-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 3px solid #ffd700;
  border-radius: 24px;
  padding: 3rem;
  text-align: center;
  animation: scaleIn 0.3s ease;
  max-width: 90vw;
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.level-up-stars {
  color: #ffd700;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  margin-bottom: 0.5rem;
}

.level-up-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.level-up-content h2 {
  color: #ffd700;
  font-size: 2rem;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.new-level {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #5b8aff, #76ddff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.level-up-content p {
  color: var(--text-muted, #a0a0a0);
  margin: 0 0 1.5rem 0;
}

.level-up-btn {
  background: linear-gradient(135deg, #5b8aff, #76ddff);
  color: #000;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

/* ============================================
   BADGE UNLOCK NOTIFICATION
   ============================================ */
.badge-unlock-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 193, 7, 0.95));
  color: #000;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  max-width: 320px;
}

.badge-unlock-notification.show {
  transform: translateX(0);
}

.badge-unlock-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge-unlock-content .badge-icon {
  font-size: 2.5rem;
}

.badge-unlock-content .badge-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.badge-unlock-content .badge-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.badge-unlock-content .badge-desc {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

/* ============================================
   BADGES GRID (My Library)
   ============================================ */
.badge-category {
  margin-bottom: 2rem;
}

.badge-category-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted, #a0a0a0);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}

.badge-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s ease;
}

.badge-item.unlocked {
  background: rgba(91, 138, 255, 0.1);
  border-color: rgba(91, 138, 255, 0.3);
}

.badge-item.locked {
  opacity: 0.5;
}

.badge-item:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 138, 255, 0.5);
}

.badge-item-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.badge-item-name {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================
   DAILY CHALLENGE CARD
   ============================================ */
.daily-challenge-card {
  background: linear-gradient(135deg, rgba(91, 138, 255, 0.1), rgba(118, 221, 255, 0.05));
  border: 1px solid rgba(91, 138, 255, 0.3);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem auto;
  max-width: 500px;
  transition: all 0.3s ease;
}

.daily-challenge-card.completed {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.1), rgba(0, 255, 136, 0.05));
  border-color: rgba(0, 212, 170, 0.3);
}

.challenge-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.challenge-icon {
  font-size: 1.25rem;
}

.challenge-title {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #5b8aff);
}

.challenge-timer {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted, #a0a0a0);
}

.challenge-text {
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  font-weight: 500;
}

.challenge-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.challenge-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.challenge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5b8aff, #76ddff);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.challenge-bar-fill.complete {
  background: linear-gradient(90deg, #00d4aa, #00ff88);
}

.challenge-count {
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}

.challenge-reward {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted, #a0a0a0);
}

.challenge-complete {
  margin-top: 0.75rem;
  color: #00d4aa;
  font-weight: 600;
}

/* ============================================
   CHALLENGE CELEBRATION
   ============================================ */
.challenge-celebration {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #00d4aa, #00ff88);
  color: #000;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 212, 170, 0.4);
  z-index: 10000;
  text-align: center;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.challenge-celebration.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.celebration-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.celebration-content h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
}

.celebration-content p {
  margin: 0;
  opacity: 0.8;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .xp-header-display {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
  }

  .xp-level-badge {
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
  }

  .xp-popup {
    left: 20px;
    right: 20px;
    bottom: 80px;
    max-width: none;
  }

  .badge-unlock-notification {
    left: 20px;
    right: 20px;
    max-width: none;
  }

  .daily-challenge-card {
    margin: 1rem;
    padding: 1rem;
  }

  .level-up-content {
    padding: 2rem;
  }

  .level-up-icon {
    font-size: 3rem;
  }

  .new-level {
    font-size: 2.5rem;
  }

  .xp-stats-popup {
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .badge-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .badge-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .challenge-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .challenge-count {
    text-align: left;
  }
}
