/* ==========================================================================
   Beijing Hengda Zhonghe Human Resources Management Co., Ltd.
   Animation Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Scroll-triggered Animations
   -------------------------------------------------------------------------- */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered animations for grids */
.stagger-grid > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-grid > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-grid > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-grid > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-grid > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-grid > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-grid > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-grid > *:nth-child(8) { transition-delay: 0.8s; }

/* --------------------------------------------------------------------------
   Hero Animations
   -------------------------------------------------------------------------- */
.hero-title {
    animation: heroTitleAnimation 1s ease-out forwards;
}

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

.hero-description {
    animation: heroDescriptionAnimation 1s ease-out 0.3s forwards;
    opacity: 0;
}

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

.hero-badge {
    animation: heroBadgeAnimation 0.8s ease-out forwards;
}

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

.hero-visual {
    animation: heroVisualAnimation 1s ease-out 0.5s forwards;
    opacity: 0;
}

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

/* --------------------------------------------------------------------------
   Counter Animation
   -------------------------------------------------------------------------- */
.counter {
    display: inline-block;
}

.counter-animation {
    animation: countUp 2s ease-out forwards;
}

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

/* --------------------------------------------------------------------------
   Card Hover Animations
   -------------------------------------------------------------------------- */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 102, 179, 0.3);
}

/* --------------------------------------------------------------------------
   Text Animations
   -------------------------------------------------------------------------- */
.text-gradient-animation {
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradient 3s linear infinite;
}

@keyframes textGradient {
    to {
        background-position: 200% center;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3s steps(30) 1s forwards, blink 0.75s step-end infinite;
    width: 0;
}

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

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

/* --------------------------------------------------------------------------
   Button Animations
   -------------------------------------------------------------------------- */
.btn-hover-fill {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-hover-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-hover-fill:hover::before {
    left: 0;
}

.btn-hover-ripple {
    position: relative;
    overflow: hidden;
}

.btn-hover-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-hover-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* --------------------------------------------------------------------------
   Loading Animations
   -------------------------------------------------------------------------- */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* --------------------------------------------------------------------------
   Page Transitions
   -------------------------------------------------------------------------- */
.page-transition {
    animation: pageIn 0.5s ease-out forwards;
}

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

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

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

.float-slow {
    animation: floatingSlow 4s ease-in-out infinite;
}

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

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

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

/* --------------------------------------------------------------------------
   Parallax Effects
   -------------------------------------------------------------------------- */
.parallax-background {
    position: relative;
    overflow: hidden;
}

.parallax-element {
    position: absolute;
    will-change: transform;
    transition: transform 0.1s linear;
}

/* --------------------------------------------------------------------------
   Navigation Animations
   -------------------------------------------------------------------------- */
.nav-link {
    position: relative;
}

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

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

/* Mobile menu animation */
.mobile-menu {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-menu.open {
    transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Scroll Progress
   -------------------------------------------------------------------------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    z-index: var(--z-index-fixed);
    transition: width 0.1s ease;
}

/* --------------------------------------------------------------------------
   Reveal on Scroll
   -------------------------------------------------------------------------- */
.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-primary);
    transform: translateX(-101%);
    transition: transform 0.6s ease;
}

.reveal.visible::before {
    transform: translateX(101%);
}

.reveal-delay-1::before { transition-delay: 0.1s; }
.reveal-delay-2::before { transition-delay: 0.2s; }
.reveal-delay-3::before { transition-delay: 0.3s; }
.reveal-delay-4::before { transition-delay: 0.4s; }

/* --------------------------------------------------------------------------
   Icon Animations
   -------------------------------------------------------------------------- */
.icon-spin {
    transition: transform 0.3s ease;
}

.icon-spin:hover {
    transform: rotate(360deg);
}

.icon-bounce {
    transition: transform 0.3s ease;
}

.icon-bounce:hover {
    animation: iconBounce 0.6s ease;
}

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

/* --------------------------------------------------------------------------
   Image Animations
   -------------------------------------------------------------------------- */
.image-zoom {
    overflow: hidden;
}

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

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

.image-slide {
    overflow: hidden;
}

.image-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.image-slide:hover::after {
    transform: translateX(100%);
}

/* --------------------------------------------------------------------------
   Form Animations
   -------------------------------------------------------------------------- */
.input-focus-scale {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-focus-scale:focus {
    transform: scale(1.02);
}

.input-focus-glow:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.2);
}

/* --------------------------------------------------------------------------
   Marquee Animation
   -------------------------------------------------------------------------- */
.marquee {
    display: flex;
    overflow: hidden;
    user-select: none;
}

.marquee-content {
    display: flex;
    animation: marquee 30s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Shimmer Effect
   -------------------------------------------------------------------------- */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

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

/* --------------------------------------------------------------------------
   Video Background
   -------------------------------------------------------------------------- */
.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease;
}

.video-overlay:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   Smooth Scroll Indicator
   -------------------------------------------------------------------------- */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollIndicator 2s ease-in-out infinite;
}

@keyframes scrollIndicator {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) translateY(10px);
        opacity: 0.5;
    }
}

/* --------------------------------------------------------------------------
   3D Card Effect
   -------------------------------------------------------------------------- */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.card-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* --------------------------------------------------------------------------
   Water Ripple Background
   -------------------------------------------------------------------------- */
.water-ripple-bg {
    position: relative;
}

.water-ripple-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(0, 102, 179, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(227, 24, 55, 0.1) 0%, transparent 50%);
    animation: waterRipple 8s ease-in-out infinite;
}

@keyframes waterRipple {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

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

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

.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

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