/* =============================================
   HUD GAMIFICATION & CASINO SCIENCE ANIMATIONS
   Based on Nir Eyal's Hook Model & Casino Psychology
   ============================================= */

/* =============================================
   1. TAB NOTIFICATION BADGES
   ============================================= */

.tab-notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  background: #ff0033;
  color: #fff;
  font-family: "VT323", monospace;
  font-size: 11px;
  font-weight: bold;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  transform: scale(0);
  animation: badgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  box-shadow: 0 0 10px rgba(255, 0, 51, 0.5);
  z-index: 100;
  pointer-events: none;
}

@keyframes badgePop {
  0% {
    transform: scale(0);
  }
  80% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.tab-notification-badge.incremented {
  animation: badgeIncrement 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgeIncrement {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1);
  }
}

.tab-notification-badge.high-count {
  background: linear-gradient(135deg, #ff0033, #ff6600);
  animation:
    badgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
    highCountPulse 1s ease-in-out infinite 0.3s;
}

@keyframes highCountPulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.5);
  }
  50% {
    box-shadow:
      0 0 20px rgba(255, 0, 51, 0.8),
      0 0 30px rgba(255, 102, 0, 0.4);
  }
}

/* =============================================
   2. TAB BREATHING / NEW CONTENT GLOW
   ============================================= */

.tab-btn.has-new-content {
  animation: tabBreathing 2s ease-in-out infinite;
}

@keyframes tabBreathing {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(57, 255, 20, 0.2);
  }
  50% {
    box-shadow:
      0 0 20px rgba(57, 255, 20, 0.6),
      0 0 40px rgba(57, 255, 20, 0.3);
  }
}

/* Urgent pulse for time-sensitive content */
.tab-btn.urgent {
  animation: urgentPulse 0.8s ease-in-out infinite !important;
  border-color: #ff0033 !important;
}

@keyframes urgentPulse {
  0%,
  100% {
    background: #0a0a00;
    transform: scale(1);
  }
  50% {
    background: rgba(255, 0, 51, 0.2);
    transform: scale(1.02);
  }
}

/* =============================================
   3. ENHANCED CLICK FEEDBACK
   ============================================= */

.tab-btn.clicked {
  animation: tabClick 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes tabClick {
  0% {
    transform: translateY(0) scale(1);
  }
  15% {
    transform: translateY(2px) scale(0.98);
  }
  30% {
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: translateY(-2px) scale(1);
  }
}

/* Ripple effect container */
.tab-btn {
  overflow: hidden;
}

.tab-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(57, 255, 20, 0.4);
  transform: scale(0);
  animation: rippleExpand 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* =============================================
   4. VARIABLE REWARD / BONUS HIT EFFECTS
   ============================================= */

.tab-btn.bonus-hit {
  animation: bonusHit 0.6s ease-out !important;
}

@keyframes bonusHit {
  0% {
    filter: brightness(1);
  }
  30% {
    filter: brightness(1.5) saturate(1.5);
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.8);
  }
  100% {
    filter: brightness(1);
  }
}

/* =============================================
   5. JACKPOT / ACHIEVEMENT CELEBRATION
   ============================================= */

.tab-btn.jackpot {
  animation: jackpotGlow 1.5s ease-out !important;
}

@keyframes jackpotGlow {
  0% {
    filter: brightness(1);
  }
  25% {
    filter: brightness(1.5) saturate(1.5);
    box-shadow:
      0 0 30px #39ff14,
      0 0 60px #39ff14;
  }
  50% {
    filter: brightness(2) saturate(2);
    box-shadow:
      0 0 50px #39ff14,
      0 0 100px #39ff14,
      0 0 150px rgba(255, 215, 0, 0.5);
  }
  75% {
    filter: brightness(1.5) saturate(1.5);
  }
  100% {
    filter: brightness(1);
    box-shadow: none;
  }
}

/* Jackpot particles */
.jackpot-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
}

/* =============================================
   6. PROGRESS BAR UNDER TABS
   ============================================= */

.tab-progress-bar {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #002200;
  overflow: hidden;
}

.tab-progress-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, #39ff14, #00ffff);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

/* Completion checkmark */
.tab-btn.completed::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: #39ff14;
  color: #000;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 100;
}

@keyframes checkmarkPop {
  0% {
    transform: scale(0);
  }
  80% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* =============================================
   7. COUNTDOWN / LIMITED TIME BADGES
   ============================================= */

.tab-countdown-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff0033;
  color: #fff;
  font-family: "VT323", monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  animation: countdownPulse 1s ease-in-out infinite;
  z-index: 100;
}

@keyframes countdownPulse {
  0%,
  100% {
    background: #ff0033;
    box-shadow: 0 0 5px #ff0033;
  }
  50% {
    background: #ff6600;
    box-shadow: 0 0 15px #ff6600;
  }
}

.tab-btn.limited-time {
  border-color: #ff6600 !important;
  box-shadow: 0 0 10px rgba(255, 102, 0, 0.4);
}

/* =============================================
   8. TAB CONTENT TRANSITIONS
   ============================================= */

/* Staggered reveal for child elements */
.tab-content.active.stagger-reveal > * {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerReveal 0.4s ease forwards;
}

