/* 
* CallAfix Website Extra Animations
* Advanced animations for enhanced visual appeal
*/

/* Preloader Animation */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.preloader.fade-out {
    opacity: 0;
}

.spinner {
    width: 70px;
    text-align: center;
}

.spinner > div {
    width: 18px;
    height: 18px;
    background-color: var(--primary-color);
    border-radius: 100%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
    animation-delay: -0.32s;
}

.spinner .bounce2 {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1.0);
    }
}

/* Advanced Preloader Animation */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    width: 100px;
    height: 100px;
    position: relative;
}

.loader-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 50%;  
}

.loader-line-wrap {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    overflow: hidden;
}

.loader-line {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-sizing: border-box;
    border: 4px solid transparent;
    animation: loader-spin 1.5s infinite ease-in-out;
}

.loader-line-wrap:nth-child(1) { animation-delay: -0.1s; }
.loader-line-wrap:nth-child(2) { animation-delay: -0.2s; }
.loader-line-wrap:nth-child(3) { animation-delay: -0.3s; }
.loader-line-wrap:nth-child(4) { animation-delay: -0.4s; }
.loader-line-wrap:nth-child(5) { animation-delay: -0.5s; }

.loader-line-wrap:nth-child(1) .loader-line {
    border-top-color: var(--primary-color);
    animation-delay: -0.1s;
}
.loader-line-wrap:nth-child(2) .loader-line {
    border-right-color: var(--primary-color);
    animation-delay: -0.2s;
}
.loader-line-wrap:nth-child(3) .loader-line {
    border-bottom-color: var(--secondary-color);
    animation-delay: -0.3s;
}
.loader-line-wrap:nth-child(4) .loader-line {
    border-left-color: var(--secondary-color);
    animation-delay: -0.4s;
}
.loader-line-wrap:nth-child(5) .loader-line {
    border-top-color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
    animation-delay: -0.5s;
}

@keyframes loader-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.preloader-fade {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Button Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Cursor Animation */
.cursor {
    display: inline-block;
    width: 2px;
    background-color: var(--dark-color);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Button Pulse Animation */
.btn.pulse {
    animation: pulse 1s ease;
}

/* Logo Animation */
.logo {
    display: flex;
    align-items: center;
    position: relative;
}

.logo span {
    background: linear-gradient(135deg, var(--secondary-color), #ffaa00);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 100%;
    animation: gradient 3s ease infinite;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Floating Elements Animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Feature Cards Hover Animation */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 15px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover::before {
    opacity: 0.05;
}

.feature-icon {
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: rotateY(360deg);
    transition: transform 0.8s ease;
}

/* Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease;
}

/* Animated Background */
.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.animated-bg span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: animate 25s linear infinite;
    bottom: -150px;
    border-radius: 50%;
}

.animated-bg span:nth-child(1) {
    left: 25%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.animated-bg span:nth-child(2) {
    left: 10%;
    width: 20px;
    height: 20px;
    animation-delay: 2s;
    animation-duration: 12s;
}

.animated-bg span:nth-child(3) {
    left: 70%;
    width: 20px;
    height: 20px;
    animation-delay: 4s;
}

.animated-bg span:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 18s;
}

.animated-bg span:nth-child(5) {
    left: 65%;
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.animated-bg span:nth-child(6) {
    left: 75%;
    width: 110px;
    height: 110px;
    animation-delay: 3s;
}

.animated-bg span:nth-child(7) {
    left: 35%;
    width: 150px;
    height: 150px;
    animation-delay: 7s;
}

.animated-bg span:nth-child(8) {
    left: 50%;
    width: 25px;
    height: 25px;
    animation-delay: 15s;
    animation-duration: 45s;
}

.animated-bg span:nth-child(9) {
    left: 20%;
    width: 15px;
    height: 15px;
    animation-delay: 2s;
    animation-duration: 35s;
}

.animated-bg span:nth-child(10) {
    left: 85%;
    width: 150px;
    height: 150px;
    animation-delay: 0s;
    animation-duration: 11s;
}

@keyframes animate {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 0;
    }
    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

/* Step Number Animation */
.step-number {
    position: relative;
    overflow: hidden;
}

.step-number::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    left: -100%;
    top: 0;
    transform: skewX(-30deg);
    transition: all 1s ease;
}

.step:hover .step-number::before {
    left: 100%;
}

/* CTA Particles Animation */
.cta {
    position: relative;
    overflow: hidden;
}

/* Smooth Page Transitions */
body.loaded .hero-text h1,
body.loaded .hero-text p,
body.loaded .hero-buttons {
    animation: fadeInUp 1s ease forwards;
}

body.loaded .hero-text p {
    animation-delay: 0.2s;
}

body.loaded .hero-buttons {
    animation-delay: 0.4s;
}

body.loaded .hero-image {
    animation: fadeInRight 1s ease 0.6s forwards;
}

/* Animated Social Icons */
.social-icon-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.social-icon-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
    z-index: -1;
    transform: skewX(-15deg);
}

.social-icon-animated:hover::before {
    left: 100%;
}

.social-icon-animated i {
    transition: transform 0.3s ease;
}

.social-icon-animated:hover i {
    transform: rotateY(360deg);
    transition: transform 0.6s ease;
}
