/* ===================================
   SISTEMA DE ANIMACIONES - TRUCO
   =================================== */

/* Animación de repartir cartas */
@keyframes dealCard {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 0;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

/* Animación de jugar carta */
@keyframes playCard {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.1);
    }
    100% {
        transform: translateY(-100px) scale(1);
    }
}

/* Animación de voltear carta */
@keyframes flipCard {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* Animación de carta ganadora */
@keyframes cardWinner {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(67, 233, 123, 0.8),
                    0 0 60px rgba(67, 233, 123, 0.5);
    }
}

/* Animación de carta perdedora */
@keyframes cardLoser {
    0% {
        opacity: 1;
        filter: grayscale(0%);
    }
    100% {
        opacity: 0.4;
        filter: grayscale(80%);
    }
}

/* Animación de bounce al aparecer */
@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animación de salida */
@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Animación de pulso (botones activos) */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(67, 233, 123, 0.6);
    }
}

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

/* Animación de glow (destacar) */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(67, 233, 123, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(67, 233, 123, 0.8),
                    0 0 40px rgba(67, 233, 123, 0.5);
    }
}

/* Animación de confetti */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Animación de partículas */
@keyframes particle-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Animación de número de puntos */
@keyframes pointsUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

/* Animación de slide in desde lado */
@keyframes slideInLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   CLASES PARA APLICAR ANIMACIONES
   =================================== */

.card-deal {
    animation: dealCard 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.card-play {
    animation: playCard 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.card-flip {
    animation: flipCard 0.6s ease-in-out;
}

.card-winner {
    animation: cardWinner 1s ease-in-out;
}

.card-loser {
    animation: cardLoser 0.5s ease-out forwards;
}

.bounce-in {
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* ===================================
   EFECTOS ESPECIALES
   =================================== */

/* Confetti container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #43e97b;
    animation: confetti-fall linear forwards;
}

/* Partículas de explosión */
.particle-container {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: particle-burst 0.8s ease-out forwards;
}

/* Número de puntos flotante */
.points-float {
    position: absolute;
    font-size: 48px;
    font-weight: 900;
    color: #43e97b;
    text-shadow: 0 0 10px rgba(67, 233, 123, 0.8),
                 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: pointsUp 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 9997;
}

/* Glow effect en cartas */
.card-glow {
    position: relative;
}

.card-glow::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #43e97b, #667eea, #43e97b);
    border-radius: 12px;
    opacity: 0;
    z-index: -1;
    animation: glow 2s ease-in-out infinite;
}

/* Hover mejorado en cartas con transición suave */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover:not(.card-disabled) {
    transform: translateY(-15px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(67, 233, 123, 0.3);
}

.card:active:not(.card-disabled) {
    transform: translateY(-10px) scale(1.02);
}

/* Botones con animación de hover */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.95);
}

/* Loading spinner para acciones */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #43e97b;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

/* Delays escalonados para cartas */
.card-deal:nth-child(1) { animation-delay: 0s; }
.card-deal:nth-child(2) { animation-delay: 0.1s; }
.card-deal:nth-child(3) { animation-delay: 0.2s; }

/* Transiciones suaves globales */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}