/* ===== HEROSWIPE<3 - ANIMATIONS ===== */

/* ===== ENHANCED ANIMATED BACKGROUND ===== */
.animated-background {
    position: fixed;
    top: -20px;
    left: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    pointer-events: none;
    z-index: 0;
    background: var(--color-bg-primary);
    opacity: 1;
    transform: translateZ(0); /* Force GPU acceleration */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.animated-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(217, 70, 239, 0.15) 0%, transparent 50%);
    animation: backgroundPulse 8s ease-in-out infinite;
    transform: translateZ(0);
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* ===== ENHANCED PARTICLES SYSTEM ===== */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transform: translateZ(0);
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
    transform: translateZ(0);
}

.particle::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: inherit;
    border-radius: 50%;
    top: -1px;
    left: -1px;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ===== ENHANCED GRADIENT ORBS ===== */
.gradient-orbs {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transform: translateZ(0);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    animation: orbit 20s linear infinite;
    pointer-events: none;
    transform: translateZ(0);
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, rgba(139, 92, 246, 0.1) 70%, transparent 100%);
    top: 10%;
    left: 10%;
    animation-duration: 25s;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.4) 0%, rgba(236, 72, 153, 0.1) 70%, transparent 100%);
    top: 60%;
    right: 20%;
    animation-duration: 30s;
    animation-direction: reverse;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.3) 0%, rgba(217, 70, 239, 0.1) 70%, transparent 100%);
    bottom: 10%;
    left: 30%;
    animation-duration: 35s;
}

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(50px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(50px) rotate(-360deg); }
}

/* ===== CARD ANIMATIONS ===== */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.92) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0deg);
    }
}

/* Enhanced card appearance animation */
@keyframes cardAppearSmooth {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.85) rotate(-2deg);
        filter: blur(8px);
    }
    40% {
        opacity: 0.6;
        transform: translateY(-5px) scale(1.02) rotate(1deg);
        filter: blur(3px);
    }
    70% {
        opacity: 0.9;
        transform: translateY(2px) scale(0.98) rotate(-0.5deg);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
}

/* Card loading animation */
@keyframes cardLoadingPulse {
    0%, 100% {
        background: var(--color-bg-secondary);
        opacity: 0.8;
    }
    50% {
        background: var(--color-bg-tertiary);
        opacity: 1;
    }
}

/* Card image loading shimmer */
@keyframes cardImageShimmer {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Card stack arrangement animation */
@keyframes cardStackSlide {
    0% {
        transform: translateY(60px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Card hover/focus animations */
@keyframes cardHover {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: var(--shadow-lg);
    }
    100% {
        transform: translateY(-5px) scale(1.02);
        box-shadow: var(--shadow-2xl);
    }
}

/* Card removal animation (for smooth transitions) */
@keyframes cardRemove {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes heroSummon {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Enhanced card states */
.card-entering {
    animation: cardAppearSmooth 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.card-loading {
    animation: cardLoadingPulse 1.5s ease-in-out infinite;
}

.card-loading .card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: cardImageShimmer 1.8s ease-in-out infinite;
}

.card-hover {
    animation: cardHover 0.3s ease-out forwards;
}

.card-removing {
    animation: cardRemove 0.3s ease-in forwards;
}

.card-stacked {
    animation: cardStackSlide 0.5s ease-out forwards;
}

/* Card stacking delays for smoother appearance */
.card-stacked:nth-child(1) { animation-delay: 0ms; }
.card-stacked:nth-child(2) { animation-delay: 100ms; }
.card-stacked:nth-child(3) { animation-delay: 200ms; }
.card-stacked:nth-child(4) { animation-delay: 300ms; }
.card-stacked:nth-child(5) { animation-delay: 400ms; }

/* ===== SWIPE ANIMATIONS ===== */
.card.swipe-right {
    transform: translateX(100vw) rotate(30deg) !important;
    opacity: 0 !important;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease !important;
}

.card.swipe-left {
    transform: translateX(-100vw) rotate(-30deg) !important;
    opacity: 0 !important;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease !important;
}

/* Enhanced drag states - ensure proper override */
.card.dragging {
    z-index: 100 !important;
    cursor: grabbing !important;
    transition: none !important;
    will-change: transform !important;
    animation: none !important;
}

.card.snap-back {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease !important;
    will-change: transform, opacity !important;
}

.card.smooth-transition {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
    will-change: transform, opacity !important;
}

/* ===== BUTTON ANIMATIONS ===== */
@keyframes logoGlow {
    0% { filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.3)); }
    100% { filter: drop-shadow(0 2px 8px rgba(236, 72, 153, 0.5)); }
}

@keyframes filterPulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
}

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

@keyframes rejectPulse {
    0%, 100% { transform: scale(1.3) rotate(-15deg); }
    50% { transform: scale(1.5) rotate(-20deg); }
}

@keyframes infoPulse {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1.3); }
    25% { transform: scale(1.5); }
    50% { transform: scale(1.4); }
    75% { transform: scale(1.6); }
}

