/* ============================================
   GAMIFICATION UI STYLES
============================================ */

.gamification-panel {
  background: linear-gradient(135deg, #1a1f2e 0%, #161b22 100%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gamification-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.score-display,
.streak-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 120px;
  position: relative;
}

.score-display .material-symbols-outlined {
  color: #ffd700;
  font-size: 2rem;
}

.streak-display .material-symbols-outlined {
  color: #ff6b35;
  font-size: 2rem;
}

.score-info,
.streak-info {
  display: flex;
  flex-direction: column;
}

.score-label,
.streak-label {
  font-size: 0.7rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value,
.streak-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #e6edf3;
  transition: all 0.3s ease;
}

.score-bump {
  animation: scoreBump 0.5s ease;
}

@keyframes scoreBump {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
    color: #ffd700;
  }
}

.streak-active {
  color: #ff6b35 !important;
  animation: streakPulse 0.6s ease;
}

@keyframes streakPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.settings-toggle {
  margin-left: auto;
}

.icon-btn {
  background: transparent;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.5rem;
  color: #e6edf3;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #21262d;
  border-color: #58a6ff;
}

.gamification-settings {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
  transition: all 0.3s ease;
}

.setting-item {
  margin: 0.5rem 0;
}

.setting-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #e6edf3;
  font-size: 0.9rem;
}

.setting-item input[type="checkbox"] {
  cursor: pointer;
}

.timer-bar {
  margin-top: 1rem;
  background: #0d1117;
  border-radius: 8px;
  height: 32px;
  position: relative;
  overflow: hidden;
  border: 1px solid #30363d;
  transition: all 0.3s ease;
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #238636 0%, #2ea043 100%);
  transition: width 1s linear, background 0.3s;
  border-radius: 8px;
}

.timer-fill.timer-warning {
  background: linear-gradient(90deg, #ff6b35 0%, #ff4500 100%);
  animation: timerPulse 0.5s infinite;
}

@keyframes timerPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: bold;
  font-size: 0.9rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* Answer Feedback */
.answer-feedback {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.answer-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

.answer-feedback .material-symbols-outlined {
  font-size: 1.5rem;
}

.feedback-text {
  font-weight: 500;
}

/* Floating Points */
.floating-points {
  position: absolute;
  top: -20px;
  right: 0;
  color: #ffd700;
  font-weight: bold;
  font-size: 1.2rem;
  animation: floatUp 1s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px);
  }
}

/* Streak Milestone */
.streak-milestone {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, #ff6b35 0%, #ff4500 100%);
  color: #fff;
  padding: 2rem 3rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.streak-milestone.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.streak-milestone .material-symbols-outlined {
  font-size: 3rem;
  animation: fireAnimation 0.6s infinite alternate;
}

@keyframes fireAnimation {
  0% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(5deg);
  }
}

.streak-milestone div {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Progress Pulse Animation */
.progress-pulse {
  animation: progressPulse 0.6s ease;
}

@keyframes progressPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(35, 134, 54, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(35, 134, 54, 0.6);
  }
}

/* Achievement Unlock */
.achievements-display {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 320px;
}

