﻿/* ============================================================
   📄 animations.css - انیمیشن‌های سینمایی و گیمینگ M4Store
   🎯 وظیفه: مدیریت تمام انیمیشن‌های صفحه
   👨‍💻 توسعه‌دهنده: تیم M4Store
   ============================================================ */

/* ===== لودینگ اسپلش ===== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

    .loader.hidden {
        opacity: 0;
        visibility: hidden;
    }

.loader-content {
    text-align: center;
}

/* ===== کراس‌هیر لودینگ ===== */
.loader-crosshair {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

    .loader-crosshair span {
        position: absolute;
        background: var(--color-primary);
        border-radius: 2px;
    }

        .loader-crosshair span:nth-child(1),
        .loader-crosshair span:nth-child(2) {
            width: 4px;
            height: 100%;
            left: 50%;
            transform: translateX(-50%);
        }

        .loader-crosshair span:nth-child(3),
        .loader-crosshair span:nth-child(4) {
            width: 100%;
            height: 4px;
            top: 50%;
            transform: translateY(-50%);
        }

        .loader-crosshair span:nth-child(1) {
            animation: crosshair-pulse 1.5s ease-in-out infinite;
        }

        .loader-crosshair span:nth-child(2) {
            animation: crosshair-pulse 1.5s ease-in-out infinite 0.3s;
        }

        .loader-crosshair span:nth-child(3) {
            animation: crosshair-pulse 1.5s ease-in-out infinite 0.6s;
        }

        .loader-crosshair span:nth-child(4) {
            animation: crosshair-pulse 1.5s ease-in-out infinite 0.9s;
        }

@keyframes crosshair-pulse {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.loader-text {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-white);
    margin-bottom: 16px;
}

    .loader-text span {
        color: var(--color-primary);
    }

.loader-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: 4px;
    animation: progress-load 2s ease-in-out forwards;
}

@keyframes progress-load {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* ===== انیمیشن‌های ورود (Fade-in) ===== */
.fade-in {
    opacity: 0;
    animation: fade-in 0.8s ease forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-left {
    opacity: 0;
    animation: fade-in-left 0.8s ease forwards;
}

@keyframes fade-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-right {
    opacity: 0;
    animation: fade-in-right 0.8s ease forwards;
}

@keyframes fade-in-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== انیمیشن Zoom-in ===== */
.zoom-in {
    opacity: 0;
    animation: zoom-in 0.8s ease forwards;
}

@keyframes zoom-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== انیمیشن Slide-up ===== */
.slide-up {
    opacity: 0;
    animation: slide-up 0.8s ease forwards;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== تأخیرهای پلکانی ===== */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

.delay-6 {
    animation-delay: 0.6s;
}

.delay-7 {
    animation-delay: 0.7s;
}

.delay-8 {
    animation-delay: 0.8s;
}

.delay-9 {
    animation-delay: 0.9s;
}

.delay-10 {
    animation-delay: 1s;
}

/* ===== افکت Ripple (موج) ===== */
.ripple {
    position: relative;
    overflow: hidden;
}

    .ripple::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s, opacity 0.6s;
        opacity: 0;
    }

    .ripple:active::after {
        width: 300px;
        height: 300px;
        opacity: 1;
        transition: 0s;
    }

/* ===== افکت Glow ===== */
.glow {
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 191, 255, 0.6), 0 0 80px rgba(0, 191, 255, 0.2);
    }
}

/* ===== افکت 3D Tilt ===== */
.tilt-3d {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

    .tilt-3d:hover {
        transform: rotateX(5deg) rotateY(5deg) scale(1.02);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

/* ===== Parallax ===== */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

/* ===== اسکرول انیمیشن‌ها ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

    .scroll-reveal.visible {
        opacity: 1;
        transform: translateY(0);
    }

/* ===== شمارنده آمار ===== */
.counter-animate {
    font-variant-numeric: tabular-nums;
}

/* ===== انیمیشن تایپ‌رایتر ===== */
.typewriter {
    overflow: hidden;
    border-left: 3px solid var(--color-primary);
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s forwards, blink-caret 0.75s step-end infinite;
    width: 0;
}

@keyframes typewriter {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }

    50% {
        border-color: var(--color-primary);
    }
}

/* ===== انیمیشن پارتیکل ===== */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== انیمیشن شناور ===== */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== انیمیشن چرخش ===== */
.spin {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== انیمیشن پالس ===== */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ===== انیمیشن اسکیل (بزرگ‌نمایی) ===== */
.scale-on-hover {
    transition: transform 0.3s ease;
}

    .scale-on-hover:hover {
        transform: scale(1.05);
    }

/* ===== انیمیشن شاین ===== */
.shine {
    position: relative;
    overflow: hidden;
}

    .shine::before {
        content: '';
        position: absolute;
        top: 0;
        left: -75%;
        width: 50%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        transform: skewX(-25deg);
        animation: shine 3s ease-in-out infinite;
    }

@keyframes shine {
    0% {
        left: -75%;
    }

    100% {
        left: 125%;
    }
}

/* ===== انیمیشن اسلاید (برای اسلایدر) ===== */
.slide-out-left {
    animation: slide-out-left 0.5s ease forwards;
}

@keyframes slide-out-left {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.slide-in-right {
    animation: slide-in-right 0.5s ease forwards;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== انیمیشن‌های فانتزی ===== */
/* 1. انیمیشن ظهور کارت‌ها */
.card-appear {
    animation: card-appear 0.6s ease backwards;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 2. انیمیشن نور افکن */
.spotlight {
    animation: spotlight 4s ease-in-out infinite;
}

@keyframes spotlight {
    0%, 100% {
        box-shadow: 0 0 30px rgba(0, 191, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 60px rgba(0, 191, 255, 0.3), 0 0 120px rgba(0, 191, 255, 0.1);
    }
}

/* 3. انیمیشن سوسو */
.flicker {
    animation: flicker 3s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }

    25% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    75% {
        opacity: 0.6;
    }
}

/* 4. انیمیشن حرکت موجی */
.wave {
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(5deg);
    }

    75% {
        transform: rotate(-5deg);
    }
}

/* 5. انیمیشن کشش */
.stretch {
    animation: stretch 1.5s ease-in-out infinite;
}

@keyframes stretch {
    0%, 100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.2);
    }
}
