/* Player Card 3D Hover Effect */

:root {
  --pointer-x: 0;
  --pointer-y: 0;
  --card-width: 350px;
  --rotate-x: 20deg;
  --rotate-y: -20deg;
  --parallax-x: 5%;
  --parallax-y: 5%;
}

.player-card-container {
  perspective: 1000px;
  width: var(--card-width);
  height: calc(var(--card-width) * 1.4);
}

.player-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.2s ease;
  cursor: pointer;
  overflow: visible;
}

.player-card[data-active="true"] {
  transition: transform 0s;
}

.player-card[data-active="true"]:hover {
  transform: rotateX(calc(var(--pointer-y) * var(--rotate-x)))
    rotateY(calc(var(--pointer-x) * var(--rotate-y)));
  animation: set backwards 0.2s;
}

@keyframes set {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
}

.player-card img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.2s ease, filter 0.3s ease;
  will-change: transform, filter;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
  position: relative;
  z-index: 1;
}

/* Default hover effect (AllStar - Golden) */
.player-card[data-active="true"]:hover img {
  transition: transform 0s, filter 0s;
  transform: translate(
    calc(var(--pointer-x) * var(--parallax-x)),
    calc(var(--pointer-y) * var(--parallax-y))
  );
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(255, 215, 0, 0.4)) brightness(1.1);
  animation: set-img backwards 0.2s;
}

/* NHL Card - Red glow */
.player-card[data-card-type="nhl"][data-active="true"]:hover img {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(220, 38, 38, 0.6)) 
    drop-shadow(0 0 40px rgba(239, 68, 68, 0.3)) brightness(1.1);
}

/* Pro Card - Blue/White glow */
.player-card[data-card-type="pro"][data-active="true"]:hover img {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(59, 130, 246, 0.6)) 
    drop-shadow(0 0 40px rgba(147, 197, 253, 0.4))
    drop-shadow(0 0 60px rgba(255, 255, 255, 0.2)) brightness(1.1);
}

@keyframes set-img {
  0% {
    transform: translate(0, 0);
  }
}

/* Individual sparkle stars - direct children of player-card */
.sparkle-star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Default sparkle star glow (AllStar - Golden) */
.sparkle-star::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 223, 0, 0.6),
    0 0 20px rgba(255, 223, 0, 0.3);
}

/* NHL Card sparkles - Red glow */
.player-card[data-card-type="nhl"] .sparkle-star::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(220, 38, 38, 0.7),
    0 0 20px rgba(239, 68, 68, 0.4);
}

/* Pro Card sparkles - Blue/White glow */
.player-card[data-card-type="pro"] .sparkle-star::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(59, 130, 246, 0.7),
    0 0 20px rgba(147, 197, 253, 0.4), 0 0 30px rgba(255, 255, 255, 0.2);
}

/* Four-pointed star shape */
.sparkle-star.four-point {
  background: transparent;
  width: 10px;
  height: 10px;
}

/* Default four-point star (AllStar - Golden) */
.sparkle-star.four-point::before {
  width: 2px;
  height: 100%;
  background: white;
  border-radius: 0;
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(255, 223, 0, 0.8);
}

.sparkle-star.four-point::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 2px;
  background: white;
  border-radius: 0;
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(255, 223, 0, 0.8);
}

/* NHL Card four-point stars - Red glow */
.player-card[data-card-type="nhl"] .sparkle-star.four-point::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(220, 38, 38, 0.9);
}

.player-card[data-card-type="nhl"] .sparkle-star.four-point::after {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(220, 38, 38, 0.9);
}

/* Pro Card four-point stars - Blue/White glow */
.player-card[data-card-type="pro"] .sparkle-star.four-point::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(59, 130, 246, 0.9), 
    0 0 20px rgba(255, 255, 255, 0.3);
}

.player-card[data-card-type="pro"] .sparkle-star.four-point::after {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(59, 130, 246, 0.9), 
    0 0 20px rgba(255, 255, 255, 0.3);
}

/* Passive sparkle animation (always visible) */
.sparkle-star.passive {
  animation: passive-sparkle 3s ease-in-out infinite;
}

.sparkle-star.passive:nth-child(odd) {
  animation-delay: 0.5s;
  animation-duration: 2.5s;
}

.sparkle-star.passive:nth-child(even) {
  animation-delay: 1s;
  animation-duration: 3.5s;
}

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

/* Active sparkle animation (on hover) */
.sparkle-star.active {
  animation: active-sparkle 0.8s ease-out forwards;
}

@keyframes active-sparkle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(360deg);
  }
}

