/* ================================================================
   ElecApp — انیمیشن‌های پیشرفته
   ================================================================ */

/* ---- Entrance Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Continuous Animations ---- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

@keyframes floatReverse {
    0%, 100% { transform: translateY(-10px); }
    50% { transform: translateY(6px); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.96); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,102,255,0.3); }
    50% { box-shadow: 0 0 20px 8px rgba(0,102,255,0.1); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes electricLine {
    0% { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

@keyframes bolt {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Particle / Blob animations ---- */
@keyframes blob {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: scale(1); }
    25% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: scale(1.05); }
    50% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; transform: scale(0.98); }
    75% { border-radius: 40% 60% 60% 40% / 40% 70% 30% 60%; transform: scale(1.02); }
}

/* ---- Utility animation classes ---- */
.animate-fade-up { animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.animate-fade-down { animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.animate-fade-right { animation: fadeInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.animate-scale-in { animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-float-slow { animation: float 5s ease-in-out infinite; }
.animate-float-reverse { animation: floatReverse 4s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2.5s ease-in-out infinite; }
.animate-bolt { animation: bolt 1.5s ease-in-out infinite; }


/* ---- Scroll-reveal animation ---- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ---- Skeleton loading ---- */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--border-color) 25%,
        var(--bg-card-hover) 37%,
        var(--border-color) 63%
    );
    background-size: 400% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: var(--border-radius-sm);
}

/* ---- Counter animation ---- */
.counter-value {
    animation: countUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ---- Hero animations ---- */
.hero-blob {
    animation: blob 8s ease-in-out infinite;
}

.hero-blob-2 {
    animation: blob 10s ease-in-out infinite reverse;
    animation-delay: -3s;
}

/* ---- Electricity effect ---- */
.electric-border {
    position: relative;
    overflow: hidden;
}

.electric-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        var(--primary), var(--energy-green), var(--energy-purple), var(--primary));
    border-radius: inherit;
    z-index: -1;
    background-size: 300% 300%;
    animation: electricBorder 3s ease infinite;
}

@keyframes electricBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Typing cursor ---- */
.typing-cursor::after {
    content: '|';
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Ripple effect on buttons ---- */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

/* ---- Number ticker ---- */
@keyframes tickUp {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ---- Gradient text shimmer ---- */
.shimmer-text {
    background: linear-gradient(
        90deg,
        var(--primary) 0%,
        var(--energy-green) 30%,
        var(--energy-purple) 60%,
        var(--primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

/* ---- Underline draw ---- */
.underline-draw {
    position: relative;
    display: inline-block;
}

.underline-draw::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(to left, var(--primary), var(--energy-green));
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.underline-draw.active::after,
.underline-draw:hover::after { width: 100%; }


/* ---- زمان‌بندی انیمیشن ---- */
.delay-100 { animation-delay: 0.1s !important; }
.delay-200 { animation-delay: 0.2s !important; }
.delay-300 { animation-delay: 0.3s !important; }
.delay-400 { animation-delay: 0.4s !important; }
.delay-500 { animation-delay: 0.5s !important; }
.delay-600 { animation-delay: 0.6s !important; }
.delay-700 { animation-delay: 0.7s !important; }
.delay-800 { animation-delay: 0.8s !important; }

/* ---- کاهش انیمیشن برای کاربران حساس ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
