/**
 * Gamification Components Styles
 * XP Counter, Levels, Achievements Modal
 */

/* ═══════════════════════════════════════════════════════════════════════════ */
/* XP PROGRESS HEADER */
/* ═══════════════════════════════════════════════════════════════════════════ */

.xp-progress-header {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  border-radius: 12px;
  padding: 16px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 150, 100, 0.2);
  margin-bottom: 20px;
}

.xp-header-content {
  display: flex;
  gap: 20px;
  align-items: center;
}

.xp-level-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.xp-current-level {
  position: relative;
}

.xp-level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.xp-level-badge:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.xp-level-badge.rare {
  background: linear-gradient(135deg, rgba(100, 200, 255, 0.2), rgba(100, 150, 255, 0.2));
  border-color: rgba(100, 200, 255, 0.5);
}

.xp-level-badge.epic {
  background: linear-gradient(135deg, rgba(200, 100, 255, 0.2), rgba(150, 100, 255, 0.2));
  border-color: rgba(200, 100, 255, 0.5);
}

.xp-level-badge.legendary {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
  border-color: rgba(255, 215, 0, 0.5);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
}

.xp-level-number {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.xp-level-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  opacity: 0.9;
  text-align: center;
}

.xp-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xp-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.xp-stat-label {
  font-size: 11px;
  opacity: 0.8;
  min-width: 40px;
}

.xp-stat-value {
  font-size: 16px;
  font-weight: 700;
}

.xp-progress-section {
  flex: 1;
  min-width: 200px;
}

.xp-progress-bar-container {
  position: relative;
  margin-bottom: 6px;
}

.xp-progress-bar {
  position: relative;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.xp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3));
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.xp-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer-progress 1.5s infinite;
}

@keyframes shimmer-progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.xp-progress-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.xp-level-range {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* LEVEL BADGE COMPONENT */
/* ═══════════════════════════════════════════════════════════════════════════ */

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.level-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0, 150, 100, 0.3);
}

.level-badge.level-badge-rare {
  background: linear-gradient(135deg, #64c8ff, #6496ff);
}

.level-badge.level-badge-epic {
  background: linear-gradient(135deg, #c864ff, #9664ff);
}

.level-badge.level-badge-legendary {
  background: linear-gradient(135deg, #ffd700, #ffa500);
  animation: pulse-legendary 1s ease-in-out infinite;
}

@keyframes pulse-legendary {
  0%, 100% { box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 4px 16px rgba(255, 215, 0, 0.6); }
}

.level-badge-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  color: white;
}

.level-badge-number {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.level-badge-icon {
  font-size: 16px;
}

.level-badge-name {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ACHIEVEMENTS MODAL */
/* ═══════════════════════════════════════════════════════════════════════════ */

.achievements-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
}

.achievements-modal {
  background: var(--bg-primary);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

.achievements-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.achievements-title-section h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #f0f0f4);
}

.achievements-progress {
  font-size: 13px;
  color: var(--text-secondary, #9aa0b0);
  margin: 4px 0 0 0;
}

.achievements-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.achievements-modal-close:hover {
  background: var(--color-danger-light);
}

.achievements-filters {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-wrap: wrap;
}

.achievements-filter-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary, #f0f0f4);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.achievements-filter-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.achievements-filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.achievements-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  cursor: pointer;
  color: var(--text-primary, #f0f0f4);
}

.achievement-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 150, 100, 0.1);
}

.achievement-card.locked {
  opacity: 0.6;
}

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

.achievement-image {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.achievement-card.unlocked .achievement-image {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
}

.achievement-icon {
  font-size: 32px;
}

.achievement-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.achievement-content {
  flex: 1;
  min-width: 0;
  margin-bottom: 8px;
}

.achievement-name {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary, #f0f0f4);
  line-height: 1.3;
}

.achievement-description {
  font-size: 11px;
  color: var(--text-secondary, #9aa0b0);
  margin: 0 0 4px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.achievement-reward {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.achievement-share-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
}

.achievement-card:hover .achievement-share-btn {
  opacity: 1;
}

.achievement-share-btn:hover {
  background: white;
  transform: scale(1.1);
}

.achievements-progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  margin: 12px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  transition: width 0.6s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* XP NOTIFICATION TOAST */
/* ═══════════════════════════════════════════════════════════════════════════ */

.xp-notification-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 150, 100, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  animation: slideInRight 0.3s ease-out;
  transform: translateX(400px);
  transition: transform 0.3s ease-out;
}

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

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.xp-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xp-toast-icon {
  font-size: 24px;
  animation: bounce 0.6s ease-in-out;
}

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

.xp-toast-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xp-toast-event {
  font-size: 12px;
  opacity: 0.9;
  margin: 0;
}

.xp-toast-amount {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* GAMIFICATION STATS CARD */
/* ═══════════════════════════════════════════════════════════════════════════ */

.gamification-stats-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.gamification-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.gamification-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.stat-icon {
  font-size: 24px;
  flex-shrink: 0;
}

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

.stat-label {
  font-size: 11px;
  color: var(--text-secondary, #9aa0b0);
  text-transform: uppercase;
  font-weight: 600;
  margin: 0;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2px 0 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* RESPONSIVE */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .xp-header-content {
    flex-direction: column;
    gap: 12px;
  }

  .xp-level-info {
    flex-direction: column;
    align-items: center;
    min-width: auto;
  }

  .xp-progress-section {
    width: 100%;
    min-width: auto;
  }

  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .achievements-modal {
    width: 95%;
    max-height: 90vh;
  }

  .xp-notification-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    border-radius: 12px;
  }

  .gamification-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .xp-level-badge {
    width: 70px;
    height: 70px;
  }

  .xp-level-number {
    font-size: 24px;
  }

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .achievement-card {
    padding: 10px;
  }

  .achievement-image {
    width: 50px;
    height: 50px;
  }

  .achievement-icon {
    font-size: 28px;
  }
}
