/* ============================================
   ANIMATIONS.CSS - Global Keyframes & Utility Animations
   F1Key Website - Enterprise Software Engineering
   ============================================ */

/* ==================== */
/* UTILITY ANIMATION CLASSES */
/* ==================== */

/* Fade In */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
.fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
    animation: fadeInDown 0.8s ease forwards;
}

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

/* Fade In Left */
.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    animation: fadeInLeft 0.8s ease forwards;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    animation: fadeInRight 0.8s ease forwards;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.6s ease forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== */
/* PULSE ANIMATIONS */
/* ==================== */

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-subtle {
    animation: pulseSubtle 3s ease-in-out infinite;
}

@keyframes pulseSubtle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ==================== */
/* BOUNCE ANIMATIONS */
/* ==================== */

.bounce {
    animation: bounce 1s ease infinite;
}

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

.bounce-in {
    animation: bounceIn 0.8s ease forwards;
}

@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);
    }
}

/* ==================== */
/* SHAKE ANIMATION */
/* ==================== */

.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 ANIMATIONS */
/* ==================== */

.rotate-in {
    animation: rotateIn 0.8s ease forwards;
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* ==================== */
/* SLIDE ANIMATIONS */
/* ==================== */

.slide-in-left {
    animation: slideInLeft 0.6s ease forwards;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-right {
    animation: slideInRight 0.6s ease forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== */
/* GLOW ANIMATION */
/* ==================== */

.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(220, 20, 60, 0.5),
                    0 0 10px rgba(220, 20, 60, 0.3);
    }
    to {
        box-shadow: 0 0 10px rgba(220, 20, 60, 0.8),
                    0 0 20px rgba(220, 20, 60, 0.5),
                    0 0 30px rgba(220, 20, 60, 0.3);
    }
}

/* ==================== */
/* TEXT ANIMATIONS */
/* ==================== */

.text-shine {
    background: linear-gradient(
        90deg,
        var(--color-white) 0%,
        var(--color-ferrari-red) 50%,
        var(--color-white) 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShine 3s linear infinite;
}

@keyframes textShine {
    to {
        background-position: 200% center;
    }
}

.typing {
    overflow: hidden;
    border-right: 2px solid var(--color-ferrari-red);
    white-space: nowrap;
    animation: typing 3s steps(40) 1s 1 normal both,
               blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--color-ferrari-red);
    }
}

/* ==================== */
/* GRADIENT ANIMATIONS */
/* ==================== */

.gradient-shift {
    background: linear-gradient(
        -45deg,
        var(--color-black),
        var(--color-dark-gray),
        var(--color-ferrari-red),
        var(--color-black)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ==================== */
/* LOADING ANIMATIONS */
/* ==================== */

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* ==================== */
/* DELAY UTILITIES */
/* ==================== */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ==================== */
/* DURATION UTILITIES */
/* ==================== */

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }

/* ==================== */
/* SCROLL INDICATOR */
/* ==================== */

.scroll-indicator {
    width: 30px;
    height: 50px;
    border: 2px solid var(--color-ferrari-red);
    border-radius: 15px;
    position: relative;
}

.scroll-indicator::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-ferrari-red);
    border-radius: 50%;
    animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
    0% {
        top: 10px;
        opacity: 1;
    }
    100% {
        top: 30px;
        opacity: 0;
    }
}

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

/* Use GPU acceleration for transforms */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Optimize animations for 60fps */
@media (prefers-reduced-motion: no-preference) {
    * {
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* ==================== */
/* REDUCED MOTION SUPPORT */
/* ==================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .pulse,
    .pulse-subtle,
    .bounce,
    .spin,
    .glow,
    .text-shine,
    .gradient-shift {
        animation: none !important;
    }
}

/* ==================== */
/* PRINT STYLES */
/* ==================== */

@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
