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

@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 fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 100%;
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(88, 80, 232, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(88, 80, 232, 0.5);
    }
    100% {
        box-shadow: 0 0 5px rgba(88, 80, 232, 0.3);
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

.fade-in-right {
    animation: fadeInRight 0.6s ease-out;
}

/* Staggered animations for child elements */
.hero-content > *:nth-child(1) {
    animation-delay: 0.1s;
}

.hero-content > *:nth-child(2) {
    animation-delay: 0.2s;
}

.hero-content > *:nth-child(3) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(1) {
    animation-delay: 0.1s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.2s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(4) {
    animation-delay: 0.4s;
}

.feature-card:nth-child(5) {
    animation-delay: 0.5s;
}

.feature-card:nth-child(6) {
    animation-delay: 0.6s;
}

.testimonial-card:nth-child(1) {
    animation-delay: 0.1s;
}

.testimonial-card:nth-child(2) {
    animation-delay: 0.2s;
}

.testimonial-card:nth-child(3) {
    animation-delay: 0.3s;
}

.testimonial-card:nth-child(4) {
    animation-delay: 0.4s;
}

.pricing-card:nth-child(1) {
    animation-delay: 0.1s;
}

.pricing-card:nth-child(2) {
    animation-delay: 0.2s;
}

.pricing-card:nth-child(3) {
    animation-delay: 0.3s;
}

.comparison-link:nth-child(1) {
    animation-delay: 0.1s;
}

.comparison-link:nth-child(2) {
    animation-delay: 0.2s;
}

.comparison-link:nth-child(3) {
    animation-delay: 0.3s;
}

.comparison-link:nth-child(4) {
    animation-delay: 0.4s;
}

/* Intersection Observer support - elements fade in when scrolled into view */
.fade-in[data-animate="true"],
.fade-in-up[data-animate="true"],
.fade-in-down[data-animate="true"],
.fade-in-left[data-animate="true"],
.fade-in-right[data-animate="true"] {
    animation: none;
    opacity: 0;
}

.fade-in[data-visible="true"],
.fade-in-up[data-visible="true"],
.fade-in-down[data-visible="true"],
.fade-in-left[data-visible="true"],
.fade-in-right[data-visible="true"] {
    animation: fadeIn 0.6s ease-out forwards;
}

.fade-in-up[data-visible="true"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-down[data-visible="true"] {
    animation: fadeInDown 0.6s ease-out forwards;
}

.fade-in-left[data-visible="true"] {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.fade-in-right[data-visible="true"] {
    animation: fadeInRight 0.6s ease-out forwards;
}

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

/* Smooth transitions for all interactive elements */
button,
a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover lift effect for cards */
.feature-card,
.testimonial-card,
.pricing-card,
.comparison-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glow effect for CTA buttons on hover */
.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::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.6s, height 0.6s;
}

.cta-button:hover::after {
    width: 300px;
    height: 300px;
}

/* Focus visible states */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #5850e8;
    outline-offset: 2px;
    animation: none;
}

/* Media queries for animation preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Loading animation for lazy-loaded images */
img[loading="lazy"] {
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"]:not([src]) {
    opacity: 0.5;
}

img[loading="lazy"][src] {
    opacity: 1;
}

/* Smooth opacity transition for images */
img {
    transition: opacity 0.3s ease-in-out;
}

/* Animation for links with underline effect */
a[href*="http"]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #5850e8;
    transition: width 0.3s ease;
}

/* Navigation link hover effect */
header a:not(.cta-button):hover::after {
    width: 100%;
}

/* Parallax effect for hero section (subtle) */
.hero-image {
    animation: fadeInDown 0.8s ease-out;
}

/* Smooth reveal for sections */
section {
    animation: fadeIn 0.8s ease-out;
}

/* Stagger animation for grid items */
.grid > * {
    animation: fadeInUp 0.6s ease-out backwards;
}

/* Generate stagger delays for grid items */
.grid > :nth-child(1) {
    animation-delay: 0.05s;
}

.grid > :nth-child(2) {
    animation-delay: 0.1s;
}

.grid > :nth-child(3) {
    animation-delay: 0.15s;
}

.grid > :nth-child(4) {
    animation-delay: 0.2s;
}

.grid > :nth-child(5) {
    animation-delay: 0.25s;
}

.grid > :nth-child(6) {
    animation-delay: 0.3s;
}

/* Pulse animation for trust elements */
.trust-badges {
    animation: fadeInUp 0.6s ease-out;
}

.trust-badges .flex {
    animation: slideDown 0.4s ease-out backwards;
}

.trust-badges .flex:nth-child(1) {
    animation-delay: 0.2s;
}

.trust-badges .flex:nth-child(2) {
    animation-delay: 0.3s;
}

.trust-badges .flex:nth-child(3) {
    animation-delay: 0.4s;
}

/* Button scale effect */
.cta-button:active {
    transform: scale(0.98) translateY(0);
}

/* Hover lift for all interactive elements */
button:hover,
a[href]:hover {
    transform: translateY(-2px);
}

a.comparison-link:hover {
    transform: translateY(-4px);
}

/* Smooth color transitions */
a {
    transition: color 0.3s ease;
}

a:hover {
    color: #4c39d5;
}

/* Smooth background transitions */
.feature-card,
.testimonial-card,
.pricing-card,
.comparison-link {
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Subtle shadow transitions */
.feature-card,
.testimonial-card,
.pricing-card {
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Text selection color */
::selection {
    background-color: #5850e8;
    color: white;
}

::-moz-selection {
    background-color: #5850e8;
    color: white;
}

/* Smooth backdrop blur on header */
header {
    animation: slideDown 0.4s ease-out;
}

/* Entrance animation for footer */
footer {
    animation: fadeIn 0.8s ease-out;
}

/* Apply fade-in-up to all elements that have the class by default */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}
