/* Animations and Interactive Effects */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4);
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Slide Animations */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Rotation Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateSlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--gold-color);
    }
}

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Apply Animations to Elements */
.hero-title {
    animation: fadeInUp 1s ease-out, textGlow 3s ease-in-out infinite;
}

.hero-description {
    animation: fadeIn 1.2s ease-out 0.3s both;
}

.hero-buttons {
    animation: fadeIn 1.5s ease-out 0.6s both;
}

.game-category {
    animation: scaleIn 0.8s ease-out;
}

.game-category:hover {
    animation: pulse 0.6s ease-in-out;
}

.feature {
    animation: fadeInUp 0.8s ease-out;
}

.feature:hover {
    animation: glow 2s ease-in-out infinite;
}

/* Staggered Animations for Grid Items */
.games-grid .game-category:nth-child(1) {
    animation-delay: 0.1s;
}

.games-grid .game-category:nth-child(2) {
    animation-delay: 0.2s;
}

.games-grid .game-category:nth-child(3) {
    animation-delay: 0.3s;
}

.features-grid .feature:nth-child(1) {
    animation-delay: 0.1s;
}

.features-grid .feature:nth-child(2) {
    animation-delay: 0.2s;
}

.features-grid .feature:nth-child(3) {
    animation-delay: 0.3s;
}

.features-grid .feature:nth-child(4) {
    animation-delay: 0.4s;
}

/* Button Hover Effects */
.btn:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.btn-primary:hover {
    animation: glow 2s ease-in-out infinite;
}

.btn-register:hover {
    animation: pulse 1s ease-in-out infinite;
}

/* Navigation Link Animations */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

/* Logo Animation */
.nav-logo h1 {
    animation: textGlow 3s ease-in-out infinite;
}

.nav-logo h1:hover {
    animation: pulse 1s ease-in-out infinite;
}

/* Floating Elements Enhanced */
.floating-element {
    animation: float 6s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    animation-delay: 0s;
    animation-duration: 8s;
}

.floating-element:nth-child(2) {
    animation-delay: 2s;
    animation-duration: 10s;
}

.floating-element:nth-child(3) {
    animation-delay: 4s;
    animation-duration: 7s;
}

/* Section Entrance Animations */
section {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

section.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
@keyframes loading {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading {
    animation: loading 1s linear infinite;
}

/* Success Animation */
@keyframes success {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success {
    animation: success 0.6s ease-out;
}

/* Error Animation */
@keyframes error {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.error {
    animation: error 0.6s ease-out;
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .hero-title {
        animation: fadeInUp 0.8s ease-out;
    }
    
    .hero-description {
        animation: fadeIn 1s ease-out 0.2s both;
    }
    
    .hero-buttons {
        animation: fadeIn 1.2s ease-out 0.4s both;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-element {
        animation: none;
    }
    
    .hero-title,
    .hero-description,
    .hero-buttons {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
