/**
 * Mystery Chest Styles
 * Styling for chest display, opening animations, and loot reveals
 */

/* ===== CHEST OPENING OVERLAY ===== */
.chest-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(20, 20, 40, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
}

/* ===== CHEST CONTAINER ===== */
.chest-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chest-emoji {
  font-size: 8rem;
  cursor: pointer;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.chest-emoji.idle {
  animation: chestFloat 2s ease-in-out infinite;
}

.chest-emoji.shaking {
  animation: chestShake 0.1s ease-in-out infinite;
}

.chest-emoji.glowing {
  animation: chestGlow 0.5s ease-in-out infinite;
}

.chest-emoji.opening {
  animation: chestOpen 0.5s ease-out forwards;
}

/* ===== CHEST GLOW EFFECT ===== */
.chest-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.chest-glow.bronze { background: radial-gradient(circle, rgba(205, 127, 50, 0.4) 0%, transparent 70%); }
.chest-glow.silver { background: radial-gradient(circle, rgba(192, 192, 192, 0.4) 0%, transparent 70%); }
.chest-glow.golden { background: radial-gradient(circle, rgba(255, 215, 0, 0.5) 0%, transparent 70%); }
.chest-glow.legendary { background: radial-gradient(circle, rgba(224, 64, 251, 0.5) 0%, transparent 70%); }

.chest-glow.active {
  animation: glowPulse 1s ease-in-out infinite;
}

.chest-glow.burst {
  animation: glowBurst 0.5s ease-out forwards;
}

/* ===== CHEST NAME & MESSAGE ===== */
.chest-name {
  font-size: 1.8rem;
  font-weight: bold;
  margin-top: 20px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.chest-name.bronze { color: #CD7F32; }
.chest-name.silver { color: #C0C0C0; }
.chest-name.golden { color: #FFD700; text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.chest-name.legendary { color: #E040FB; text-shadow: 0 0 20px rgba(224, 64, 251, 0.5); }

.chest-message {
  font-size: 1.2rem;
  color: #aaa;
  margin-top: 10px;
  text-align: center;
  max-width: 300px;
}

.chest-tap-hint {
  font-size: 1rem;
  color: #666;
  margin-top: 30px;
  animation: pulse 2s ease-in-out infinite;
}

/* ===== LOOT REVEAL ===== */
.loot-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loot-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 20px 40px;
  display: flex;
  align-items: center;
  gap: 15px;
  animation: lootAppear 0.5s ease-out forwards;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
}

.loot-item:nth-child(1) { animation-delay: 0s; }
.loot-item:nth-child(2) { animation-delay: 0.2s; }
.loot-item:nth-child(3) { animation-delay: 0.4s; }
.loot-item:nth-child(4) { animation-delay: 0.6s; }

.loot-item.common { border: 2px solid #9E9E9E; }
.loot-item.rare { border: 2px solid #2196F3; box-shadow: 0 0 20px rgba(33, 150, 243, 0.3); }
.loot-item.epic { border: 2px solid #9C27B0; box-shadow: 0 0 25px rgba(156, 39, 176, 0.4); }
.loot-item.legendary {
  border: 2px solid #FF9800;
  box-shadow: 0 0 30px rgba(255, 152, 0, 0.5);
  animation: lootAppear 0.5s ease-out forwards, legendaryGlow 2s ease-in-out infinite;
}

.loot-icon {
  font-size: 2.5rem;
}

.loot-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.loot-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
}

.loot-type {
  font-size: 0.85rem;
  color: #888;
}

.loot-rarity {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  width: fit-content;
}

.loot-rarity.common { background: #9E9E9E; color: #fff; }
.loot-rarity.rare { background: #2196F3; color: #fff; }
.loot-rarity.epic { background: #9C27B0; color: #fff; }
.loot-rarity.legendary { background: linear-gradient(90deg, #FF9800, #FFD700); color: #000; }

.loot-duplicate {
  font-size: 0.75rem;
  color: #ffd700;
  margin-top: 3px;
}

/* ===== CHEST CLOSE BUTTON ===== */
.chest-close-btn {
  margin-top: 30px;
  padding: 15px 50px;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border: none;
  border-radius: 25px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease-out forwards;
  animation-delay: 1s;
  opacity: 0;
}

.chest-close-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

/* ===== CHEST NOTIFICATION BADGE ===== */
.chest-notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4);
  animation: badgePop 0.3s ease-out;
}

/* ===== CHEST EARNED NOTIFICATION ===== */
.chest-earned-notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(40, 40, 60, 0.95) 0%, rgba(20, 20, 40, 0.95) 100%);
  border-radius: 15px;
  padding: 15px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 1500;
  animation: slideUpFade 0.5s ease-out;
}

.chest-earned-notification.bronze { border: 2px solid #CD7F32; }
.chest-earned-notification.silver { border: 2px solid #C0C0C0; }
.chest-earned-notification.golden { border: 2px solid #FFD700; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.3); }
.chest-earned-notification.legendary { border: 2px solid #E040FB; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(224, 64, 251, 0.3); }

.chest-earned-emoji {
  font-size: 2.5rem;
  animation: chestFloat 1s ease-in-out infinite;
}

.chest-earned-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chest-earned-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
}

.chest-earned-subtitle {
  font-size: 0.85rem;
  color: #aaa;
}

/* ===== CHEST INVENTORY CARD ===== */
.chest-inventory-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.chest-inventory-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
}

.chest-inventory-card.bronze:hover { border-color: #CD7F32; box-shadow: 0 10px 30px rgba(205, 127, 50, 0.3); }
.chest-inventory-card.silver:hover { border-color: #C0C0C0; box-shadow: 0 10px 30px rgba(192, 192, 192, 0.3); }
.chest-inventory-card.golden:hover { border-color: #FFD700; box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3); }
.chest-inventory-card.legendary:hover { border-color: #E040FB; box-shadow: 0 10px 30px rgba(224, 64, 251, 0.3); }

.chest-inventory-emoji {
  font-size: 3.5rem;
  margin-bottom: 10px;
}

.chest-inventory-name {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 5px;
}

.chest-inventory-count {
  font-size: 0.85rem;
  color: #888;
}

/* ===== PARTICLES ===== */
.chest-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.chest-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: particleFly 1s ease-out forwards;
}

.chest-particle.bronze { background: #CD7F32; }
.chest-particle.silver { background: #C0C0C0; }
.chest-particle.golden { background: #FFD700; }
.chest-particle.legendary { background: #E040FB; }

/* ===== STARDUST DISPLAY ===== */
.stardust-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 215, 0, 0.1);
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.stardust-icon {
  font-size: 1.2rem;
}

.stardust-amount {
  font-size: 1rem;
  font-weight: bold;
  color: #FFD700;
}

/* ===== SHOP ITEM CARD ===== */
.shop-item-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.shop-item-card:hover:not(.disabled) {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffd700;
}

.shop-item-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-item-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.shop-item-name {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 5px;
}

.shop-item-description {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
}

.shop-item-cost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 1rem;
  font-weight: bold;
  color: #FFD700;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes chestShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-5px) rotate(-3deg); }
  75% { transform: translateX(5px) rotate(3deg); }
}

@keyframes chestGlow {
  0%, 100% { filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5)) brightness(1); }
  50% { filter: drop-shadow(0 10px 40px rgba(255, 215, 0, 0.5)) brightness(1.2); }
}

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

@keyframes glowPulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes glowBurst {
  0% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3); }
}

@keyframes lootAppear {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 152, 0, 0.5); }
  50% { box-shadow: 0 0 50px rgba(255, 152, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.4); }
}

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

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes particleFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .chest-emoji {
    font-size: 6rem;
  }

  .chest-name {
    font-size: 1.5rem;
  }

  .chest-message {
    font-size: 1rem;
    max-width: 250px;
  }

  .loot-item {
    padding: 15px 25px;
  }

  .loot-icon {
    font-size: 2rem;
  }

  .loot-name {
    font-size: 1rem;
  }

  .chest-earned-notification {
    bottom: 80px;
    padding: 12px 20px;
  }

  .chest-earned-emoji {
    font-size: 2rem;
  }
}
