/* ========================================
   MAIN.CSS - Animazioni & Effetti Speciali
   Mood Academy TCG
   ======================================== */

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

/* --- COMBAT ANIMATIONS --- */

/* Animazione danno numerico */
@keyframes damage-float {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -120%) scale(1.3);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -200%) scale(1.5);
    }
}

/* Shake effect quando subisce danno */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Esplosione carta distrutta */
@keyframes explode {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2) rotate(90deg);
        filter: brightness(2);
    }
    60% {
        opacity: 0.5;
        transform: scale(1.5) rotate(270deg);
        filter: brightness(3) blur(5px);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(540deg);
        filter: brightness(0) blur(20px);
    }
}

/* Pulse per bersagli combattimento */
@keyframes pulse-combat {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 68, 68, 1);
        transform: scale(1.05);
    }
}

/* --- MOOD ANIMATIONS --- */

/* Pulse per carte assegnabili mood */
@keyframes pulse-mood {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 204, 0, 1);
        transform: scale(1.03);
    }
}

/* Bounce indicatore mood */
@keyframes bounce {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
    }
    50% { 
        transform: translate(-50%, -60%) scale(1.1); 
    }
}

/* Glow mood positivo */
@keyframes glow-positive {
    0%, 100% {
        box-shadow: 0 0 10px rgba(68, 255, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(68, 255, 68, 1);
    }
}

/* Glow mood negativo */
@keyframes glow-negative {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 68, 68, 1);
    }
}

/* --- CARD ENTRY ANIMATIONS --- */

/* Carta entra in campo (draw) */
@keyframes card-enter {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8) rotateY(180deg);
    }
    60% {
        opacity: 1;
        transform: translateY(10px) scale(1.1) rotateY(0deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateY(0deg);
    }
}

/* Carta entra in mano */
@keyframes card-to-hand {
    0% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Carta entra in campo da mano */
@keyframes card-play {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3) rotateY(180deg);
        filter: brightness(1.5);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(360deg);
        filter: brightness(1);
    }
}

/* --- DECK ANIMATIONS --- */

/* Shuffle deck */
@keyframes shuffle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

/* Deck glow quando attivo */
@keyframes deck-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 1);
    }
}

/* --- UI ANIMATIONS --- */

/* Fade in generale */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Fade out generale */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Slide from top */
@keyframes slideFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide to top */
@keyframes slideToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* Scale in */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rotate in */
@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

/* --- SPECIAL EFFECTS --- */

/* Sparkle effect (per carte rare) */
@keyframes sparkle {
    0%, 100% {
        box-shadow: 
            0 0 5px rgba(255, 215, 0, 0.5),
            0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 30px rgba(255, 215, 0, 0.5),
            0 0 40px rgba(255, 215, 0, 0.3);
    }
}

/* Rainbow glow (per union cards) */
@keyframes rainbow-glow {
    0% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.8); }
    20% { box-shadow: 0 0 20px rgba(255, 255, 0, 0.8); }
    40% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.8); }
    60% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.8); }
    80% { box-shadow: 0 0 20px rgba(0, 0, 255, 0.8); }
    100% { box-shadow: 0 0 20px rgba(255, 0, 255, 0.8); }
}

/* Float animation (hover su carte) */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Classe per applicare animazioni */
.animate-damage {
    animation: damage-float 1s ease-out forwards;
}

.animate-shake {
    animation: shake 0.5s ease;
}

.animate-explode {
    animation: explode 0.8s ease-out forwards;
}

.animate-card-enter {
    animation: card-enter 0.6s ease-out;
}

.animate-card-play {
    animation: card-play 0.8s ease;
}

.animate-shuffle {
    animation: shuffle 0.8s ease;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease;
}

.animate-float {
    animation: float 2s ease-in-out infinite;
}

.animate-sparkle {
    animation: sparkle 2s ease-in-out infinite;
}

