/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Page Load Animations */
.page-load {
    animation: fadeInUp 0.8s ease-out;
}

.hero-content {
    animation: fadeInLeft 1s ease-out 0.2s both;
}

.hero-image {
    animation: fadeInRight 1s ease-out 0.4s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease-out 0.6s both;
}

/* Section Animations */
.section-title {
    animation: fadeInUp 0.8s ease-out;
}

.feature-card {
    animation: scaleIn 0.6s ease-out;
    animation-fill-mode: both;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }

.step-card {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.step-card:nth-child(1) { animation-delay: 0.1s; }
.step-card:nth-child(2) { animation-delay: 0.2s; }
.step-card:nth-child(3) { animation-delay: 0.3s; }
.step-card:nth-child(4) { animation-delay: 0.4s; }

.faq-item {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.faq-item:nth-child(1) { animation-delay: 0.1s; }
.faq-item:nth-child(2) { animation-delay: 0.2s; }
.faq-item:nth-child(3) { animation-delay: 0.3s; }
.faq-item:nth-child(4) { animation-delay: 0.4s; }

/* Hover Animations */
.feature-card:hover {
    animation: pulse 0.6s ease-in-out;
}

.step-card:hover {
    animation: float 0.6s ease-in-out;
}

.btn:hover {
    animation: bounce 0.6s ease-in-out;
}

/* Icon Animations */
.feature-icon {
    animation: scaleIn 0.8s ease-out 0.5s both;
}

.feature-icon:hover {
    animation: rotate 2s linear infinite;
}

.step-number {
    animation: scaleIn 0.8s ease-out 0.3s both;
}

.step-number:hover {
    animation: pulse 0.6s ease-in-out;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: rotate 1s ease-in-out infinite;
}

/* Scroll-triggered Animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.scroll-animate.animate {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease-out;
}

.scroll-animate-left.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease-out;
}

.scroll-animate-right.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease-out;
}

.scroll-animate-scale.animate {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Animations */
.stagger-animate > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.stagger-animate.animate > * {
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.animate > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animate.animate > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animate.animate > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animate.animate > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animate.animate > *:nth-child(5) { transition-delay: 0.5s; }

/* Special Effects */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-effect:hover::before {
    opacity: 1;
    animation: glow 2s ease-in-out infinite;
}

/* Parallax Effect */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Smooth Reveal */
.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    transform: translateX(-100%);
    transition: transform 0.8s ease;
}

.reveal.animate::after {
    transform: translateX(100%);
}

/* Typing Animation */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-color); }
}

/* Button Click Animation */
.btn-click {
    animation: buttonClick 0.3s ease-out;
}

@keyframes buttonClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Success Animation */
.success-animation {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Error Animation */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Progress Bar Animation */
.progress-bar {
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    to { width: 100%; }
}

/* Card Flip Animation */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .hero-content,
    .hero-image {
        animation-delay: 0.1s;
    }
    
    .feature-card,
    .step-card,
    .faq-item {
        animation-delay: 0.1s;
    }
}

/* Reduced Motion Support */
@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;
    }
    
    .scroll-animate,
    .scroll-animate-left,
    .scroll-animate-right,
    .scroll-animate-scale {
        opacity: 1;
        transform: none;
    }
    
    .stagger-animate > * {
        opacity: 1;
        transform: none;
    }
}

