/* ===============================================
   Animation Keyframes
   =============================================== */

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 41, 41, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 41, 41, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 41, 41, 0);
    }
}

/* Glow Pulse Animation */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 41, 41, 0.5),
                    0 0 40px rgba(255, 41, 41, 0.3),
                    0 0 60px rgba(255, 41, 41, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 41, 41, 0.8),
                    0 0 60px rgba(255, 41, 41, 0.5),
                    0 0 90px rgba(255, 41, 41, 0.3);
    }
}

/* Scale Up Animation */
@keyframes scaleUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Slide In Right (RTL) */
@keyframes slideInRight {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In Left (RTL) */
@keyframes slideInLeft {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===============================================
   Fade In Up Classes
   =============================================== */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Fade In */
.fade-in-up:nth-child(1) {
    transition-delay: 0.1s;
}

.fade-in-up:nth-child(2) {
    transition-delay: 0.2s;
}

.fade-in-up:nth-child(3) {
    transition-delay: 0.3s;
}

.fade-in-up:nth-child(4) {
    transition-delay: 0.4s;
}

.fade-in-up:nth-child(5) {
    transition-delay: 0.5s;
}

.fade-in-up:nth-child(6) {
    transition-delay: 0.6s;
}

/* ===============================================
   Button Animations
   =============================================== */

/* Primary Button Gradient Animation */
.btn-primary {
    background-size: 200% auto;
    background-image: linear-gradient(
        135deg,
        #FF2929 0%,
        #AD0500 50%,
        #FF2929 100%
    );
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background-position: right center;
    animation: gradientShift 2s ease infinite;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Secondary Button Glow Effect */
.btn-secondary {
    position: relative;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    animation: glowPulse 1.5s ease-in-out infinite;
}

/* WhatsApp Button Animation */
.btn-whatsapp {
    position: relative;
    overflow: hidden;
}

.btn-whatsapp::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-whatsapp:hover::after {
    width: 400px;
    height: 400px;
}

/* ===============================================
   Card Hover Animations
   =============================================== */

/* Result Card Animation */
.result-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-card:hover {
    transform: translateY(-8px) scale(1.02);
}

.result-card img {
    transition: transform 0.5s ease;
}

.result-card:hover img {
    transform: scale(1.05);
}

/* Service Card Animation */
.service-card {
    transition: all 0.3s ease;
    position: relative;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 41, 41, 0.05) 0%, rgba(173, 5, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.service-card:hover::before {
    opacity: 1;
}

.service-icon {
    transition: transform 0.3s ease;
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
    animation: pulse 1.5s infinite;
}

/* ===============================================
   Timeline Animations
   =============================================== */
.timeline-item {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-item:nth-child(even) {
    transform: translateX(-50px);
}

.timeline-item:nth-child(even).visible {
    transform: translateX(0);
}

.timeline-icon {
    transition: all 0.3s ease;
}

.timeline-item.visible .timeline-icon {
    animation: scaleUp 0.5s ease forwards;
}

.timeline-item:hover .timeline-icon {
    transform: scale(1.1);
    animation: pulse 1.5s infinite;
}

/* Timeline Line Draw Animation */
.timeline::before {
    transform-origin: top;
    animation: lineGrow 2s ease-out forwards;
}

@keyframes lineGrow {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* ===============================================
   Stats Counter Animation
   =============================================== */
.stat-number {
    transition: transform 0.3s ease;
}

.stat-item.visible .stat-number {
    animation: countUp 0.8s ease-out;
}

/* ===============================================
   FAQ Accordion Animation
   =============================================== */
.faq-item {
    transition: all 0.3s ease;
}

.faq-question i {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    transition: max-height 0.4s ease-in-out, padding 0.3s ease;
}

.faq-item:hover {
    transform: translateX(-5px);
}

/* ===============================================
   Form Input Animations
   =============================================== */
.form-input {
    transition: all 0.3s ease;
}

.form-input:focus {
    transform: translateY(-2px);
}

.form-group {
    position: relative;
}

.form-input:focus + label,
.form-input:not(:placeholder-shown) + label {
    transform: translateY(-25px);
    font-size: 12px;
    color: var(--primary-color);
}

/* ===============================================
   Header Scroll Animation
   =============================================== */
.header {
    transition: all 0.3s ease;
}

.header.scrolled {
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

/* ===============================================
   Hero Section Animations
   =============================================== */
.hero-title {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-buttons {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.hero-gif {
    animation: float 3s ease-in-out infinite;
}

/* ===============================================
   Scroll Progress Bar (Optional)
   =============================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===============================================
   Loading Animation (Optional)
   =============================================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-light);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===============================================
   Image Lazy Load Animation
   =============================================== */
img[data-src] {
    filter: blur(10px);
    transition: filter 0.5s ease;
}

img[data-src].loaded {
    filter: blur(0);
}

/* ===============================================
   Parallax Effect (Optional)
   =============================================== */
.parallax {
    transition: transform 0.5s ease-out;
}

/* ===============================================
   Smooth Scroll Behavior
   =============================================== */
html {
    scroll-behavior: smooth;
}

/* ===============================================
   Focus Visible for Accessibility
   =============================================== */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===============================================
   Reduced Motion (Accessibility)
   =============================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===============================================
   Print Styles
   =============================================== */
@media print {
    .nav-toggle,
    .hero-buttons,
    .btn,
    .contact-form,
    .footer-social {
        display: none !important;
    }

    * {
        animation: none !important;
        transition: none !important;
    }
}