.animate-rainbow {
    animation: rainbow-glow 3s linear infinite;
}

/* ========================================
   RARITY EFFECTS (Gold, Silver, Rainbow)
   ======================================== */

/* Gold cards - Sparkle effect */
.card-rarity-gold {
    animation: sparkle 2s ease-in-out infinite;
    border: 2px solid gold;
}

/* Silver cards - Soft glow */
.card-rarity-silver {
    animation: glow-positive 2s ease-in-out infinite;
    border: 2px solid silver;
}

/* Rainbow cards (Union) - Rainbow glow */
.card-rarity-rainbow {
    animation: rainbow-glow 3s linear infinite;
    border: 2px solid transparent;
    background: linear-gradient(135deg, 
        rgba(255,0,0,0.2), 
        rgba(255,255,0,0.2), 
        rgba(0,255,0,0.2), 
        rgba(0,255,255,0.2), 
        rgba(0,0,255,0.2), 
        rgba(255,0,255,0.2)
    );
}

/* ========================================
   VIDEO EFFECTS (per future implementazioni)
   ======================================== */

/* Placeholder per video background carte speciali */
.card-video-background {
    position: relative;
    overflow: hidden;
}

.card-video-background video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    z-index: 0;
    opacity: 0.6;
}

.card-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, 
        rgba(0,0,0,0.3) 0%, 
        rgba(0,0,0,0.1) 50%, 
        rgba(0,0,0,0.3) 100%
    );
    z-index: 1;
}

/* Effetto particelle (per carte leggendarie) */
.card-particles {
    position: relative;
}

.card-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, 
        rgba(255,255,255,0.8) 1px, 
        transparent 1px
    );
    background-size: 50px 50px;
    animation: particles-float 20s linear infinite;
    opacity: 0.3;
    pointer-events: none;
}

@keyframes particles-float {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* ========================================
   TRANSITION DEFAULTS
   ======================================== */

/* Smooth transitions per tutte le carte */
.card-dynamic,
.field-card,
.hand-card {
    transition: all 0.3s ease;
}

/* Hover effect migliorato */
.card-dynamic:hover,
.field-card:hover,
.hand-card:hover {
    transform: translateY(-5px) scale(1.02);
    filter: brightness(1.2);
    z-index: 100;
}

/* ========================================
   RESPONSIVE ANIMATIONS
   ======================================== */

/* Mobile - riduci intensità animazioni */
@media (max-width: 768px) {
    .animate-shake {
        animation: shake 0.3s ease;
    }
    
    .animate-explode {
        animation: explode 0.5s ease-out forwards;
    }
    
    .card-dynamic:hover,
    .field-card:hover,
    .hand-card:hover {
        transform: translateY(-3px) scale(1.01);
    }
}

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

/* ========================================
   COMBAT UI SPECIFIC
   ======================================== */

/* Studenti pronti al combattimento */
.combat-ready {
    border: 3px solid #00d4ff !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8) !important;
    cursor: pointer !important;
    animation: deck-glow 1.5s ease-in-out infinite;
}

.combat-ready:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 0 30px rgba(0, 212, 255, 1) !important;
}

/* Bersagli evidenziati */
.combat-target {
    border: 4px solid #ff4444 !important;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.9) !important;
    animation: pulse-combat 1s infinite;
    cursor: crosshair !important;
}

.combat-target:hover {
    transform: scale(1.08);
    box-shadow: 0 0 50px rgba(255, 68, 68, 1) !important;
}

/* ========================================
   FUTURE FEATURES PLACEHOLDERS
   ======================================== */

/* Placeholder per effetti sonori visuali */
.sound-wave-effect {
    /* Da implementare con SVG/Canvas */
}

/* Placeholder per trail effects */
.card-trail-effect {
    /* Da implementare per carte in movimento */
}

/* Placeholder per weather effects */
.field-weather-effect {
    /* Es. pioggia, neve per ambientazioni speciali */
}
