/* ============================================
   EFECTOS VISUALES PARA BADGES v3.0
   Animaciones ÉPICAS y dramáticas
   Actualizado: Efectos súper visibles e impactantes
   ============================================ */

/* --- Badge effect color variables --- */
:root {
  --success: #26890d;
  --info: #1368ce;
  --orange: #fd7e14;
  --badge-glow-color: #3b82f6;
  --badge-sparkle-color: #bb7af7;
  --badge-fire-color: #fb923c;
  --badge-pulse-color: #f43f5dab;
  --badge-shimmer-color: #d13b89;
}

[data-qa-theme="bright-playful"] {
  --badge-glow-color: #3b82f6;
  --badge-sparkle-color: #54289b;
  --badge-fire-color: #ea580c;
  --badge-pulse-color: #c2143ab4;
  --badge-shimmer-color: #d13b89;
}

[data-qa-theme="bright-playful"] .badge-effect-rainbow {
  filter: saturate(1.2) brightness(1.1);
}

/* === EFECTO: GLOW (Brillo Eléctrico) === */
.badge-effect-glow {
  display: inline-block;
  animation: glowAnimation 1.5s ease-in-out infinite;
  font-weight: 900;
  color: var(--badge-glow-color) !important;
}

@keyframes glowAnimation {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(59, 130, 246, 1),
      0 0 20px rgb(64 114 194 / 90%),
      0 0 30px rgb(79 126 204 / 70%),
      0 0 40px rgb(64 112 191 / 59%);
    filter: brightness(1.0) contrast(1.0);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 20px rgb(30 99 211),
      0 0 35px rgb(43 98 188),
      0 0 50px rgb(30 77 154 / 90%),
      0 0 70px rgb(14 37 75 / 70%),
      0 0 90px rgb(36 75 139 / 50%);
    filter: brightness(1.10) contrast(1.09);
    transform: scale(1.05);
  }
}

#effect-preview.badge-effect-glow {
  animation: previewGlowAnimation 1.5s ease-in-out infinite;
  font-weight: 600;
}

@keyframes previewGlowAnimation {
  0%, 100% {
    text-shadow:
      0 0 5px rgba(87, 147, 245, 0.9),
      0 0 6px rgba(103, 155, 238, 0.4);
    filter: brightness(1.01);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 8px rgb(97, 151, 240),
      0 0 16px rgba(84, 124, 187, 0.4);
    filter: brightness(1.08);
    transform: scale(1.01);
  }
}

/* === EFECTO: SPARKLE (Destello Mágico) === */
.badge-effect-sparkle {
  display: inline-block;
  position: relative;
  animation: sparkleAnimation 1.2s ease-in-out infinite;
  font-weight: 900;
  color: var(--badge-sparkle-color) !important;
}

@keyframes sparkleAnimation {
  0%, 100% {
    text-shadow:
      0 0 8px rgba(168, 85, 247, 0.8),
      0 0 15px rgba(168, 85, 247, 0.6);
    filter: brightness(1.15) saturate(1.4);
    transform: rotate(-1deg) scale(1);
  }
  25% {
    text-shadow:
      0 0 20px rgba(168, 85, 247, 1),
      0 0 40px rgba(168, 85, 247, 1),
      0 0 60px rgba(168, 85, 247, 0.8),
      2px 2px 2px rgba(255, 255, 255, 0.5);
    filter: brightness(1.35) saturate(2);
    transform: rotate(1deg) scale(1.08);
  }
  50% {
    text-shadow:
      0 0 8px rgba(168, 85, 247, 0.8),
      0 0 15px rgba(168, 85, 247, 0.6);
    filter: brightness(1.1) saturate(1.5);
    transform: rotate(-1deg) scale(1);
  }
  75% {
    text-shadow:
      0 0 20px rgba(168, 85, 247, 1),
      0 0 40px rgba(168, 85, 247, 1),
      0 0 60px rgba(168, 85, 247, 0.8),
      -2px -2px 2px rgba(255, 255, 255, 0.5);
    filter: brightness(1.35) saturate(2);
    transform: rotate(1deg) scale(1.08);
  }
}

/* === EFECTO: RAINBOW (Arcoíris Psicodélico) === */
.badge-effect-rainbow {
  display: inline-block;
  animation: rainbowAnimation 2s linear infinite, rainbowPulse 1s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    #ff0000,
    #ff7f00,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #8b00ff,
    #ff0000,
    #ff7f00
  );
  background-size: 600% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 900;
  filter: saturate(1.5) brightness(1.15);
}

@keyframes rainbowAnimation {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 600% center;
  }
}

