/* ========================================
   EcoSmartPlay - Games
   Game-specific styles
   ======================================== */

/* Quiz Game */
.quiz-option {
  width: 100%;
  text-align: right;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
  cursor: pointer;
}

.quiz-option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
}

.quiz-option.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.quiz-option.dimmed {
  opacity: 0.4;
}

.quiz-option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Memory Game Cards */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .memory-grid { grid-template-columns: repeat(4, 1fr); }
}

.memory-card {
  aspect-ratio: 1;
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  perspective: 600px;
}

.memory-card:active:not(.flipped):not(.matched) {
  transform: scale(0.95);
}

.memory-card.flipped,
.memory-card.matched {
  cursor: default;
}

.memory-card-front,
.memory-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  backface-visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.memory-card-back {
  background: linear-gradient(135deg, rgba(20,184,166,0.1), rgba(16,185,129,0.1));
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.memory-card-back:hover {
  border-color: rgba(20, 184, 166, 0.3);
}

.memory-card-back .card-emoji {
  font-size: 2rem;
  opacity: 0.25;
}

.memory-card-front {
  transform: rotateY(90deg);
  opacity: 0;
}

.memory-card.flipped .memory-card-front,
.memory-card.matched .memory-card-front {
  transform: rotateY(0);
  opacity: 1;
}

.memory-card.flipped .memory-card-back,
.memory-card.matched .memory-card-back {
  transform: rotateY(-90deg);
  opacity: 0;
}

.memory-card-front.matched-style {
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid rgba(16, 185, 129, 0.3);
}

.memory-card-front.flipped-style {
  background: rgba(20, 184, 166, 0.15);
  border: 2px solid rgba(20, 184, 166, 0.3);
}

.memory-card-front .card-emoji {
  font-size: 3rem;
  line-height: 1;
}

.memory-card-front .card-name {
  font-size: 0.6875rem;
  margin-top: 0.375rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .memory-card-front .card-name { font-size: 0.75rem; }
}

/* Waste Sort Game */
.sort-bins {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .sort-bins { gap: 0.75rem; }
}

.sort-bin {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.25rem;
  border-radius: 1rem;
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.sort-bin:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sort-bin:active {
  transform: scale(0.95);
}

.sort-bin.correct-flash {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  animation: scalePress 0.4s ease;
}

.sort-bin.wrong-flash {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.sort-bin-emoji {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.sort-bin-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.sort-current-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  border-radius: 1.5rem;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.12);
  text-align: center;
  margin-bottom: 1rem;
}

.sort-current-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.sort-current-name {
  font-size: 1rem;
  font-weight: 700;
}

.sort-current-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* Game Result Screen */
.game-result {
  text-align: center;
  padding: 1.5rem;
}

.game-result-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: scaleIn 0.4s ease-out 0.2s both;
}

.game-result-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.game-result-stats .stat-divider {
  width: 1px;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.1);
}

/* Back Button */
.back-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: color 0.15s ease;
  margin-bottom: 1rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.back-btn:hover {
  color: var(--foreground);
}

/* Scan Categories Grid */
.scan-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .scan-categories { grid-template-columns: repeat(3, 1fr); }
}

.scan-cat-btn {
  padding: 1rem;
  border-radius: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
  cursor: pointer;
}

.scan-cat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.25);
}

.scan-cat-btn.selected {
  outline: 2px solid;
  outline-offset: 2px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Scan Area */
.scan-area {
  position: relative;
  width: 12rem;
  height: 12rem;
  border-radius: 1.5rem;
  border: 2px dashed rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.05);
  overflow: hidden;
}

@media (min-width: 640px) {
  .scan-area { width: 14rem; height: 14rem; }
}

.scan-area.scanning .scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0.25rem;
  background: linear-gradient(to right, transparent, #34d399, transparent);
  animation: scan-line 1.5s ease-in-out infinite alternate;
}

.scan-area.complete {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

/* Eco Tips */
.eco-tip-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  transition: background-color 0.15s ease;
}

.eco-tip-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Leaderboard Item */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  transition: background-color 0.15s ease;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-item.is-me {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.leaderboard-item.top-3 {
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
}

/* Profile Badges */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.badge-item.earned:hover {
  transform: translateY(-2px);
}

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

.badge-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.375rem;
}

.badge-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.badge-label {
  font-size: 0.625rem;
  line-height: 1.3;
  font-weight: 500;
}

/* Game Card (in challenges games list) */
.game-card {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  text-align: right;
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.25);
}

.game-card:active {
  transform: scale(0.97);
}

/* Challenge Card */
.challenge-card {
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.challenge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Stagger animations for children */
.stagger-children > * {
  opacity: 0;
  animation: card-stagger-in 0.4s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.48s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.56s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.64s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.72s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.88s; }
