/**
 * Premium Animations - 2025 Style
 * 高级动画效果 - 2025风格
 */

/* ===== 产品卡片动画 ===== */

/* 1. 3D 悬浮透视效果 */
.product-card-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* 2. 霓虹光晕扫描效果 */
@keyframes neon-scan {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.product-card-neon {
    position: relative;
    overflow: hidden;
}

.product-card-neon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 212, 255, 0.3),
        rgba(168, 85, 247, 0.3),
        transparent
    );
    transition: left 0.8s;
}

.product-card-neon:hover::before {
    left: 100%;
}

/* 3. 磁吸悬浮效果 */
.product-card-magnetic {
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.product-card-magnetic:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 
        0 25px 50px -12px rgba(0, 212, 255, 0.25),
        0 0 30px rgba(168, 85, 247, 0.2);
}

/* 4. 玻璃拟态 + 模糊背景 */
.product-card-glass {
    background: rgba(26, 26, 36, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s;
}

.product-card-glass:hover {
    background: rgba(26, 26, 36, 0.9);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 
        0 0 40px rgba(0, 212, 255, 0.15),
        inset 0 0 40px rgba(168, 85, 247, 0.05);
}

/* ===== 按钮动画 ===== */

/* 1. 液态按钮效果 */
.btn-liquid {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-liquid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.8), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

.btn-liquid:hover::before {
    width: 300%;
    height: 300%;
}

/* 2. 脉冲光晕按钮 */
@keyframes btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(0, 212, 255, 0); }
}

.btn-pulse {
    animation: btn-pulse 2s infinite;
}

.btn-pulse:hover {
    animation: none;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
}

/* 3. 渐变流动按钮 */
@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-gradient-flow {
    background: linear-gradient(
        90deg,
        #00d4ff,
        #a855f7,
        #ec4899,
        #a855f7,
        #00d4ff
    );
    background-size: 300% 100%;
    animation: gradient-flow 3s ease infinite;
}

/* ===== 图片动画 ===== */

/* 1. 缩放 + 旋转组合 */
.img-zoom-rotate {
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.img-zoom-rotate:hover {
    transform: scale(1.1) rotate(2deg);
}

/* 2. 故障艺术效果 */
@keyframes glitch {
    0% { clip-path: inset(40% 0 61% 0); transform: translate(-2px, 2px); }
    20% { clip-path: inset(92% 0 1% 0); transform: translate(2px, -2px); }
    40% { clip-path: inset(43% 0 1% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(25% 0 58% 0); transform: translate(2px, -2px); }
    80% { clip-path: inset(54% 0 7% 0); transform: translate(-2px, 2px); }
    100% { clip-path: inset(58% 0 43% 0); transform: translate(2px, -2px); }
}

.img-glitch:hover {
    position: relative;
}

.img-glitch:hover::before,
.img-glitch:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    background-size: cover;
}

.img-glitch:hover::before {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    background-color: rgba(0, 212, 255, 0.3);
    mix-blend-mode: screen;
}

.img-glitch:hover::after {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
    background-color: rgba(168, 85, 247, 0.3);
    mix-blend-mode: screen;
}

/* 3. 遮罩揭示效果 */
.img-reveal {
    position: relative;
    overflow: hidden;
}

.img-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        transparent 40%,
        rgba(0, 212, 255, 0.2) 50%,
        transparent 60%
    );
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.img-reveal:hover::after {
    transform: translateX(100%);
}

/* ===== 文字动画 ===== */

/* 1. 打字机效果 */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

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

.text-typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent-cyan);
    animation: 
        typing 3s steps(40, end),
        blink 0.75s step-end infinite;
}

/* 2. 渐变文字流动 */
@keyframes text-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.text-gradient-animate {
    background: linear-gradient(
        90deg,
        #00d4ff,
        #a855f7,
        #ec4899,
        #a855f7,
        #00d4ff
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-gradient 3s ease infinite;
}

/* 3. 文字抖动效果 */
@keyframes text-shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px) rotate(-1deg); }
    20% { transform: translateX(2px) rotate(1deg); }
    30% { transform: translateX(-2px) rotate(-1deg); }
    40% { transform: translateX(2px) rotate(1deg); }
    50% { transform: translateX(-1px) rotate(-0.5deg); }
    60% { transform: translateX(1px) rotate(0.5deg); }
    70% { transform: translateX(-1px) rotate(-0.5deg); }
    80% { transform: translateX(1px) rotate(0.5deg); }
    90% { transform: translateX(0) rotate(0); }
}

.text-shake:hover {
    animation: text-shake 0.5s ease-in-out;
}

/* ===== 加载动画 ===== */

/* 1. 霓虹加载环 */
@keyframes loader-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-neon {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top-color: #00d4ff;
    border-right-color: #a855f7;
    border-radius: 50%;
    animation: loader-spin 1s linear infinite;
}

/* 2. 脉冲点 */
@keyframes loader-pulse {
    0%, 100% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1); opacity: 0.5; }
}

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

.loader-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: loader-pulse 1.4s ease-in-out infinite;
}

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

/* ===== 滚动触发动画 ===== */

/* 1. 淡入上浮 */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s ease-out forwards;
}

/* 2. 缩放弹出 */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scale-in 0.5s ease-out forwards;
}

/* 3. 滑入 */
@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-left {
    animation: slide-in-left 0.6s ease-out forwards;
}

.animate-slide-right {
    animation: slide-in-right 0.6s ease-out forwards;
}

/* ===== 特殊效果 ===== */

/* 1. 粒子爆炸效果 (用于添加到购物车) */
@keyframes particle-explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
}

/* 2. 波纹扩散 */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

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

.ripple-effect:active::after {
    animation: ripple 0.6s ease-out;
}

/* 3. 悬浮粒子背景 */
@keyframes float-particle {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) translateX(-10px);
        opacity: 0.4;
    }
    75% {
        transform: translateY(-30px) translateX(5px);
        opacity: 0.7;
    }
}

.bg-particles {
    position: relative;
}

.bg-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
    animation: float-particle 10s ease-in-out infinite;
    pointer-events: none;
}

/* ===== 响应式动画 ===== */

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

/* 移动端简化动画 */
@media (max-width: 768px) {
    .product-card-3d:hover {
        transform: translateY(-8px);
    }
    
    .img-zoom-rotate:hover {
        transform: scale(1.05);
    }
}