@keyframes rainbowPulse {
  0%, 100% {
    transform: scale(1);
    filter: saturate(1.5) brightness(1.15);
  }
  50% {
    transform: scale(1.06);
    filter: saturate(2) brightness(1.25);
  }
}

/* === EFECTO: FIRE (Llamas Infernales) === */
.badge-effect-fire {
  display: inline-block;
  animation: fireAnimation 0.6s ease-in-out infinite;
  font-weight: 900;
  color: var(--badge-fire-color) !important;
}

@keyframes fireAnimation {
  0%, 100% {
    text-shadow:
      0 0 15px rgba(251, 146, 60, 1),
      0 0 25px rgba(251, 146, 60, 0.9),
      0 0 35px rgba(245, 158, 11, 0.8),
      0 -3px 10px rgba(239, 68, 68, 0.7);
    transform: translateY(0) rotate(-1deg);
    filter: brightness(1.15) saturate(1.5);
  }
  25% {
    text-shadow:
      0 0 25px rgba(239, 68, 68, 1),
      0 0 40px rgba(239, 68, 68, 1),
      0 0 55px rgba(239, 68, 68, 0.9),
      0 -5px 15px rgba(220, 38, 38, 0.8);
    transform: translateY(-3px) rotate(1deg) scale(1.05);
    filter: brightness(1.3) saturate(2);
  }
  50% {
    text-shadow:
      0 0 15px rgba(251, 191, 36, 1),
      0 0 25px rgba(251, 191, 36, 0.9),
      0 0 35px rgba(245, 158, 11, 0.8),
      0 -3px 10px rgba(251, 146, 60, 0.7);
    transform: translateY(0) rotate(-1deg);
    filter: brightness(1.15) saturate(1.5);
  }
  75% {
    text-shadow:
      0 0 25px rgba(239, 68, 68, 1),
      0 0 40px rgba(239, 68, 68, 1),
      0 0 55px rgba(239, 68, 68, 0.9),
      0 -5px 15px rgba(220, 38, 38, 0.8);
    transform: translateY(-3px) rotate(1deg) scale(1.05);
    filter: brightness(1.3) saturate(2);
  }
}

/* === EFECTO: PULSE (Pulso Radioactivo) === */
.badge-effect-pulse {
  display: inline-block;
  animation: pulseAnimation 1.2s ease-in-out infinite;
  font-weight: 900;
  color: var(--badge-pulse-color) !important;
}

@keyframes pulseAnimation {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    text-shadow:
      0 0 10px rgba(225, 29, 72, 1),
      0 0 20px rgba(225, 29, 72, 0.8),
      0 0 30px rgba(225, 29, 72, 0.6);
    filter: brightness(1.05) hue-rotate(0deg);
  }
  50% {
    transform: scale(1.15) rotate(2deg);
    text-shadow:
      0 0 25px rgba(225, 29, 72, 1),
      0 0 45px rgba(225, 29, 72, 1),
      0 0 65px rgba(225, 29, 71, 0.959),
      0 0 85px rgba(225, 29, 71, 0.582),
      0 0 3px rgba(212, 134, 134, 0.438);
    filter: brightness(1.15) hue-rotate(10deg);
  }
}

/* === EFECTO: SHIMMER (Destello Cristalino) === */
.badge-effect-shimmer {
  display: inline-block;
  position: relative;
  font-weight: 900;
  animation: shimmerTextAnimation 1.5s linear infinite;
  color: var(--badge-shimmer-color) !important;
}

.score-value.badge-effect-shimmer {
  color: #fff !important;
}

.score-value.badge-effect-glow,
.score-value.badge-effect-sparkle,
.score-value.badge-effect-fire,
.score-value.badge-effect-pulse {
  color: #fff !important;
}

.score-value.badge-effect-rainbow {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  background: none;
}

@keyframes shimmerTextAnimation {
  0%, 100% {
    text-shadow:
      0 0 8px rgba(236, 72, 153, 0.7),
      3px 0 10px rgba(255, 255, 255, 0.3);
    filter: brightness(1.1);
    transform: translateX(0) scale(1);
  }
  25% {
    text-shadow:
      0 0 20px rgba(236, 72, 153, 1),
      0 0 35px rgba(236, 72, 153, 0.9),
      5px 0 15px rgba(255, 255, 255, 0.7);
    filter: brightness(1.25) saturate(1.5);
    transform: translateX(2px) scale(1.04);
  }
  50% {
    text-shadow:
      0 0 8px rgba(236, 72, 153, 0.7),
      -3px 0 10px rgba(255, 255, 255, 0.3);
    filter: brightness(1.1);
    transform: translateX(0) scale(1);
  }
  75% {
    text-shadow:
      0 0 20px rgba(236, 72, 153, 1),
      0 0 35px rgba(236, 72, 153, 0.9),
      -5px 0 15px rgba(255, 255, 255, 0.7);
    filter: brightness(1.25) saturate(1.5);
    transform: translateX(-2px) scale(1.04);
  }
}

