/* subscription-animations.css */

:root {
  --tier2-primary: #22ff8f;
  --tier2-glow: rgba(34, 255, 143, 0.4);
  --tier5-primary: #ffc800;
  --tier5-secondary: #ff9600;
  --tier5-glow: rgba(255, 200, 0, 0.4);
  --tier10-primary: #ffffff;
  --tier10-secondary: #e0e0ff;
  --tier10-glow: rgba(255, 255, 255, 0.5);
}

.session-card {
  position: relative;
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.session-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* --- Border Wrapper --- */
.subscription-border-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  overflow: visible; /* Allow elements like the crown/star to be outside */
  border-radius: inherit;
}

.subscription-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  border: 2px solid transparent;
  pointer-events: none;
}

.subscription-element {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

/* --- TIER 2: PREMIUM (GREEN + STAR) --- */
.session-card[data-subscription-level="2"] .subscription-border {
  animation: borderGlow2 3s infinite linear;
}

.session-card[data-subscription-level="2"] .subscription-element::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--tier2-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--tier2-primary);
}

.session-card[data-subscription-level="2"] .subscription-element {
  animation: starPath2 3s infinite linear, starFade2 3s infinite linear;
}

@keyframes borderGlow2 {
  0%, 100% {
    border-color: rgba(34, 255, 143, 0.2);
    box-shadow: inset 0 0 10px rgba(34, 255, 143, 0.1);
  }
  50% {
    border-color: rgba(34, 255, 143, 0.5);
    box-shadow: inset 0 0 20px rgba(34, 255, 143, 0.3), 0 0 15px rgba(34, 255, 143, 0.2);
  }
}

@keyframes starPath2 {
  0% { bottom: -7px; right: -7px; }
  25% { top: -7px; right: -7px; bottom: auto; }
  50% { top: -7px; left: -7px; right: auto; }
  75% { bottom: -7px; left: -7px; top: auto; }
  100% { bottom: -7px; right: -7px; left: auto; }
}

@keyframes starFade2 {
  0%, 100% { opacity: 0; }
  5%, 20% { opacity: 1; }
  30% { opacity: 0; }
}

/* --- TIER 5: GOLD (GOLD + PARTICLES) --- */
.session-card[data-subscription-level="5"] .subscription-border {
  animation: borderGlow5 2.5s infinite linear;
}

.session-card[data-subscription-level="5"] .subscription-element {
  width: 6px;
  height: 6px;
  background: var(--tier5-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--tier5-primary);
  animation: particlePath5 2.5s infinite linear;
  opacity: 1;
}

.session-card[data-subscription-level="5"] .subscription-element::before,
.session-card[data-subscription-level="5"] .subscription-element::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--tier5-secondary);
  border-radius: 50%;
  box-shadow: 0 0 5px var(--tier5-secondary);
}

.session-card[data-subscription-level="5"] .subscription-element::before {
  animation: particlePath5-offset1 2.5s infinite linear;
}

.session-card[data-subscription-level="5"] .subscription-element::after {
  animation: particlePath5-offset2 2.5s infinite linear;
}

@keyframes borderGlow5 {
  0%, 100% {
    border-color: rgba(255, 200, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 200, 0, 0.2);
  }
  50% {
    border-color: rgba(255, 200, 0, 0.7);
    box-shadow: 0 0 20px rgba(255, 200, 0, 0.4), inset 0 0 10px rgba(255, 200, 0, 0.2);
  }
}

@keyframes particlePath5 {
  0% { bottom: -3px; right: -3px; }
  25% { top: -3px; right: -3px; bottom: auto; }
  50% { top: -3px; left: -3px; right: auto; }
  75% { bottom: -3px; left: -3px; top: auto; }
  100% { bottom: -3px; right: -3px; left: auto; }
}

@keyframes particlePath5-offset1 {
  0% { transform: translate(10px, -5px); }
  25% { transform: translate(-5px, 10px); }
  50% { transform: translate(-10px, 5px); }
  75% { transform: translate(5px, -10px); }
  100% { transform: translate(10px, -5px); }
}

@keyframes particlePath5-offset2 {
  0% { transform: translate(-8px, 8px); }
  25% { transform: translate(8px, 8px); }
  50% { transform: translate(8px, -8px); }
  75% { transform: translate(-8px, -8px); }
  100% { transform: translate(-8px, 8px); }
}

/* --- TIER 10: PLATINUM (WHITE + CROWN) --- */
.session-card[data-subscription-level="10"] .subscription-border {
  border-width: 3px;
  animation: borderGlow10 2s infinite linear;
}

.session-card[data-subscription-level="10"] .subscription-element::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--tier10-primary);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px var(--tier10-primary));
}

.session-card[data-subscription-level="10"] .subscription-element {
  animation: crownPath10 2s infinite linear;
  opacity: 1;
}

@keyframes borderGlow10 {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
  }
  50% {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3);
  }
}

@keyframes crownPath10 {
  0% { bottom: -10px; right: -10px; transform: rotate(0deg) scale(1); }
  25% { top: -10px; right: -10px; bottom: auto; transform: rotate(90deg) scale(1.1); }
  50% { top: -10px; left: -10px; right: auto; transform: rotate(180deg) scale(1); }
  75% { bottom: -10px; left: -10px; top: auto; transform: rotate(270deg) scale(1.1); }
  100% { bottom: -10px; right: -10px; left: auto; transform: rotate(360deg) scale(1); }
}

/* Ensure content is above animations */
.card-top, .card-body, .card-footer {
  position: relative;
  z-index: 5;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .subscription-border, .subscription-element {
    animation: none !important;
  }
  .subscription-element {
    display: none;
  }
  .session-card[data-subscription-level="2"] .subscription-border { border-color: var(--tier2-primary); }
  .session-card[data-subscription-level="5"] .subscription-border { border-color: var(--tier5-primary); }
  .session-card[data-subscription-level="10"] .subscription-border { border-color: var(--tier10-primary); }
}