/* Enhanced button press animation */
@keyframes buttonPress {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(1px) scale(0.98);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Enhanced button hover animation */
@keyframes buttonHover {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: var(--shadow-md);
    }
    100% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: var(--shadow-lg);
    }
}

/* Improved ripple effect */
@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Button loading animation */
@keyframes buttonLoading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Action button specific animations */
@keyframes actionButtonPress {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(2px) scale(0.95);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Header button animations */
@keyframes headerButtonHover {
    0% {
        transform: scale(1);
        background: var(--color-bg-tertiary);
    }
    100% {
        transform: scale(1.05);
        background: var(--color-bg-secondary);
    }
}

/* Enhanced button states */
.btn-hover {
    animation: buttonHover 0.2s ease-out forwards;
}

.btn-press {
    animation: buttonPress 0.15s ease-out;
}

.btn-loading {
    position: relative;
    pointer-events: none;
    overflow: hidden;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%
    );
    animation: buttonLoading 1.2s ease-in-out infinite;
}

.action-btn-press {
    animation: actionButtonPress 0.2s ease-out;
}

.header-btn-hover {
    animation: headerButtonHover 0.2s ease-out forwards;
}

/* Enhanced ripple animation */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out;
}

/* Dark theme ripple */
[data-theme="dark"] .ripple {
    background: rgba(255, 255, 255, 0.3);
}

/* Button focus animations */
@keyframes buttonFocus {
    0% {
        box-shadow: 0 0 0 0 var(--color-primary);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.3);
    }
}

.btn-focus {
    animation: buttonFocus 0.2s ease-out forwards;
}

/* Enhanced button press effects */
.header-btn::after,
.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                height 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}

.header-btn:active::after,
.action-btn:active::after {
    width: 100px;
    height: 100px;
    opacity: 1;
    transition: width 0.1s ease, height 0.1s ease, opacity 0.1s ease;
}

.header-btn:active::after {
    animation: rippleExpand 0.4s ease-out;
}

.action-btn:active::after {
    animation: rippleExpand 0.5s ease-out;
}

/* Button interaction states */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-disabled:hover {
    animation: none !important;
    transform: none !important;
}

/* ===== STAT ANIMATIONS ===== */
@keyframes statIconPulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.3); }
}

@keyframes statValuePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Minimal loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== MODAL ANIMATIONS ===== */
@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

/* Enhanced modal entry animation */
@keyframes modalEnter {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
        filter: blur(10px);
    }
    60% {
        opacity: 0.8;
        transform: translateY(10px) scale(1.02);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Enhanced modal exit animation */
@keyframes modalExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
        filter: blur(5px);
    }
}

