/* ==========================================================================
   Hehuang International Trade - Animations & Effects
   Rich animations inspired by Lynk & Co's modern aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(2deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
    }
    75% {
        transform: translateY(-30px) rotate(-2deg);
    }
}

/* Float Card Animation */
@keyframes floatCard {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-15px) translateX(5px);
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In From Bottom */
@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Glow Pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.6);
    }
}

/* Line Grow */
@keyframes lineGrow {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Count Up Animation Helper */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Reveal Animation */
@keyframes reveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

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

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Border Draw */
@keyframes borderDraw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

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

/* --------------------------------------------------------------------------
   Animation Classes
   -------------------------------------------------------------------------- */

/* Initial State */
.animate-on-scroll {
    opacity: 0;
}

/* Fade Animations */
.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

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

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

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

.scale-in {
    animation: scaleIn 0.6s ease forwards;
}

/* Delay Classes */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* Duration Classes */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.5s; }
.duration-slow { animation-duration: 0.8s; }
.duration-very-slow { animation-duration: 1.2s; }

/* --------------------------------------------------------------------------
   Hover Animations
   -------------------------------------------------------------------------- */

/* 3D Tilt Effect */
.tilt-hover {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

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

/* Lift Effect */
.lift-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Glow Effect */
.glow-hover {
    transition: box-shadow 0.3s ease;
}

.glow-hover:hover {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
}

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

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

/* Color Shift */
.color-shift {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Border Animation */
.border-animate {
    position: relative;
    overflow: hidden;
}

.border-animate::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.border-animate:hover::after {
    width: 100%;
}

/* Icon Animation */
.icon-animate {
    transition: transform 0.3s ease;
}

.icon-animate:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Button Animation */
.btn-animate {
    position: relative;
    overflow: hidden;
}

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

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

/* --------------------------------------------------------------------------
   Scroll Reveal Animations
   -------------------------------------------------------------------------- */

/* Reveal from bottom */
.reveal-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-up.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Reveal from left */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Reveal from right */
.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Reveal with scale */
.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Reveal with rotate */
.reveal-rotate {
    opacity: 0;
    transform: rotate(-10deg);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-rotate.revealed {
    opacity: 1;
    transform: rotate(0);
}

/* Stagger children animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.stagger-children.revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Loading Animations
   -------------------------------------------------------------------------- */

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-color);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-800);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* --------------------------------------------------------------------------
   Text Animations
   -------------------------------------------------------------------------- */

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--secondary-color);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

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

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: var(--secondary-color); }
}

/* Split Text Animation */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: charReveal 0.5s ease forwards;
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gradient Text Animation */
.animated-gradient-text {
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color), var(--accent-secondary), var(--secondary-color));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

/* --------------------------------------------------------------------------
   Background Animations
   -------------------------------------------------------------------------- */

/* Moving Gradient Background */
.moving-gradient {
    background: linear-gradient(-45deg, var(--primary-color), var(--gray-800), var(--primary-color));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Particle Background */
.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--secondary-color);
    border-radius: 50%;
    opacity: 0.5;
    animation: particleFloat 10s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Interactive Animations
   -------------------------------------------------------------------------- */

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

/* Magnetic Effect */
.magnetic {
    transition: transform 0.3s ease;
}

/* Cursor Follower */
.cursor-follower {
    position: fixed;
    width: 20px;
    height: 20px;
    background: var(--secondary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.5;
    mix-blend-mode: difference;
    transition: transform 0.1s ease, width 0.3s ease, height 0.3s ease;
}

/* --------------------------------------------------------------------------
   Menu Animations
   -------------------------------------------------------------------------- */

/* Hamburger Animation */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Menu Animation */
.mobile-menu {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

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

.mobile-menu-item {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-menu.active .mobile-menu-item {
    opacity: 1;
    transform: translateX(0);
}

.mobile-menu.active .mobile-menu-item:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu.active .mobile-menu-item:nth-child(2) { transition-delay: 0.2s; }
.mobile-menu.active .mobile-menu-item:nth-child(3) { transition-delay: 0.3s; }
.mobile-menu.active .mobile-menu-item:nth-child(4) { transition-delay: 0.4s; }
.mobile-menu.active .mobile-menu-item:nth-child(5) { transition-delay: 0.5s; }
.mobile-menu.active .mobile-menu-item:nth-child(6) { transition-delay: 0.6s; }

/* --------------------------------------------------------------------------
   Card Animations
   -------------------------------------------------------------------------- */

/* Flip Card */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Expand Card */
.expand-card {
    cursor: pointer;
}

.expand-card .expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.expand-card.expanded .expand-content {
    max-height: 500px;
}

/* --------------------------------------------------------------------------
   Form Animations
   -------------------------------------------------------------------------- */

/* Input Focus Animation */
.input-field {
    position: relative;
}

.input-field input,
.input-field textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-field input:focus,
.input-field textarea:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.1);
}

.input-field label {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: all 0.3s ease;
}

.input-field textarea ~ label {
    top: 15px;
    transform: translateY(0);
}

.input-field input:focus ~ label,
.input-field input:valid ~ label,
.input-field textarea:focus ~ label,
.input-field textarea:valid ~ label {
    top: -10px;
    left: 10px;
    font-size: 12px;
    background: white;
    padding: 0 5px;
    color: var(--secondary-color);
}

/* Submit Button Animation */
.submit-btn {
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover::before {
    left: 100%;
}

/* --------------------------------------------------------------------------
   Utility Animation Classes
   -------------------------------------------------------------------------- */

/* Infinite Animations */
.infinite-pulse { animation: pulse 2s infinite; }
.infinite-float { animation: float 3s ease-in-out infinite; }
.infinite-rotate { animation: rotate 10s linear infinite; }
.infinite-bounce { animation: bounce 1s infinite; }
.infinite-marquee { animation: marquee 20s linear infinite; }

/* Paused Animation */
.paused { animation-play-state: paused; }

/* Reverse Animation */
.reverse { animation-direction: reverse; }

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