/* Animation Keyframes */
@keyframes fadeInUp {
    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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Animation Classes */
.animate-fade-up {
    animation: fadeInUp 0.6s ease-out;
}

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

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

.animate-scale {
    animation: scaleIn 0.4s ease-out;
}

.animate-bounce {
    animation: bounce 1s ease-out;
}

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

/* Hover Animations */
.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

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

.hover-rotate {
    transition: transform var(--transition-normal);
}

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

/* Stagger Animation */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Scroll Animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced scroll animations for different sections */
.hero-section.scroll-animate {
    transform: translateY(0);
    opacity: 1;
}

.phones-section.scroll-animate {
    transform: translateY(60px) scale(0.95);
}

.phones-section.scroll-animate.in-view {
    transform: translateY(0) scale(1);
}

.categories-section.scroll-animate {
    transform: translateY(60px) scale(0.95);
}

.categories-section.scroll-animate.in-view {
    transform: translateY(0) scale(1);
}

.ipad-section.scroll-animate {
    transform: translateY(80px) scale(0.9);
}

.ipad-section.scroll-animate.in-view {
    transform: translateY(0) scale(1);
}

.store-intro-section.scroll-animate {
    transform: translateY(60px) scale(0.95);
}

.store-intro-section.scroll-animate.in-view {
    transform: translateY(0) scale(1);
}

.ipads-section.scroll-animate {
    transform: translateY(60px) scale(0.95);
}

.ipads-section.scroll-animate.in-view {
    transform: translateY(0) scale(1);
}

.footer.scroll-animate {
    transform: translateY(40px);
}

.footer.scroll-animate.in-view {
    transform: translateY(0);
}

/* Stagger animations for grid items */
.scroll-animate.in-view .phones-grid > *,
.scroll-animate.in-view .ipads-grid > *,
.scroll-animate.in-view .categories-grid > * {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

.scroll-animate.in-view .phones-grid > *:nth-child(1),
.scroll-animate.in-view .ipads-grid > *:nth-child(1),
.scroll-animate.in-view .categories-grid > *:nth-child(1) { animation-delay: 0.1s; }

.scroll-animate.in-view .phones-grid > *:nth-child(2),
.scroll-animate.in-view .ipads-grid > *:nth-child(2),
.scroll-animate.in-view .categories-grid > *:nth-child(2) { animation-delay: 0.2s; }

.scroll-animate.in-view .phones-grid > *:nth-child(3),
.scroll-animate.in-view .ipads-grid > *:nth-child(3),
.scroll-animate.in-view .categories-grid > *:nth-child(3) { animation-delay: 0.3s; }

.scroll-animate.in-view .phones-grid > *:nth-child(4),
.scroll-animate.in-view .ipads-grid > *:nth-child(4),
.scroll-animate.in-view .categories-grid > *:nth-child(4) { animation-delay: 0.4s; }

.scroll-animate.in-view .phones-grid > *:nth-child(5),
.scroll-animate.in-view .ipads-grid > *:nth-child(5),
.scroll-animate.in-view .categories-grid > *:nth-child(5) { animation-delay: 0.5s; }

.scroll-animate.in-view .phones-grid > *:nth-child(6),
.scroll-animate.in-view .ipads-grid > *:nth-child(6),
.scroll-animate.in-view .categories-grid > *:nth-child(6) { animation-delay: 0.6s; }

/* Section headers animation */
.scroll-animate.in-view .section-header {
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0.2s;
    opacity: 0;
    transform: translateY(30px);
}

/* Store intro content animations */
.scroll-animate.in-view .store-intro-content > * {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(40px);
}

.scroll-animate.in-view .store-intro-text { animation-delay: 0.2s; }
.scroll-animate.in-view .store-intro-brands { animation-delay: 0.4s; }

/* Footer content animations */
.scroll-animate.in-view .footer-content > * {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

.scroll-animate.in-view .footer-content > *:nth-child(1) { animation-delay: 0.1s; }
.scroll-animate.in-view .footer-content > *:nth-child(2) { animation-delay: 0.2s; }
.scroll-animate.in-view .footer-content > *:nth-child(3) { animation-delay: 0.3s; }
.scroll-animate.in-view .footer-content > *:nth-child(4) { animation-delay: 0.4s; }
.scroll-animate.in-view .footer-content > *:nth-child(5) { animation-delay: 0.5s; }

/* Loading Shimmer Effect */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Micro-interactions */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::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;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Floating Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

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

/* Glow Effect */
.glow {
    position: relative;
}

.glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.glow:hover::after {
    opacity: 1;
}

/* Parallax Effect */
.parallax {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

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

/* Focus States */
.focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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