/* ============================================
   IRON SPIRIT - ANIMATIONS CSS
   Effets Shonen : Feu, Énergie, Particules
   ============================================ */

/* ============================================
   KEYFRAMES ANIMATIONS
   ============================================ */

/* FIRE & ENERGY */
@keyframes fireFlicker {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(255,100,0,0.6));
        transform: skewX(-1deg);
    }
    25% {
        filter: drop-shadow(0 0 25px rgba(255,50,0,0.8));
        transform: skewX(1deg);
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255,200,0,0.7));
        transform: skewX(0deg);
    }
    75% {
        filter: drop-shadow(0 0 30px rgba(255,80,0,0.9));
        transform: skewX(-1deg);
    }
}

@keyframes fireTop {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes logoFlame {
    0% { transform: rotate(-5deg) scale(1); filter: drop-shadow(0 0 5px rgba(255,100,0,0.5)); }
    50% { transform: rotate(5deg) scale(1.1); filter: drop-shadow(0 0 15px rgba(255,200,0,0.8)); }
    100% { transform: rotate(-5deg) scale(1); filter: drop-shadow(0 0 5px rgba(255,100,0,0.5)); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.98); }
}

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

@keyframes auraPulse {
    0% { opacity: 0.2; transform: scale(0.95); }
    100% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes powerPulse {
    0% { text-shadow: 0 0 30px var(--red), 0 0 60px rgba(204,0,0,0.3); }
    100% { text-shadow: 0 0 50px var(--red-bright), 0 0 80px rgba(255,50,0,0.6), 0 0 100px rgba(255,150,0,0.3); }
}

@keyframes xpGlow {
    0% { opacity: 0.3; width: 20px; }
    100% { opacity: 0.8; width: 40px; }
}

@keyframes borderRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes levelUpIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes crownFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

@keyframes energyWave {
    0% { transform: scaleX(0); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}

@keyframes particleFloat {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 1; }
    100% { transform: translateY(-200px) translateX(var(--dx, 50px)) scale(0); opacity: 0; }
}

@keyframes glitchEffect {
    0% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.7), -0.05em -0.025em 0 rgba(0,255,255,0.5); }
    14% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.7), -0.05em -0.025em 0 rgba(0,255,255,0.5); }
    15% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.7), 0.025em 0.025em 0 rgba(0,255,255,0.5); }
    49% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.7), 0.025em 0.025em 0 rgba(0,255,255,0.5); }
    50% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.7), 0.05em 0 0 rgba(0,255,255,0.5); }
    99% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.7), 0.05em 0 0 rgba(0,255,255,0.5); }
    100% { text-shadow: -0.025em 0 0 rgba(255,0,0,0.7), -0.025em -0.025em 0 rgba(0,255,255,0.5); }
}

@keyframes neonFlicker {
    0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
        opacity: 1;
        box-shadow: 0 0 5px rgba(204,0,0,0.5), 0 0 10px rgba(204,0,0,0.3), 0 0 20px rgba(204,0,0,0.2);
    }
    20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
        opacity: 0.6;
        box-shadow: none;
    }
}

@keyframes scanLine {
    from { top: -100%; }
    to { top: 100%; }
}

@keyframes energyBurst {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

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

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes explosionPop {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(180deg); opacity: 1; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

@keyframes chargeUp {
    0% { box-shadow: 0 0 0px rgba(204,0,0,0); }
    25% { box-shadow: 0 0 10px rgba(204,0,0,0.3); }
    50% { box-shadow: 0 0 20px rgba(255,100,0,0.5); }
    75% { box-shadow: 0 0 30px rgba(255,200,0,0.7); }
    100% { box-shadow: 0 0 40px rgba(255,215,0,0.9); }
}

/* XP GAIN FLOAT */
@keyframes xpFloat {
    0% { transform: translateY(0) translateX(-50%); opacity: 1; }
    100% { transform: translateY(-60px) translateX(-50%); opacity: 0; }
}

/* POWER SURGE */
@keyframes powerSurge {
    0% { transform: scaleX(0); transform-origin: left; }
    50% { transform: scaleX(1); transform-origin: left; }
    100% { transform: scaleX(0); transform-origin: right; }
}

/* SHAKE EFFECT */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ============================================
   SPECIAL EFFECT CLASSES
   ============================================ */

/* Glitch Text Effect */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitchEffect 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitchEffect 2s infinite linear alternate-reverse;
    animation-delay: -1s;
}

/* Energy Pulse Button */
.energy-pulse {
    position: relative;
    overflow: hidden;
}

.energy-pulse::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.15),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* Neon Glow Border */
.neon-border {
    animation: neonFlicker 4s infinite;
}

/* Floating animation for cards */
.float-animation {
    animation: floatUpDown 3s ease-in-out infinite;
}

/* Power Level Charging Animation */
.power-charging {
    animation: chargeUp 1.5s ease forwards;
}

/* Shake on error */
.shake {
    animation: shake 0.5s ease;
}