.achievement-unlock {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #1f6feb 0%, #1a56db 100%);
  color: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(31, 111, 235, 0.4);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-unlock.show {
  transform: translateX(0);
  opacity: 1;
}

.achievement-icon {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.achievement-icon .material-symbols-outlined {
  font-size: 2rem;
  animation: achievementSpin 1s ease;
}

@keyframes achievementSpin {
  0% {
    transform: rotate(0deg) scale(0);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.achievement-content {
  flex: 1;
}

.achievement-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.achievement-name {
  font-size: 1.1rem;
  font-weight: bold;
}

/* Final Score Card */
.final-score-card {
  background: linear-gradient(135deg, #1a1f2e 0%, #161b22 100%);
  border: 2px solid #ffd700;
  border-radius: 16px;
  padding: 2rem;
  margin: 1rem 0;
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.2);
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.final-score-card.show {
  transform: scale(1);
  opacity: 1;
}

.final-score-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.final-score-header .material-symbols-outlined {
  color: #ffd700;
  font-size: 3rem;
  animation: trophySpin 2s ease infinite;
}

@keyframes trophySpin {
  0%,
  100% {
    transform: rotate(-5deg);
  }
  50% {
    transform: rotate(5deg);
  }
}

.final-score-header h3 {
  color: #e6edf3;
  margin: 0;
  font-size: 1.8rem;
}

.final-score-stats {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  flex: 1;
  min-width: 80px;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.performance-message {
  text-align: center;
  font-size: 1.2rem;
  color: #e6edf3;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

/* Game Notifications */
.game-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #1f6feb 0%, #1a56db 100%);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(31, 111, 235, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  font-weight: 500;
  font-size: 0.95rem;
}

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

.game-notification .notification-icon {
  font-size: 1.3rem;
}

.game-notification.notification-streak {
  background: linear-gradient(135deg, #ff6b35 0%, #ff4500 100%);
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
}

.game-notification.notification-perfect {
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  color: #1a1f2e;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.game-notification.notification-levelup {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  box-shadow: 0 4px 20px rgba(35, 134, 54, 0.4);
}

.game-notification.notification-error {
  background: linear-gradient(135deg, #da3633 0%, #b62324 100%);
  box-shadow: 0 4px 20px rgba(218, 54, 51, 0.4);
}

.game-notification.notification-info {
  background: linear-gradient(135deg, #58a6ff 0%, #388bfd 100%);
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.4);
}

/* Achievement Toast */
.achievement-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, #1f6feb 0%, #1a56db 100%);
  color: #fff;
  padding: 1.25rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(31, 111, 235, 0.4);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  z-index: 9999;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  max-width: 360px;
}

.achievement-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.achievement-toast.rarity-common {
  background: linear-gradient(135deg, #30363d 0%, #21262d 100%);
  border: 1px solid #6e7681;
}

.achievement-toast.rarity-uncommon {
  background: linear-gradient(135deg, #238636 0%, #1a7f37 100%);
}

.achievement-toast.rarity-rare {
  background: linear-gradient(135deg, #1f6feb 0%, #1a56db 100%);
}

.achievement-toast.rarity-legendary {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a1f2e;
}

.achievement-toast-icon {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.achievement-toast-icon .material-symbols-outlined {
  font-size: 1.75rem;
}

.achievement-toast-content {
  flex: 1;
}

.achievement-toast-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.achievement-toast-name {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.achievement-toast-desc {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.achievement-toast-xp {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffd700;
}

.achievement-toast.rarity-legendary .achievement-toast-xp {
  color: #1a1f2e;
}

/* Quiz Results Summary */
.quiz-results-summary {
  background: linear-gradient(135deg, #1a1f2e 0%, #161b22 100%);
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  text-align: center;
}

.quiz-results-summary h3 {
  color: #ffd700;
  margin: 0 0 1.25rem 0;
  font-size: 1.5rem;
}

.results-grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.result-item {
  text-align: center;
}

.result-item .result-value {
  font-size: 1.75rem;
  font-weight: bold;
  color: #e6edf3;
  display: block;
}

.result-item .result-label {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
}

.perfect-badge,
.levelup-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  margin: 0.5rem;
}

.perfect-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a1f2e;
}

.levelup-badge {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  color: #fff;
}

.results-actions {
  margin-top: 1.25rem;
}

.btn-leaderboard {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #1f6feb 0%, #1a56db 100%);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-leaderboard:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(31, 111, 235, 0.4);
}

/* Practice Mode Results Summary */
.quiz-results-summary.practice-mode-results {
  border: 2px solid #22c55a;
  background: linear-gradient(135deg, #0d2818 0%, #0a1f14 100%);
}

.quiz-results-summary.practice-mode-results h3 {
  color: #22c55a;
}

.quiz-results-summary .practice-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #22c55a, #16a34a);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.quiz-results-summary .practice-badge .material-symbols-outlined {
  font-size: 1.1rem;
}

.quiz-results-summary .practice-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  color: #8b949e;
  font-size: 0.85rem;
}

.quiz-results-summary .practice-note .material-symbols-outlined {
  color: #22c55a;
  font-size: 1.1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .gamification-panel {
    padding: 0.75rem;
  }

  .gamification-header {
    gap: 0.5rem;
  }

  .score-display,
  .streak-display {
    min-width: 100px;
  }

  .score-value,
  .streak-value {
    font-size: 1.2rem;
  }

  .score-display .material-symbols-outlined,
  .streak-display .material-symbols-outlined {
    font-size: 1.5rem;
  }

  .achievements-display {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .achievement-unlock {
    padding: 0.75rem;
  }

  .achievement-icon {
    width: 40px;
    height: 40px;
  }

  .achievement-icon .material-symbols-outlined {
    font-size: 1.5rem;
  }

  .achievement-name {
    font-size: 0.95rem;
  }

  .streak-milestone {
    padding: 1.5rem 2rem;
  }

  .streak-milestone .material-symbols-outlined {
    font-size: 2rem;
  }

  .streak-milestone div {
    font-size: 1.2rem;
  }

  .final-score-card {
    padding: 1.5rem;
  }

  .final-score-header .material-symbols-outlined {
    font-size: 2rem;
  }

  .final-score-header h3 {
    font-size: 1.4rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .performance-message {
    font-size: 1rem;
  }
  
  .game-notification {
    left: 10px;
    right: 10px;
    transform: translateX(0) translateY(-20px);
    width: auto;
    max-width: calc(100% - 20px);
    text-align: center;
    justify-content: center;
  }
  
  .game-notification.show {
    transform: translateX(0) translateY(0);
  }
  
  .achievement-toast {
    left: 10px;
    right: 10px;
    bottom: 20px;
    max-width: none;
  }
  
  .results-grid {
    gap: 1rem;
  }
  
  .result-item .result-value {
    font-size: 1.4rem;
  }
}
