/* ============================================
   ANIMATIONS & KEYFRAMES
   Cup Code Studio - 2026
============================================ */

/* ============================================
   FADE IN ANIMATIONS
============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Animation Classes - With fallback for no-JS */
.animate-fade-in-up,
.animate-fade-in-down,
.animate-fade-in {
    /* Visible by default - فقط اخفي إذا JS يعمل */
    opacity: 1;
}

/* إذا JavaScript يعمل، العناصر تبدأ مخفية */
.js-enabled .animate-fade-in-up,
.js-enabled .animate-fade-in-down,
.js-enabled .animate-fade-in {
    opacity: 0;
}

/* التحريكات عند الظهور */
.animate-fade-in-up.active,
.js-enabled .animate-fade-in-up.active {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 1;
}

.animate-fade-in-down.active,
.js-enabled .animate-fade-in-down.active {
    animation: fadeInDown 0.8s ease-out forwards;
    opacity: 1;
}

.animate-fade-in.active,
.js-enabled .animate-fade-in.active {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 1;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }

/* ============================================
   FLOATING ANIMATIONS
============================================ */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-float-slow {
    animation: floatSlow 5s ease-in-out infinite;
}

/* ============================================
   STEAM ANIMATION (Coffee Cup)
============================================ */
@keyframes steam-rise {
    0% {
        opacity: 0;
        transform: translateY(0) scaleX(1);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-20px) scaleX(1.5);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scaleX(2);
    }
}

/* ============================================
   SCROLL WHEEL ANIMATION
============================================ */
@keyframes scroll-wheel {
    0% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
}

/* ============================================
   PULSE ANIMATIONS
============================================ */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(118, 173, 63, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(118, 173, 63, 0.8);
    }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   ROTATE ANIMATIONS
============================================ */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotate-reverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

.animate-rotate-reverse {
    animation: rotate-reverse 15s linear infinite;
}

/* ============================================
   BOUNCE ANIMATIONS
============================================ */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* ============================================
   SLIDE ANIMATIONS
============================================ */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

html[lang="ar"] .animate-slide-in {
    animation: slideInRight 0.8s ease-out;
}

html[lang="en"] .animate-slide-in {
    animation: slideInLeft 0.8s ease-out;
}

/* ============================================
   SCALE ANIMATIONS
============================================ */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleDown {
    from {
        opacity: 0;
        transform: scale(1.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-up {
    animation: scaleUp 0.5s ease-out;
}

/* ============================================
   SHIMMER / SHINE EFFECT
============================================ */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

/* ============================================
   GRADIENT ANIMATION
============================================ */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 5s ease infinite;
}

/* ============================================
   PARTICLES ANIMATION
============================================ */
@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 15s linear infinite;
}

/* ============================================
   TYPING ANIMATION
============================================ */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--color-leaf-green);
    white-space: nowrap;
    animation: typing 3.5s steps(40) 1s 1 normal both,
               blink 0.75s step-end infinite;
}

/* ============================================
   WAVE ANIMATION
============================================ */
@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-15deg);
    }
}

.wave {
    display: inline-block;
    animation: wave 1.5s ease-in-out infinite;
}

/* ============================================
   GLITCH EFFECT
============================================ */
@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

.glitch-effect:hover {
    animation: glitch 0.3s ease-in-out;
}

/* ============================================
   LOADING ANIMATIONS
============================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 4px solid rgba(118, 173, 63, 0.2);
    border-top-color: var(--color-leaf-green);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* ============================================
   REVEAL ANIMATIONS (On Scroll)
============================================ */
/* Reveal animations - مرئية افتراضياً */
.reveal {
    opacity: 1;
    transform: translateY(0);
}

/* إخفاء فقط إذا JS يعمل */
.js-enabled .reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 1;
    transform: translateX(0);
}

.js-enabled .reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease-out;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 1;
    transform: translateX(0);
}

.js-enabled .reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease-out;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   HOVER EFFECTS
============================================ */
.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(118, 173, 63, 0.6);
}

/* ============================================
   TEXT EFFECTS
============================================ */
@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(118, 173, 63, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(118, 173, 63, 0.8),
                     0 0 30px rgba(118, 173, 63, 0.6);
    }
}

.text-glow {
    animation: text-glow 2s ease-in-out infinite;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}
