/* ==========================================
   Animation Styles - Performance First
   Using transform and opacity for 60fps
   ========================================== */

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

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

/* Staggered delays for multiple elements */
.fade-in-up:nth-child(1) { transition-delay: 0ms; }
.fade-in-up:nth-child(2) { transition-delay: 100ms; }
.fade-in-up:nth-child(3) { transition-delay: 200ms; }
.fade-in-up:nth-child(4) { transition-delay: 300ms; }
.fade-in-up:nth-child(5) { transition-delay: 400ms; }
.fade-in-up:nth-child(6) { transition-delay: 500ms; }

/* ==========================================
   Hover Effects
   ========================================== */

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

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

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

/* Card Hover Effects */
.template-card,
.feature-card {
    will-change: transform;
}

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

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

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

/* General link hover animations */
a[href]:not(.nav-brand .logo) {
    position: relative;
    transition: all 0.3s ease;
}

/* Subtle scale effect on link hover */
a[href]:not(.nav-brand .logo):hover {
    transform: scale(1.02);
}

/* Focus states for better accessibility */
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==========================================
   Loading States
   ========================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   Skeleton Loading
   ========================================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 0px,
        var(--color-gray-100) 40px,
        var(--color-gray-200) 80px
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ==========================================
   Fade Transitions (Alpine.js)
   ========================================== */
[x-cloak] {
    display: none !important;
}

/* Alpine.js default transitions */
.transition-opacity {
    transition: opacity 0.3s ease;
}

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

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

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

body {
    animation: fadeIn 0.3s ease-in;
}

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

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

/* ==========================================
   Floating Dots Animation
   ========================================== */
@keyframes floatDots {
    0% {
        transform: translateY(0px) translateX(0px);
    }
    25% {
        transform: translateY(-10px) translateX(5px);
    }
    50% {
        transform: translateY(-5px) translateX(-5px);
    }
    75% {
        transform: translateY(-15px) translateX(3px);
    }
    100% {
        transform: translateY(0px) translateX(0px);
    }
}

/* ==========================================
   Floating Shapes Animation
   ========================================== */
@keyframes floatShape {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
        opacity: 0.15;
    }
    50% {
        transform: translateY(-10px) translateX(-10px) rotate(180deg);
        opacity: 0.2;
    }
    75% {
        transform: translateY(-30px) translateX(5px) rotate(270deg);
        opacity: 0.1;
    }
}

/* ==========================================
   Bounce Animation (Subtle)
   ========================================== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* ==========================================
   Scale on Hover
   ========================================== */
.scale-hover {
    transition: transform 0.3s ease;
}

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

/* ==========================================
   Rotate on Hover
   ========================================== */
.rotate-hover {
    transition: transform 0.3s ease;
}

.rotate-hover:hover {
    transform: rotate(5deg);
}

/* ==========================================
   Image Zoom Effect
   ========================================== */
.zoom-container {
    overflow: hidden;
}

.zoom-image {
    transition: transform 0.5s ease;
}

.zoom-container:hover .zoom-image {
    transform: scale(1.1);
}

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

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

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

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

/* ==========================================
   Floating Animation (Subtle)
   ========================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* ==========================================
   Progress Bar Animation
   ========================================== */
@keyframes progress {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.progress-bar {
    transform-origin: left;
    animation: progress 1s ease-out forwards;
}

/* ==========================================
   Glow Effect
   ========================================== */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 30px rgba(99, 102, 241, 0.6);
    }
}

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

/* ==========================================
   Typewriter Effect (Optional)
   ========================================== */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: currentColor;
    animation: blink 1s step-end infinite;
}

/* ==========================================
   Focus States
   ========================================== */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ==========================================
   Custom Scroll Animations
   ========================================== */
.scroll-fade {
    opacity: 0;
    transition: opacity 1s ease;
}

.scroll-fade.visible {
    opacity: 1;
}

/* ==========================================
   Stagger Animation Helper Classes
   ========================================== */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* ==========================================
   Toast Notifications (FatFreeCartPro)
   ========================================== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.fatfreecart-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    font-weight: 500;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.fatfreecart-toast-success {
    background: #10b981;
    color: white;
}

.fatfreecart-toast-error {
    background: #ef4444;
    color: white;
}

/* ==========================================
   Performance Optimization
   ========================================== */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Remove will-change after animation completes */
.animated {
    will-change: transform, opacity;
}

.animation-complete {
    will-change: auto;
}