/* Skip link animation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--border-radius);
    z-index: 10000;
    transition: top 0.3s ease;
    font-weight: 500;
}

.skip-link:focus {
    top: 6px;
}

/* Keyboard navigation indicator */
.keyboard-navigation *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Header scroll animations */
.header.scrolled {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header.header-hidden {
    transform: translateY(-100%);
}

/* Statistics counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: countUp 0.6s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Category cards animation */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-card {
    animation: slideInUp 0.6s ease forwards;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }

/* Security features animation */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.security-feature {
    animation: fadeInLeft 0.6s ease forwards;
}

.security-feature:nth-child(1) { animation-delay: 0.1s; }
.security-feature:nth-child(2) { animation-delay: 0.2s; }
.security-feature:nth-child(3) { animation-delay: 0.3s; }
.security-feature:nth-child(4) { animation-delay: 0.4s; }

/* Testimonials animation */
@keyframes testimonialSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.testimonial-card {
    animation: testimonialSlide 0.6s ease forwards;
}

.testimonial-card:nth-child(1) { animation-delay: 0.1s; }
.testimonial-card:nth-child(2) { animation-delay: 0.2s; }
.testimonial-card:nth-child(3) { animation-delay: 0.3s; }

/* Mobile features animation */
@keyframes mobileFeatureSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-feature {
    animation: mobileFeatureSlide 0.5s ease forwards;
}

.mobile-feature:nth-child(1) { animation-delay: 0.1s; }
.mobile-feature:nth-child(2) { animation-delay: 0.2s; }
.mobile-feature:nth-child(3) { animation-delay: 0.3s; }
.mobile-feature:nth-child(4) { animation-delay: 0.4s; }

/* Tournament types animation */
@keyframes tournamentTypeSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tournament-type {
    animation: tournamentTypeSlide 0.5s ease forwards;
}

.tournament-type:nth-child(1) { animation-delay: 0.1s; }
.tournament-type:nth-child(2) { animation-delay: 0.2s; }
.tournament-type:nth-child(3) { animation-delay: 0.3s; }

/* Rewards cards animation */
@keyframes rewardCardPop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.reward-card {
    animation: rewardCardPop 0.6s ease forwards;
}

.reward-card:nth-child(1) { animation-delay: 0.1s; }
.reward-card:nth-child(2) { animation-delay: 0.2s; }
.reward-card:nth-child(3) { animation-delay: 0.3s; }
.reward-card:nth-child(4) { animation-delay: 0.4s; }

/* News cards animation */
@keyframes newsCardSlide {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.news-card {
    animation: newsCardSlide 0.6s ease forwards;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }

/* Requirements grid animation */
@keyframes requirementItemFade {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.requirement-item {
    animation: requirementItemFade 0.5s ease forwards;
}

.requirement-item:nth-child(1) { animation-delay: 0.1s; }
.requirement-item:nth-child(2) { animation-delay: 0.2s; }
.requirement-item:nth-child(3) { animation-delay: 0.3s; }
.requirement-item:nth-child(4) { animation-delay: 0.4s; }
.requirement-item:nth-child(5) { animation-delay: 0.5s; }
.requirement-item:nth-child(6) { animation-delay: 0.6s; }

/* Community features animation */
@keyframes communityFeatureSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.community-feature {
    animation: communityFeatureSlide 0.5s ease forwards;
}

.community-feature:nth-child(1) { animation-delay: 0.1s; }
.community-feature:nth-child(2) { animation-delay: 0.2s; }
.community-feature:nth-child(3) { animation-delay: 0.3s; }
.community-feature:nth-child(4) { animation-delay: 0.4s; }

/* Final CTA animation */
@keyframes finalCTASlide {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.final-cta-content {
    animation: finalCTASlide 0.8s ease forwards;
}

/* Section entrance animations */
@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section.animate-in {
    animation: sectionFadeIn 0.8s ease forwards;
}

/* Enhanced hover animations */
.stat-card:hover .stat-icon {
    animation: pulse 1s infinite;
}

.category-card:hover .category-icon {
    animation: bounce 0.6s ease;
}

.reward-card:hover .reward-icon {
    animation: tada 0.6s ease;
}

.testimonial-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.news-card:hover .news-img {
    transform: scale(1.08);
}

/* Notification animations */
@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notificationSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification {
    animation: notificationSlideIn 0.3s ease forwards;
}

.notification.slide-out {
    animation: notificationSlideOut 0.3s ease forwards;
}

/* Enhanced button hover effects */
.btn-app:hover {
    animation: pulse 0.6s ease;
}

.btn-large:hover {
    animation: bounce 0.6s ease;
}

/* Mobile menu enhanced animations */
.nav-menu.active {
    animation: slideInDown 0.3s ease forwards;
}

.nav-buttons.active {
    animation: slideInDown 0.3s ease forwards;
    animation-delay: 0.1s;
}

/* Progress bar animation for statistics */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    animation: progressFill 2s ease forwards;
    animation-delay: 0.5s;
}

/* Enhanced icon animations */
.icon-users:hover,
.icon-games:hover,
.icon-countries:hover,
.icon-support:hover {
    animation: bounce 0.6s ease;
}

.icon-action:hover,
.icon-strategy:hover,
.icon-puzzle:hover,
.icon-sports:hover {
    animation: pulse 1s infinite;
}

.icon-encryption:hover,
.icon-firewall:hover,
.icon-monitoring:hover,
.icon-backup:hover {
    animation: shake 0.6s ease;
}

/* Shake animation for security icons */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Enhanced mobile responsiveness animations */
@media (max-width: 768px) {
    .stats-grid {
        animation: none;
    }
    
    .stat-card {
        animation: countUp 0.6s ease forwards;
    }
    
    .category-card {
        animation: slideInUp 0.6s ease forwards;
    }
    
    .security-feature {
        animation: fadeInLeft 0.6s ease forwards;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .stat-card,
    .category-card,
    .reward-card,
    .testimonial-card,
    .news-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