/* XP Float notification */
.xp-float {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold), #ff8c00);
    color: var(--black);
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 900;
    padding: 8px 24px;
    border-radius: 50px;
    z-index: 9001;
    pointer-events: none;
    animation: xpFloat 1.5s ease forwards;
    letter-spacing: 2px;
}

/* Energy Burst on click */
.energy-burst {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    pointer-events: none;
    z-index: 8000;
    animation: energyBurst 0.6s ease forwards;
    transform: translate(-50%, -50%);
}

/* Card hover energy effect */
.energy-card {
    position: relative;
    overflow: hidden;
}

.energy-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(255,215,0,0.05) 30deg,
        transparent 60deg
    );
    animation: rotateGlow 4s linear infinite;
    z-index: 0;
    pointer-events: none;
}

/* Loading Bar Animation */
.loading-bar {
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

/* Scan Line Effect (over hero) */
.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

.scan-lines::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,100,0,0.15), transparent);
    animation: scanLine 3s linear infinite;
}

/* Fire Particles */
.fire-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 1.5s ease forwards;
}

/* Battle Score Counter */
.score-counter {
    animation: countUp 0.3s ease;
}

/* Power Bar Fill */
.power-bar-fill {
    animation: powerSurge 0.8s ease;
}

/* Achievement Unlock Explosion */
.achievement-unlock {
    animation: explosionPop 0.5s ease forwards;
}

/* Tabata working state */
.tabata-working {
    background: linear-gradient(135deg, rgba(204,0,0,0.2), rgba(0,0,0,0.5)) !important;
    border-color: var(--red) !important;
    box-shadow: 0 0 30px rgba(204,0,0,0.3) !important;
}

.tabata-resting {
    background: linear-gradient(135deg, rgba(0,100,255,0.2), rgba(0,0,0,0.5)) !important;
    border-color: #0066ff !important;
    box-shadow: 0 0 30px rgba(0,100,255,0.3) !important;
}

/* Hero energy field */
.energy-field {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(204,0,0,0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(255,100,0,0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255,215,0,0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
}

::-webkit-scrollbar-thumb {
    background: var(--red-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--red);
}

/* ============================================
   PAGE TRANSITION
   ============================================ */
.tab-panel {
    animation: fadeIn 0.35s ease;
}

.tab-panel.slide-right {
    animation: slideFromRight 0.35s ease;
}

@keyframes slideFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   PREMIUM LOCK ANIMATION
   ============================================ */
.premium-lock-banner {
    animation: crownFloat 4s ease-in-out infinite;
}

/* ============================================
   WORKOUT COMPLETE CELEBRATION
   ============================================ */
@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9002;
    animation: confettiFall 2s ease forwards;
    pointer-events: none;
    border-radius: 2px;
}

/* ============================================
   RESPONSIVE ANIMATIONS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   SPECIAL ACTIVE STATES
   ============================================ */

/* Nav button active fire indicator */
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--red-bright);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--red);
    animation: pulse 1.5s infinite;
}

/* Premium crown spin on hover */
.premium-btn:hover i {
    animation: explosionPop 0.5s ease;
    display: inline-block;
}

/* Recipe card image zoom */
.recipe-card .recipe-img-wrapper {
    overflow: hidden;
}

.recipe-card:hover .recipe-img-wrapper img {
    transform: scale(1.08);
    filter: brightness(1.1) saturate(1.2);
}

/* Exercise card border glow */
.exercise-card:hover {
    border-color: rgba(204,0,0,0.5) !important;
    box-shadow: -4px 0 15px rgba(204,0,0,0.2) inset !important;
}

/* Streak fire effect */
.stat-streak .stat-value {
    animation: fireFlicker 2s infinite;
    color: var(--gold) !important;
    text-shadow: 0 0 20px rgba(255,100,0,0.5);
}

/* Power level number animation */
#powerLevel {
    animation: powerPulse 2s infinite alternate;
}

/* Badge unlock animation */
.badge-card.just-unlocked {
    animation: explosionPop 0.5s ease, neonFlicker 2s 0.5s;
    border-color: var(--gold) !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Input focus effects */
input:focus, select:focus, textarea:focus {
    transition: all 0.3s ease;
}

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotateGlow 0.8s linear infinite;
}

/* ============================================
   AURA COLORS BY LEVEL
   ============================================ */
.aura-bronze { --aura-color: rgba(205,127,50,0.3); }
.aura-silver { --aura-color: rgba(192,192,192,0.3); }
.aura-gold { --aura-color: rgba(255,215,0,0.3); }
.aura-red { --aura-color: rgba(204,0,0,0.3); }
.aura-purple { --aura-color: rgba(150,0,255,0.3); }
.aura-blue { --aura-color: rgba(0,150,255,0.3); }
.aura-legendary { --aura-color: rgba(255,215,0,0.5); }

.power-card .power-aura {
    background: radial-gradient(ellipse at center, var(--aura-color, rgba(204,0,0,0.1)) 0%, transparent 70%);
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */
::selection {
    background: rgba(204,0,0,0.4);
    color: white;
}

/* Smooth transitions for interactive elements */
button, a, input, select {
    transition: all 0.2s ease;
}