/* Modal backdrop animations */
@keyframes backdropEnter {
    0% {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

@keyframes backdropExit {
    0% {
        opacity: 1;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    100% {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
}

/* Match modal specific animations */
@keyframes matchModalEnter {
    0% {
        opacity: 0;
        transform: translateY(-100px) scale(0.8) rotate(-2deg);
        filter: blur(15px);
    }
    40% {
        opacity: 0.7;
        transform: translateY(20px) scale(1.05) rotate(1deg);
        filter: blur(5px);
    }
    70% {
        opacity: 0.9;
        transform: translateY(-5px) scale(0.98) rotate(-0.5deg);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
}

/* Character modal specific animations */
@keyframes characterModalEnter {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.85);
        filter: blur(8px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1.03);
        filter: blur(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Settings modal specific animations */
@keyframes settingsModalEnter {
    0% {
        opacity: 0;
        transform: translateX(50px) scale(0.9);
        filter: blur(6px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Chat modal specific animations */
@keyframes chatModalEnter {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0.8);
        filter: blur(10px);
    }
    60% {
        opacity: 0.9;
        transform: translateY(-10px) scale(1.02);
        filter: blur(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Staggered modal element animations */
@keyframes modalElementSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal button animations */
@keyframes modalButtonEnter {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== RIPPLE ANIMATION ===== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Enhanced button press effects */
.header-btn::after,
.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                height 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}

.header-btn:active::after,
.action-btn:active::after {
    width: 100px;
    height: 100px;
    opacity: 1;
    transition: width 0.1s ease, height 0.1s ease, opacity 0.1s ease;
}

.header-btn:active::after {
    animation: rippleExpand 0.4s ease-out;
}

.action-btn:active::after {
    animation: rippleExpand 0.5s ease-out;
}

/* Button interaction states */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-disabled:hover {
    animation: none !important;
    transform: none !important;
}

/* Performance optimizations - removed from .card to prevent drag conflicts */
.modal-content,
.btn,
.header-btn,
.action-btn {
    will-change: auto; /* Only apply when needed */
    backface-visibility: hidden;
}

/* Cards get performance optimization only when not being dragged */
.card {
    backface-visibility: hidden;
}

.card:not(.dragging) {
    will-change: auto;
}

.loading-spinner {
    will-change: transform;
    transform: translateZ(0);
}

/* Enhanced performance for animations */
.modal-entering,
.modal-exiting,
.btn-hover,
.btn-press {
    will-change: transform, opacity;
}

/* Card animations only when not dragging */
.card-entering:not(.dragging),
.card-loading:not(.dragging),
.card-stacked:not(.dragging) {
    will-change: transform, opacity;
}

/* Remove will-change after animations complete */
.card-entering,
.card-loading,
.card-stacked {
    animation-fill-mode: both;
}

/* Missing transitions for smooth interactions */
.swipe-indicator {
    transition: opacity 0.2s ease, transform 0.2s ease, scale 0.2s ease;
}

.swipe-indicator.show {
    transition: opacity 0.15s ease, transform 0.15s ease, scale 0.15s ease;
}

.game-controls {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.stats-container {
    transition: all 0.3s ease;
}

.loading-progress-bar {
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.loading-text {
    transition: opacity 0.2s ease;
}

/* Enhanced form transitions */
.form-input,
.form-select,
.form-textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    transition: border-color 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

/* Tab transitions */
.tab-btn {
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.tab-btn::after {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Collection item transitions */
.collection-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.collection-item:hover {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Chat message transitions */
.chat-message {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.typing-indicator {
    transition: opacity 0.2s ease;
}

/* Theme transition */
[data-theme="dark"] * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .card,
    .modal-content,
    .btn {
        will-change: auto;
    }
}

/* Ensure smooth animations on mobile */
@media (max-width: 768px) {
    /* Remove performance optimizations from cards to prevent drag conflicts */
    .modal-content {
        will-change: transform, opacity;
    }
    
    /* Optimize animations for mobile performance */
    .card-entering:not(.dragging),
    .modal-entering {
        animation-duration: 0.4s;
    }
    
    .btn-hover,
    .btn-press {
        animation-duration: 0.1s;
    }
} 

/* ===== CARD STACK TRANSITION ANIMATIONS ===== */

/* Smooth transitions for card stack repositioning */
@keyframes cardMoveToFront {
    0% {
        transform: scale(0.95) translateY(4px);
        z-index: var(--z-0);
    }
    100% {
        transform: scale(1) translateY(0);
        z-index: var(--z-10);
    }
}

@keyframes cardMoveToSecond {
    0% {
        transform: scale(0.9) translateY(8px);
        z-index: var(--z-hide);
    }
    100% {
        transform: scale(0.95) translateY(4px);
        z-index: var(--z-0);
    }
}

@keyframes cardMoveToThird {
    0% {
        transform: scale(0.85) translateY(12px);
        z-index: calc(var(--z-hide) - 1);
    }
    100% {
        transform: scale(0.9) translateY(8px);
        z-index: var(--z-hide);
    }
}

/* Classes for smooth card stack transitions */
.card-move-to-front {
    animation: cardMoveToFront 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.card-move-to-second {
    animation: cardMoveToSecond 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.card-move-to-third {
    animation: cardMoveToThird 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Enhanced card appearance with staggered delays */
@keyframes cardSlideInFromBack {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(0.9) translateY(8px);
    }
}

.card-slide-in-from-back {
    animation: cardSlideInFromBack 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Stack transitioning state */
.card.stack-transitioning {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                z-index 0.4s ease !important;
} 