/* ===================================
   Animations & Transitions
   The Scottish Free Website Guys
   =================================== */

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

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

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

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

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* Slide In Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Apply Animations to Elements */

/* Hero Section Animations */
.fade-in {
    animation: fadeIn 1s ease-out;
}

.fade-in-delay {
    animation: fadeIn 1s ease-out 0.3s both;
}

.fade-in-delay-2 {
    animation: fadeIn 1s ease-out 0.6s both;
}

.fade-in-delay-3 {
    animation: fadeIn 1s ease-out 0.9s both;
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Animation for Grid Items */
.feature-card,
.service-card,
.portfolio-item,
.testimonial-card,
.step-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.feature-card.revealed,
.service-card.revealed,
.portfolio-item.revealed,
.testimonial-card.revealed,
.step-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Add stagger delays */
.feature-card:nth-child(1).revealed { transition-delay: 0.1s; }
.feature-card:nth-child(2).revealed { transition-delay: 0.2s; }
.feature-card:nth-child(3).revealed { transition-delay: 0.3s; }
.feature-card:nth-child(4).revealed { transition-delay: 0.4s; }
.feature-card:nth-child(5).revealed { transition-delay: 0.5s; }
.feature-card:nth-child(6).revealed { transition-delay: 0.6s; }

.service-card:nth-child(1).revealed { transition-delay: 0.1s; }
.service-card:nth-child(2).revealed { transition-delay: 0.2s; }
.service-card:nth-child(3).revealed { transition-delay: 0.3s; }
.service-card:nth-child(4).revealed { transition-delay: 0.4s; }
.service-card:nth-child(5).revealed { transition-delay: 0.5s; }
.service-card:nth-child(6).revealed { transition-delay: 0.6s; }

.step-card:nth-child(1).revealed { transition-delay: 0.1s; }
.step-card:nth-child(2).revealed { transition-delay: 0.2s; }
.step-card:nth-child(3).revealed { transition-delay: 0.3s; }
.step-card:nth-child(4).revealed { transition-delay: 0.4s; }

.portfolio-item:nth-child(1).revealed { transition-delay: 0.1s; }
.portfolio-item:nth-child(2).revealed { transition-delay: 0.2s; }
.portfolio-item:nth-child(3).revealed { transition-delay: 0.3s; }
.portfolio-item:nth-child(4).revealed { transition-delay: 0.4s; }
.portfolio-item:nth-child(5).revealed { transition-delay: 0.5s; }
.portfolio-item:nth-child(6).revealed { transition-delay: 0.6s; }

.testimonial-card:nth-child(1).revealed { transition-delay: 0.1s; }
.testimonial-card:nth-child(2).revealed { transition-delay: 0.2s; }
.testimonial-card:nth-child(3).revealed { transition-delay: 0.3s; }
.testimonial-card:nth-child(4).revealed { transition-delay: 0.4s; }
.testimonial-card:nth-child(5).revealed { transition-delay: 0.5s; }
.testimonial-card:nth-child(6).revealed { transition-delay: 0.6s; }
.testimonial-card:nth-child(7).revealed { transition-delay: 0.7s; }
.testimonial-card:nth-child(8).revealed { transition-delay: 0.8s; }

/* Navbar Animation */
.navbar {
    animation: slideInDown 0.5s ease-out;
}

/* Button Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
}

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

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

/* Icon Animations */
.feature-icon,
.service-icon,
.stat-icon {
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon,
.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Stat Number Animation */
.stat-number {
    animation: countUp 0.5s ease-out;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

/* Form Input Focus Animation */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    animation: pulse 0.3s ease-out;
}

/* Star Rating Animation */
.stars i {
    display: inline-block;
    animation: scaleIn 0.3s ease-out backwards;
}

.stars i:nth-child(1) { animation-delay: 0.1s; }
.stars i:nth-child(2) { animation-delay: 0.2s; }
.stars i:nth-child(3) { animation-delay: 0.3s; }
.stars i:nth-child(4) { animation-delay: 0.4s; }
.stars i:nth-child(5) { animation-delay: 0.5s; }

/* Portfolio Image Hover Effect */
.portfolio-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .portfolio-image::after {
    opacity: 1;
}

.portfolio-placeholder {
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-placeholder {
    transform: scale(1.2);
}

/* Badge Animation */
.badge {
    animation: fadeIn 0.5s ease-out backwards;
}

.hero-badges .badge:nth-child(1) {
    animation-delay: 0.8s;
}

.hero-badges .badge:nth-child(2) {
    animation-delay: 1s;
}

.hero-badges .badge:nth-child(3) {
    animation-delay: 1.2s;
}

/* Wave Animation */
.hero-wave svg {
    animation: fadeIn 1.5s ease-out;
}

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

/* Reduce Motion for 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;
    }
}

/* Hover Glow Effect */
.btn-hero {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

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

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

/* Contact Detail Icon Animation */
.contact-detail i {
    animation: scaleIn 0.5s ease-out backwards;
}

.contact-detail:nth-child(1) i { animation-delay: 0.2s; }
.contact-detail:nth-child(2) i { animation-delay: 0.4s; }
.contact-detail:nth-child(3) i { animation-delay: 0.6s; }

/* Step Number Animation */
.step-number {
    animation: bounce 1s ease-in-out infinite;
}

.step-card:hover .step-number {
    animation: pulse 0.5s ease-in-out;
}

/* Testimonial Card Hover */
.testimonial-card {
    transition: all 0.3s ease;
}

.testimonial-card:hover {
    transform: translateY(-5px) scale(1.02);
}

/* Author Avatar Animation */
.author-avatar {
    transition: transform 0.3s ease;
}

.testimonial-card:hover .author-avatar {
    transform: scale(1.1) rotate(5deg);
}

/* Gradient Background Animation - DISABLED for static background */
/* .hero-background {
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
} */

/* Link Underline Animation */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Footer Link Hover */
.footer-section ul li a {
    position: relative;
    padding-left: 0;
    transition: padding-left 0.3s ease;
}

.footer-section ul li a:hover {
    padding-left: 5px;
}

/* Form Submit Button Loading State */
.btn-submit.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}
