/* ===================================
   KangLv ZhiJia - Animations
   Premium Animation Library
   =================================== */

/* ===================================
   Hero Animations
   =================================== */

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

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

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   Hero Badge Animation
   =================================== */

.animate-hero-badge {
    animation: fadeInUp 1s ease-out forwards;
    opacity: 0;
}

/* ===================================
   Title Line Animations
   =================================== */

.animate-title-line {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-title-line.delay-1 {
    animation-delay: 0.2s;
}

.animate-title-line.delay-2 {
    animation-delay: 0.4s;
}

.animate-title-line.delay-3 {
    animation-delay: 0.6s;
}

/* ===================================
   Hero Description Animation
   =================================== */

.animate-hero-description {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

/* ===================================
   Hero Buttons Animation
   =================================== */

.animate-hero-buttons {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.8s forwards;
}

/* ===================================
   Hero Visual Animation
   =================================== */

.animate-hero-visual {
    opacity: 0;
    animation: fadeInRight 1s ease-out 0.4s forwards;
}

/* ===================================
   General Fade Animations
   =================================== */

.animate-fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in.delay-1 {
    animation-delay: 0.2s;
}

.animate-fade-in.delay-2 {
    animation-delay: 0.4s;
}

.animate-fade-in.delay-3 {
    animation-delay: 0.6s;
}

.animate-fade-in.delay-4 {
    animation-delay: 0.8s;
}

/* ===================================
   Slide Animations
   =================================== */

.animate-slide-left {
    opacity: 0;
    animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-slide-left.delay-1 {
    animation-delay: 0.2s;
}

.animate-slide-left.delay-2 {
    animation-delay: 0.4s;
}

.animate-slide-left.delay-3 {
    animation-delay: 0.6s;
}

.animate-slide-right {
    opacity: 0;
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-slide-right.delay-1 {
    animation-delay: 0.2s;
}

.animate-slide-right.delay-2 {
    animation-delay: 0.4s;
}

/* ===================================
   Fade In Up Animations
   =================================== */

.animate-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-up.delay-1 {
    animation-delay: 0.1s;
}

.animate-fade-in-up.delay-2 {
    animation-delay: 0.2s;
}

.animate-fade-in-up.delay-3 {
    animation-delay: 0.3s;
}

.animate-fade-in-up.delay-4 {
    animation-delay: 0.4s;
}

.animate-fade-in-up.delay-5 {
    animation-delay: 0.5s;
}

.animate-fade-in-up.delay-6 {
    animation-delay: 0.6s;
}

/* ===================================
   Scale Animations
   =================================== */

.animate-scale-in {
    opacity: 0;
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-scale-in.delay-1 {
    animation-delay: 0.2s;
}

.animate-scale-in.delay-2 {
    animation-delay: 0.4s;
}

/* ===================================
   Counter Animation
   =================================== */

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

/* ===================================
   Stat Animations
   =================================== */

.animate-stat {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-stat[data-delay="0"] {
    animation-delay: 0s;
}

.animate-stat[data-delay="100"] {
    animation-delay: 0.1s;
}

.animate-stat[data-delay="200"] {
    animation-delay: 0.2s;
}

.animate-stat[data-delay="300"] {
    animation-delay: 0.3s;
}

/* ===================================
   Stagger Animations
   =================================== */

.stagger-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.2s; }
.stagger-item:nth-child(4) { animation-delay: 0.3s; }
.stagger-item:nth-child(5) { animation-delay: 0.4s; }
.stagger-item:nth-child(6) { animation-delay: 0.5s; }
.stagger-item:nth-child(7) { animation-delay: 0.6s; }
.stagger-item:nth-child(8) { animation-delay: 0.7s; }

/* ===================================
   Pulse Animations
   =================================== */

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

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

/* ===================================
   Glow Animations
   =================================== */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 168, 107, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 168, 107, 0.6);
    }
}

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

/* ===================================
   Shimmer Animation
   =================================== */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

/* ===================================
   Bounce Animation
   =================================== */

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

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

/* ===================================
   Rotate Animation
   =================================== */

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

/* ===================================
   Gradient Animation
   =================================== */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* ===================================
   Reveal on Scroll (Intersection Observer)
   =================================== */

.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===================================
   Hover Lift Effect
   =================================== */

.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ===================================
   Hover Scale Effect
   =================================== */

.hover-scale {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===================================
   Text Reveal Animation
   =================================== */

@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.animate-text-reveal {
    animation: textReveal 1s ease-out forwards;
}

/* ===================================
   Loading Dots Animation
   =================================== */

@keyframes loadingDot {
    0%, 20% {
        opacity: 0;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-5px);
    }
    60%, 100% {
        opacity: 0;
        transform: translateY(0);
    }
}

.loading-dots span {
    animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===================================
   Ripple Effect
   =================================== */

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.ripple:active::after {
    animation: ripple 0.6s linear;
}

/* ===================================
   Line Drawing Animation
   =================================== */

@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.animate-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 3s ease-out forwards;
}

/* ===================================
   Parallax Effect Classes
   =================================== */

.parallax-slow {
    transform: translateY(calc(var(--scroll-y, 0) * 0.3));
}

.parallax-medium {
    transform: translateY(calc(var(--scroll-y, 0) * 0.5));
}

.parallax-fast {
    transform: translateY(calc(var(--scroll-y, 0) * 0.7));
}

/* ===================================
   Page Transition Animations
   =================================== */

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

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.page-enter {
    animation: pageEnter 0.5s ease-out forwards;
}

.page-exit {
    animation: pageExit 0.3s ease-in forwards;
}

/* ===================================
   Modal Animations
   =================================== */

@keyframes modalFadeIn {
    from {
        opacity: 0;
        visibility: hidden;
    }
    to {
        opacity: 1;
        visibility: visible;
    }
}

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

.modal-enter {
    animation: modalFadeIn 0.3s ease-out forwards;
}

.modal-content-enter {
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===================================
   Notification Animations
   =================================== */

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

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

.notification-enter {
    animation: notificationSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.notification-exit {
    animation: notificationSlideOut 0.3s ease-in forwards;
}

/* ===================================
   Typing Animation
   =================================== */

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary-blue);
    animation: typing 3s steps(30) forwards,
               blink 0.8s step-end infinite;
}

/* ===================================
   Progress Bar Animation
   =================================== */

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress, 0%);
    }
}

.progress-bar-fill {
    animation: progressFill 1.5s ease-out forwards;
}

/* ===================================
   Float Animation
   =================================== */

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

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

/* ===================================
   Spin Animation
   =================================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===================================
   Infinite Scroll Animation
   =================================== */

@keyframes infiniteScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.infinite-scroll {
    animation: infiniteScroll 20s linear infinite;
}

/* ===================================
   Reduced Motion Support
   =================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }
}