/* === ESTILOS PARA TÍTULO DE BADGE === */
.badge-title {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Glow del título: conserva el color del badge seleccionado. */
.badge-title.badge-title-effect-glow {
  color: #fff !important;
  animation: badgeTitleGlowAnimation 1.5s ease-in-out infinite;
  font-weight: 600;
}

@keyframes badgeTitleGlowAnimation {
  0%, 100% {
    box-shadow:
      0 0 5px rgba(196, 181, 253, 0.75),
      0 0 10px rgba(139, 92, 246, 0.45);
    text-shadow: 0 1px 2px rgba(46, 16, 101, 0.8);
    filter: brightness(1);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 8px rgba(221, 214, 254, 0.9),
      0 0 16px rgba(139, 92, 246, 0.65);
    text-shadow:
      0 1px 2px rgba(46, 16, 101, 0.9),
      0 0 4px rgba(255, 255, 255, 0.35);
    filter: brightness(1.12);
    transform: scale(1.02);
  }
}

/* === ESTILOS RESPONSIVE === */
@media (max-width: 768px) {
  /* Reducir LIGERAMENTE intensidad en móviles (pero mantener wow factor) */
  .badge-effect-glow,
  .badge-effect-sparkle,
  .badge-effect-fire,
  .badge-effect-pulse,
  .badge-effect-shimmer {
    animation-duration: calc(1.5 * var(--base-duration, 1s));
  }

  .badge-effect-rainbow {
    animation-duration: 2.5s;
  }

  /* Escala máxima más pequeña en móvil */
  @keyframes pulseAnimation {
    50% {
      transform: scale(1.08) rotate(2deg);
    }
  }
}

/* === PREFERENCIAS DE MOVIMIENTO REDUCIDO === */
@media (prefers-reduced-motion: reduce) {
  .badge-effect-glow,
  .badge-effect-sparkle,
  .badge-effect-rainbow,
  .badge-effect-fire,
  .badge-effect-pulse,
  .badge-effect-shimmer {
    animation: none;
    /* Mantener estilo estático pero visible */
    text-shadow: 0 0 8px currentColor;
    filter: brightness(1.15);
  }

  .badge-effect-glow { color: var(--badge-glow-color) !important; }
  .badge-effect-sparkle { color: var(--badge-sparkle-color) !important; }
  .badge-effect-fire { color: var(--badge-fire-color) !important; }
  .badge-effect-pulse { color: var(--badge-pulse-color) !important; }
  .badge-effect-shimmer { color: var(--badge-shimmer-color) !important; }
}

/* Badge */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-block;
}

.badge-primary {
  background: var(--primary);
  color: var(--white);
}

.badge-success {
  background: var(--success);
  color: var(--white);
}

.badge-warning {
  background: var(--warning);
  color: #1a1a1a;
}

.badge-orange {
  background: var(--orange);
  color: white;
}

.badge-danger {
  background: var(--danger);
  color: var(--white);
}

.badge-info {
  background: var(--info);
  color: var(--white);
}

.badge-light {
  background: var(--light);
  color: var(--dark);
}

.border-info {
  background: var(--bg-elevated);
  border: 1px solid var(--info);
  color: var(--text-secondary);
}

.border-primary {
  background: var(--bg-elevated);
  border: 1px solid var(--primary);
  color: var(--text-secondary);
}

/* ========== BADGE NOTIFICATION MODAL ========== */
.badge-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.badge-modal-content {
  background: var(--bg-card, white);
  border-radius: 20px;
  padding: 3rem;
  max-width: 500px;
  text-align: center;
  position: relative;
  animation: badgePopIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10000;
}

.badge-modal-icon {
  font-size: 8rem;
  margin-bottom: 1rem;
  animation: badgeSpin 1s ease-in-out;
}

.badge-modal-text {
  margin-bottom: 1.5rem;
}

.badge-modal-label {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.badge-modal-name {
  font-size: 2rem;
  font-weight: 900;
  margin: 0.5rem 0;
  color: var(--primary);
}

.badge-modal-rarity {
  display: inline-block;
  padding: 0.25rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  background: #94a3b8;
  margin-bottom: 1rem;
}

.badge-modal-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 1rem 0;
}

.badge-modal-button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(112, 44, 249, 0.3);
}

.badge-modal-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(112, 44, 249, 0.4);
}

.badge-modal-button:active {
  transform: translateY(0);
}

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

@keyframes badgeSpin {
  0% {
    transform: rotate(0deg) scale(0.5);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}