.tab-content.active.stagger-reveal > *:nth-child(1) {
  animation-delay: 0.05s;
}
.tab-content.active.stagger-reveal > *:nth-child(2) {
  animation-delay: 0.1s;
}
.tab-content.active.stagger-reveal > *:nth-child(3) {
  animation-delay: 0.15s;
}
.tab-content.active.stagger-reveal > *:nth-child(4) {
  animation-delay: 0.2s;
}
.tab-content.active.stagger-reveal > *:nth-child(5) {
  animation-delay: 0.25s;
}
.tab-content.active.stagger-reveal > *:nth-child(6) {
  animation-delay: 0.3s;
}
.tab-content.active.stagger-reveal > *:nth-child(7) {
  animation-delay: 0.35s;
}
.tab-content.active.stagger-reveal > *:nth-child(8) {
  animation-delay: 0.4s;
}

@keyframes staggerReveal {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slot machine reveal effect */
.tab-content.slot-reveal {
  animation: slotReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slotReveal {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  40% {
    transform: translateY(20%);
    opacity: 0.7;
  }
  60% {
    transform: translateY(-10%);
    opacity: 0.9;
  }
  80% {
    transform: translateY(5%);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* =============================================
   9. GLITCH / SCI-FI EFFECTS
   ============================================= */

.tab-content.glitch-reveal {
  animation: glitchReveal 0.5s ease;
}

@keyframes glitchReveal {
  0% {
    transform: translate(0);
    filter: none;
  }
  10% {
    transform: translate(-2px, 1px);
    filter: hue-rotate(90deg);
  }
  20% {
    transform: translate(2px, -1px);
    filter: hue-rotate(180deg);
  }
  30% {
    transform: translate(-1px, 2px);
    filter: hue-rotate(270deg);
  }
  40% {
    transform: translate(1px, -2px);
    filter: hue-rotate(0deg);
  }
  50%,
  100% {
    transform: translate(0);
    filter: none;
  }
}

/* RGB split text effect */
.tab-btn.glitch-text {
  animation: rgbSplit 0.2s ease;
}

@keyframes rgbSplit {
  0%,
  100% {
    text-shadow: none;
  }
  25% {
    text-shadow:
      -2px 0 #ff0000,
      2px 0 #00ffff;
  }
  50% {
    text-shadow:
      2px 0 #ff0000,
      -2px 0 #00ffff;
  }
  75% {
    text-shadow:
      -1px 0 #ff0000,
      1px 0 #00ffff;
  }
}

/* Scanline sweep effect */
@keyframes scanlineSweep {
  0% {
    background-position: 0 -100%;
  }
  100% {
    background-position: 0 200%;
  }
}

.tab-btn.scanning::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(57, 255, 20, 0.1) 50%,
    transparent 100%
  );
  background-size: 100% 200%;
  animation: scanlineSweep 1s linear infinite;
  pointer-events: none;
}

/* =============================================
   10. LOADING / NEAR-MISS STATE
   ============================================= */

.tab-btn.loading {
  animation: nearMiss 1.5s ease-in-out infinite;
}

@keyframes nearMiss {
  0%,
  100% {
    opacity: 0.7;
  }
  25% {
    opacity: 1;
    text-shadow: 0 0 10px #39ff14;
  }
  50% {
    opacity: 0.5;
  }
  75% {
    opacity: 0.9;
    text-shadow: 0 0 5px #39ff14;
  }
}

/* Loading dots inside tab */
.tab-btn.loading::after {
  content: "...";
  animation: loadingDots 1s steps(4, end) infinite;
}

@keyframes loadingDots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}

/* =============================================
   11. STREAK / COMBO INDICATOR
   ============================================= */

.tab-streak-indicator {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffaa00, #ff6600);
  color: #000;
  font-family: "VT323", monospace;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  animation: streakBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
  z-index: 101;
}

@keyframes streakBounce {
  0% {
    transform: translateX(-50%) scale(0);
  }
  60% {
    transform: translateX(-50%) scale(1.2);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

/* =============================================
   12. HOVER ENHANCEMENTS
   ============================================= */

.tab-btn:hover {
  /* Enhanced hover with slight scale */
  transform: translateY(-3px) scale(1.02);
}

/* Hover underline sweep */
.tab-btn::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #39ff14;
  transition:
    width 0.3s ease,
    left 0.3s ease;
}

.tab-btn:hover::after {
  width: 100%;
  left: 0;
}

/* Active tab override */
.tab-btn.active::after {
  content: "▼";
  width: auto;
  height: auto;
  background: transparent;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
}

/* =============================================
   13. PINNED TAB STYLING
   ============================================= */

.tab-btn.pinned {
  border-color: #ffaa00 !important;
}

.tab-btn.pinned::before {
  content: "📌";
  position: absolute;
  top: -8px;
  left: -8px;
  font-size: 12px;
  z-index: 100;
}

/* =============================================
   14. DATA REFRESH ANIMATION
   ============================================= */

.tab-btn.refreshing {
  position: relative;
}

.tab-btn.refreshing::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: #39ff14;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0.8;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* =============================================
   15. TOAST NOTIFICATIONS FOR TABS
   ============================================= */

.tab-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #0a0a00, #002200);
  border: 2px solid #39ff14;
  color: #39ff14;
  font-family: "VT323", monospace;
  padding: 12px 24px;
  border-radius: 4px;
  opacity: 0;
  animation:
    toastSlideIn 0.4s ease forwards,
    toastSlideOut 0.4s ease forwards 2.5s;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
  z-index: 10000;
}

.tab-toast.achievement {
  border-color: #ffaa00;
  color: #ffaa00;
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.3);
}

.tab-toast.error {
  border-color: #ff0033;
  color: #ff0033;
  box-shadow: 0 0 20px rgba(255, 0, 51, 0.3);
}

@keyframes toastSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastSlideOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}
