/* Popup and Toast Styles */

/* ==================== TOAST CONTAINER ==================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

/* Mobile: Bottom position */
@media (max-width: 640px) {
  .toast-container {
    top: auto;
    bottom: 20px;
    left: 20px;
    right: 20px;
  }
}

/* ==================== TOAST ==================== */

.gamification-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

@media (max-width: 640px) {
  .gamification-toast {
    transform: translateY(100%);
  }
}

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

@media (max-width: 640px) {
  .gamification-toast.toast-show {
    transform: translateY(0);
  }
}

.gamification-toast.toast-hide {
  transform: translateX(100%);
  opacity: 0;
}

@media (max-width: 640px) {
  .gamification-toast.toast-hide {
    transform: translateY(100%);
  }
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-text {
  display: flex;
  flex-direction: column;
}

.toast-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
}

.toast-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Toast Types */
.toast-xp {
  border-left: 4px solid #f59e0b;
}

.toast-xp .toast-icon {
  animation: starPulse 0.5s ease;
}

@keyframes starPulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.toast-streak {
  border-left: 4px solid #ef4444;
}

.toast-streak .toast-icon {
  animation: firePulse 0.5s ease infinite;
}

@keyframes firePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.toast-milestone {
  border-left: 4px solid #a855f7;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(88, 28, 135, 0.3));
}

.toast-generic {
  border-left: 4px solid #6366f1;
}

/* ==================== POPUP OVERLAY ==================== */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.popup-overlay.popup-show {
  opacity: 1;
}

.popup-content {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.popup-overlay.popup-show .popup-content {
  transform: scale(1);
}

/* ==================== BADGE POPUP ==================== */

.badge-popup {
  text-align: center;
}

.badge-popup-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.badge-popup-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}

.confetti-left, .confetti-right {
  font-size: 1.5rem;
  animation: confettiWave 0.5s ease infinite alternate;
}

.confetti-right {
  animation-delay: 0.25s;
}

@keyframes confettiWave {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}

.badge-popup-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.badge-popup-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.5rem;
}

.badge-popup-rarity {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.badge-popup-description {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.badge-popup-xp {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 1.5rem;
}

.badge-popup-actions {
  display: flex;
  gap: 0.75rem;
}

/* ==================== LEVEL UP POPUP ==================== */

.levelup-popup {
  text-align: center;
}

.levelup-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.levelup-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}

.levelup-level {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.levelup-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 1rem;
}

.levelup-message {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

.levelup-reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

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

.reward-text {
  font-size: 0.875rem;
  color: #f59e0b;
}

.levelup-actions {
  display: flex;
  justify-content: center;
}

/* ==================== STREAK POPUP ==================== */

.streak-popup {
  text-align: center;
}

.streak-popup-header {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: fireGrow 0.5s ease;
}

@keyframes fireGrow {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.streak-popup-title {
  font-size: 2rem;
  font-weight: 800;
  color: #f59e0b;
  margin-bottom: 0.5rem;
}

.streak-popup-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.streak-popup-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.streak-popup-xp {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 1.5rem;
}

.streak-popup-actions {
  display: flex;
  justify-content: center;
}

/* ==================== LOGIN POPUP ==================== */

.login-popup {
  text-align: center;
}

.login-popup-header {
  margin-bottom: 0.5rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

.login-popup-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

.login-benefits {
  text-align: left;
  margin-bottom: 1.5rem;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: #f8fafc;
}

.benefit-check {
  color: #22c55e;
  font-weight: 600;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
}

.login-btn:hover {
  transform: translateY(-2px);
}

.google-btn {
  background: #fff;
  color: #333;
}

.google-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kakao-btn {
  background: #fee500;
  color: #000;
}

.apple-btn {
  background: #000;
  color: #fff;
}

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

.login-guest {
  margin-top: 1rem;
}

.guest-link {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.guest-link:hover {
  color: #f8fafc;
}

/* ==================== POPUP BUTTONS ==================== */

.popup-btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.popup-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.popup-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.popup-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==================== CONFETTI ==================== */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10002;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Different shapes */
.confetti-piece:nth-child(odd) {
  border-radius: 50%;
}

.confetti-piece:nth-child(even) {
  border-radius: 0;
  transform: rotate(45deg);
}

/* ==================== SPARKLE EFFECT ==================== */

.sparkle-effect {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle-effect::before,
.sparkle-effect::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
  animation: sparkle 1s ease-out forwards;
}

@keyframes sparkle {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ==================== ANIMATIONS ==================== */

.bounce-animation {
  animation: popupBounce 0.6s ease;
}

@keyframes popupBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.scale-animation {
  animation: popupScale 0.5s ease;
}

@keyframes popupScale {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 640px) {
  .popup-content {
    padding: 1.5rem;
    margin: 0.5rem;
  }

  .badge-popup-emoji,
  .levelup-level,
  .streak-popup-header {
    font-size: 3rem;
  }

  .badge-popup-name,
  .levelup-name {
    font-size: 1.25rem;
  }

  .badge-popup-actions,
  .levelup-actions,
  .streak-popup-actions {
    flex-direction: column;
  }

  .popup-btn {
    width: 100%;
  }
}
