/**
 * Modern Animations & Interactive Effects
 * Bakersfield eSports - 2025
 */

/* ============================================
   SMOOTH SCROLL
   ============================================ */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* ============================================
   ENHANCED CARD HOVER EFFECTS
   ============================================ */

/* 3D Tilt & Glow Effect */
.event-item,
.card,
.location-item,
.rate-item,
.game-item {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

/* Hover state with 3D lift and glow */
.event-item:hover,
.card:hover,
.location-item:hover,
.rate-item:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(236, 25, 77, 0.3),
        inset 0 0 0 1px rgba(236, 25, 77, 0.2);
}

/* Neon border glow on hover */
.event-item::before,
.card::before,
.location-item::before,
.rate-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, #EC194D, #ff6b9d, #EC194D);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.event-item:hover::before,
.card:hover::before,
.location-item:hover::before,
.rate-item:hover::before {
    opacity: 1;
}

/* Shine effect on hover */
.event-item::after,
.card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.event-item:hover::after,
.card:hover::after {
    opacity: 1;
    left: 100%;
}

/* ============================================
   BUTTON MICRO-INTERACTIONS
   ============================================ */

/* Ripple effect container */
.btn,
.btn-primary,
button {
    position: relative;
    overflow: visible; /* Changed from hidden to prevent text clipping on transform */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Button hover state */
.btn:hover,
.btn-primary:hover,
button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 10px 25px rgba(236, 25, 77, 0.4),
        0 0 20px rgba(236, 25, 77, 0.3);
}

/* Button active state */
.btn:active,
.btn-primary:active,
button:active {
    transform: translateY(-1px) scale(1.02);
}

/* Ripple effect */

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Pulse animation for CTA buttons */
.btn-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(236, 25, 77, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(236, 25, 77, 0);
    }
}

/* ============================================
   ANIMATED HERO SECTION
   ============================================ */

/* Neon glow text effect */
.hero h1,
.hero-page h1 {
    animation: neon-glow 2.5s ease-in-out infinite alternate;
    position: relative;
}

@keyframes neon-glow {
    from {
        text-shadow:
            0 0 10px #EC194D,
            0 0 20px #EC194D,
            0 0 30px #EC194D,
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    to {
        text-shadow:
            0 0 20px #EC194D,
            0 0 30px #EC194D,
            0 0 40px #EC194D,
            0 0 50px #EC194D,
            0 0 60px #ff1744,
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* Animated gradient background overlay */
.hero::before,
.hero-page::before {
    animation: gradient-shift 8s ease infinite;
    background: linear-gradient(
        45deg,
        rgba(236, 25, 77, 0.3),
        rgba(18, 18, 18, 0.8),
        rgba(236, 25, 77, 0.3)
    );
    background-size: 200% 200%;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Hero content fade-in animation */
.hero-content {
    animation: hero-fade-in 1s ease-out;
}

@keyframes hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating animation for hero elements */
.hero-floating {
    animation: float 3s ease-in-out infinite;
}

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

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

/* Fade in from bottom */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Fade in from left */
.animate-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-slide-left.animated {
    opacity: 1;
    transform: translateX(0);
}

/* Fade in from right */
.animate-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-slide-right.animated {
    opacity: 1;
    transform: translateX(0);
}

/* Scale up animation */
.animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-scale.animated {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation delays for grid items */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger-animation.animated > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation.animated > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation.animated > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation.animated > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation.animated > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation.animated > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-animation.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   IMAGE HOVER EFFECTS
   ============================================ */

/* Image zoom on hover */
.event-item img,
.card img,
.gallery-thumbnail {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.event-item:hover img,
.card:hover img,
.gallery-thumbnail:hover {
    transform: scale(1.1) rotate(2deg);
}

/* Image brightness boost on hover */
.event-item img,
.card img {
    filter: brightness(0.9);
    transition: filter 0.3s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.event-item:hover img,
.card:hover img {
    filter: brightness(1.1);
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Enhanced loading spinner */
.loading {
    position: relative;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(236, 25, 77, 0.2);
    border-top-color: var(--primary-color);
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 20px rgba(236, 25, 77, 0.5);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   NAVIGATION ENHANCEMENTS
   ============================================ */

/* Navbar on scroll - smaller and shadowed */
.navbar {
    transition: all 0.3s ease;
}

.navbar.scrolled {
    padding: 0.5em 1em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background-color: rgba(3, 2, 2, 0.95);
    backdrop-filter: blur(10px);
}

.navbar.scrolled .logo img {
    height: 40px;
}

/* Nav link hover effect */
.nav-menu a {
    position: relative;
    padding-bottom: 5px;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #EC194D, #ff6b9d);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu a:hover::after {
    width: 100%;
}

/* ============================================
   GLASSMORPHISM EFFECTS
   ============================================ */

.glass-effect {
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(236, 25, 77, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

/* Bounce attention grabber */
.bounce {
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

/* Shake for errors */
.shake {
    animation: shake 0.5s ease;
}

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

/* Rotate animation */
.rotate-on-hover {
    transition: transform 0.4s ease;
}

.rotate-on-hover:hover {
    transform: rotate(360deg);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU acceleration for animations */
.event-item,
.card,
.btn,
.hero h1 {
    will-change: transform;
}

/* 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;
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .event-item:hover,
    .card:hover,
    .location-item:hover {
        transform: translateY(-8px) scale(1.01);
    }

    /* Simplify glow effects on mobile */
    @keyframes neon-glow {
        from {
            text-shadow:
                0 0 10px #EC194D,
                2px 2px 4px rgba(0, 0, 0, 0.8);
        }
        to {
            text-shadow:
                0 0 20px #EC194D,
                0 0 30px #EC194D,
                2px 2px 4px rgba(0, 0, 0, 0.8);
        }
    }
}

/* ============================================
   BUTTON TEXT FIX - Updated
   ============================================ */

/* Ensure button content stays visible and on top */
.btn,
.btn-primary,
button {
    position: relative;
    z-index: 1;
}

/* Button text should be above ripple effect */
.btn *,
.btn-primary *,
button * {
    position: relative;
    z-index: 2;
    pointer-events: none; /* Prevent text from blocking click events */
}

/* Ripple should be behind text */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
    z-index: 1; /* Behind text but above button background */
}
