/**
 * Mystery Gifts Styles - Crystal Orb Animation
 * Spawns INSIDE #app container (position:absolute)
 * Inspired by oracle cat glow/float effects
 */

/* ===== MYSTERY ORB =====
 * Positioned with position:absolute inside #app
 * #app must have position:relative for this to work
 */

.mystery-orb {
  position: absolute;
  width: 80px;
  height: 80px;
  z-index: 50;  /* Above content, below modals */
  cursor: pointer;
  transition: all 0.3s ease;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%);  /* Center on coordinates */
}

.orb-inner {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 50%;
  
  /* Same glow effect as oracle cat */
  filter: drop-shadow(0 0 15px #a855f7) 
          drop-shadow(0 0 25px #8b5cf6) 
          drop-shadow(0 0 35px #c084fc);
  
  /* Combined animations - bounce + glow + float */
  animation: 
    mysteryBounce 2s ease-in-out infinite,
    mysteryGlow 3s ease-in-out infinite,
    mysteryFloat 4s ease-in-out infinite;
}

.orb-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  line-height: 1;
  user-select: none;
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.8);
}

.orb-sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(168, 85, 247, 0.2) 40%,
    transparent 70%
  );
  animation: sparkleRotate 6s linear infinite;
}

/* Hover state - grows and intensifies glow */
.mystery-orb:hover .orb-inner {
  filter: drop-shadow(0 0 30px #f0abfc) 
          drop-shadow(0 0 50px #c084fc) 
          drop-shadow(0 0 70px #a78bfa);
}

.mystery-orb:hover {
  transform: scale(1.15);
}

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

/* Bounce - "waiting to be opened" anticipation */
@keyframes mysteryBounce {
  0%, 100% { 
    transform: translateY(0) scale(1); 
  }
  25% { 
    transform: translateY(-12px) scale(1.05); 
  }
  50% { 
    transform: translateY(0) scale(1); 
  }
  75% { 
    transform: translateY(-6px) scale(1.02); 
  }
}

/* Glow pulse - mystical shimmer */
@keyframes mysteryGlow {
  0%, 100% { 
    filter: drop-shadow(0 0 15px #a855f7) 
            drop-shadow(0 0 25px #8b5cf6) 
            drop-shadow(0 0 35px #c084fc); 
  }
  50% { 
    filter: drop-shadow(0 0 40px #f0abfc) 
            drop-shadow(0 0 60px #c084fc) 
            drop-shadow(0 0 80px #a78bfa)
            drop-shadow(0 0 100px #e9d5ff); 
  }
}

/* Float - subtle levitation */
@keyframes mysteryFloat {
  0%, 100% { 
    transform: translateY(0) rotate(0deg); 
  }
  33% { 
    transform: translateY(-10px) rotate(3deg); 
  }
  66% { 
    transform: translateY(-5px) rotate(-3deg); 
  }
}

/* Sparkle rotation inside orb */
@keyframes sparkleRotate {
  from { 
    transform: rotate(0deg); 
  }
  to { 
    transform: rotate(360deg); 
  }
}

/* ===== REWARD MODAL ===== */

.mystery-reward-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mystery-reward-modal.show {
  opacity: 1;
}

.mystery-reward-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.reward-content {
  position: relative;
  background: linear-gradient(135deg, 
    rgba(88, 28, 135, 0.95) 0%, 
    rgba(76, 29, 149, 0.95) 50%, 
    rgba(88, 28, 135, 0.95) 100%);
  border: 3px solid rgba(168, 85, 247, 0.8);
  border-radius: 20px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 
    0 0 40px rgba(168, 85, 247, 0.6),
    0 0 80px rgba(139, 92, 246, 0.4),
    inset 0 0 30px rgba(168, 85, 247, 0.2);
  animation: rewardAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90%;
  min-width: 320px;
}

.reward-icon {
  font-size: 64px;
  margin-bottom: 15px;
  animation: rewardIconBounce 0.6s ease-out;
  line-height: 1;
}

.reward-title {
  font-size: 22px;
  font-weight: bold;
  color: #e9d5ff;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
  line-height: 1.3;
}

.reward-amount {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, #a855f7, #f0abfc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
  animation: rewardAmountPulse 1s ease-in-out infinite;
}

.reward-subtitle {
  font-size: 14px;
  color: #c4b5fd;
  margin-bottom: 25px;
  opacity: 0.9;
}

.reward-close-btn {
  background: linear-gradient(135deg, #a855f7, #8b5cf6);
  color: white;
  border: 2px solid rgba(168, 85, 247, 0.5);
  border-radius: 12px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.reward-close-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.6);
  border-color: rgba(240, 171, 252, 0.8);
}

.reward-close-btn:active {
  transform: scale(0.98);
}

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

@keyframes rewardAppear {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(-50px);
  }
  60% {
    transform: scale(1.1) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes rewardIconBounce {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

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

/* ===== SPARKLE PARTICLES ===== */

.mystery-sparkle {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
}

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

@media (max-width: 768px) {
  .mystery-orb {
    width: 60px;
    height: 60px;
  }
  
  .orb-core {
    font-size: 45px;
  }
  
  .reward-content {
    padding: 30px 35px;
    min-width: 280px;
  }
  
  .reward-icon {
    font-size: 48px;
  }
  
  .reward-title {
    font-size: 18px;
  }
  
  .reward-amount {
    font-size: 28px;
  }
  
  .reward-subtitle {
    font-size: 12px;
  }
  
  .reward-close-btn {
    padding: 10px 24px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .mystery-orb {
    width: 50px;
    height: 50px;
  }
  
  .orb-core {
    font-size: 38px;
  }
  
  .reward-content {
    padding: 25px 30px;
    min-width: 260px;
  }
  
  .reward-icon {
    font-size: 40px;
  }
  
  .reward-title {
    font-size: 16px;
  }
  
  .reward-amount {
    font-size: 24px;
  }
}

/* ===== LIGHT THEME SUPPORT ===== */

body.light-theme .mystery-orb .orb-inner {
  filter: drop-shadow(0 0 15px #7c3aed) 
          drop-shadow(0 0 25px #6d28d9) 
          drop-shadow(0 0 35px #8b5cf6);
}

body.light-theme .mystery-orb:hover .orb-inner {
  filter: drop-shadow(0 0 30px #7c3aed) 
          drop-shadow(0 0 50px #6d28d9) 
          drop-shadow(0 0 70px #8b5cf6);
}

body.light-theme .reward-content {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.98) 0%, 
    rgba(250, 245, 255, 0.98) 50%, 
    rgba(255, 255, 255, 0.98) 100%);
  border-color: rgba(124, 58, 237, 0.8);
}

body.light-theme .reward-title {
  color: #581c87;
}

body.light-theme .reward-subtitle {
  color: #6b21a8;
}
