/* ========================================
   证券公司官网 - 动画效果
   kommnz.com
   ======================================== */

/* ==================== Scroll Reveal Animations ==================== */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].animated {
    opacity: 1;
}

[data-animate="fadeIn"] {
    opacity: 0;
}

[data-animate="fadeIn"].animated {
    opacity: 1;
}

[data-animate="fadeInUp"] {
    transform: translateY(40px);
}

[data-animate="fadeInUp"].animated {
    transform: translateY(0);
}

[data-animate="fadeInDown"] {
    transform: translateY(-40px);
}

[data-animate="fadeInDown"].animated {
    transform: translateY(0);
}

[data-animate="fadeInLeft"] {
    transform: translateX(-40px);
}

[data-animate="fadeInLeft"].animated {
    transform: translateX(0);
}

[data-animate="fadeInRight"] {
    transform: translateX(40px);
}

[data-animate="fadeInRight"].animated {
    transform: translateX(0);
}

[data-animate="zoomIn"] {
    transform: scale(0.9);
}

[data-animate="zoomIn"].animated {
    transform: scale(1);
}

[data-animate="zoomOut"] {
    transform: scale(1.1);
}

[data-animate="zoomOut"].animated {
    transform: scale(1);
}

/* Animation Delays */
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* ==================== Number Counter Animation ==================== */
.counter {
    display: inline-block;
}

.counter.counting {
    animation: countPulse 0.3s ease;
}

@keyframes countPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== Typing Effect ==================== */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--gold);
    white-space: nowrap;
    animation: typing 3.5s 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(--gold); }
}

/* ==================== Gradient Background Animation ==================== */
.gradient-animate {
    background: linear-gradient(-45deg, var(--primary-dark), var(--primary), var(--primary-light), var(--accent-dark));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==================== Shimmer Effect ==================== */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ==================== Glow Effect ==================== */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px var(--gold), 0 0 10px var(--gold), 0 0 15px var(--gold);
    }
    to {
        box-shadow: 0 0 10px var(--gold), 0 0 20px var(--gold), 0 0 30px var(--gold);
    }
}

/* ==================== Ripple Effect ==================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    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;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* ==================== Floating Elements ==================== */
.float-slow {
    animation: floatSlow 6s ease-in-out infinite;
}

.float-medium {
    animation: floatMedium 4s ease-in-out infinite;
}

.float-fast {
    animation: floatFast 2s ease-in-out infinite;
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

@keyframes floatMedium {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes floatFast {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ==================== Rotate Animation ==================== */
.rotate {
    animation: rotate 10s linear infinite;
}

.rotate-slow {
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== Bounce Animation ==================== */
.bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

/* ==================== Shake Animation ==================== */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ==================== Heartbeat Animation ==================== */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* ==================== Stock Ticker Animation ==================== */
.ticker-wrap {
    overflow: hidden;
    background: var(--primary-dark);
    padding: 10px 0;
}

.ticker {
    display: flex;
    animation: ticker 30s linear infinite;
}

.ticker:hover {
    animation-play-state: paused;
}

.ticker-item {
    flex-shrink: 0;
    padding: 0 2rem;
    color: var(--text-white);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticker-item .up {
    color: #10B981;
}

.ticker-item .down {
    color: #EF4444;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ==================== Chart Animation ==================== */
.chart-bar {
    transform-origin: bottom;
    animation: growUp 1s ease forwards;
}

@keyframes growUp {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

.chart-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s ease forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* ==================== Progress Bar Animation ==================== */
.progress-bar {
    height: 8px;
    background: var(--bg-gray);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: var(--radius-full);
    animation: progressFill 1.5s ease forwards;
    transform-origin: left;
}

@keyframes progressFill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ==================== Skeleton Loading ==================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-gray) 25%,
        var(--bg-light) 50%,
        var(--bg-gray) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-image {
    height: 200px;
}

/* ==================== Page Transition ==================== */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.page-transition.active {
    opacity: 1;
}

/* ==================== Scroll Progress ==================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ==================== Parallax Effect ==================== */
.parallax {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ==================== Reveal on Scroll ==================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    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);
}

/* ==================== Hover Animations ==================== */
.hover-grow {
    transition: transform var(--transition);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink:hover {
    transform: scale(0.95);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Icon Hover Effects */
.icon-hover {
    transition: all var(--transition);
}

.icon-hover:hover {
    transform: translateY(-3px);
    color: var(--gold);
}

/* Button Hover Effects */
.btn-hover-slide {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-hover-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.btn-hover-slide:hover::before {
    left: 100%;
}

/* ==================== Stagger Children Animation ==================== */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.animated > *:nth-child(1) { animation: staggerFadeIn 0.5s ease 0.1s forwards; }
.stagger-children.animated > *:nth-child(2) { animation: staggerFadeIn 0.5s ease 0.2s forwards; }
.stagger-children.animated > *:nth-child(3) { animation: staggerFadeIn 0.5s ease 0.3s forwards; }
.stagger-children.animated > *:nth-child(4) { animation: staggerFadeIn 0.5s ease 0.4s forwards; }
.stagger-children.animated > *:nth-child(5) { animation: staggerFadeIn 0.5s ease 0.5s forwards; }
.stagger-children.animated > *:nth-child(6) { animation: staggerFadeIn 0.5s ease 0.6s forwards; }
.stagger-children.animated > *:nth-child(7) { animation: staggerFadeIn 0.5s ease 0.7s forwards; }
.stagger-children.animated > *:nth-child(8) { animation: staggerFadeIn 0.5s ease 0.8s forwards; }

@keyframes staggerFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Mouse Follow Effect ==================== */
.mouse-follow {
    transition: transform 0.3s ease;
}

/* ==================== Particle Animation ==================== */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--gold);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== Attention Seekers ==================== */
.attention-pulse {
    animation: attentionPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes attentionPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.attention-ping {
    animation: attentionPing 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes attentionPing {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ==================== Reduced Motion ==================== */
@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;
    }
    
    .parallax {
        transform: none !important;
    }
    
    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}
