/* ========================================
   Particle Effects - 粒子特效
   Peach Lover - 金色粒子 + 樱花飘落
   ======================================== */

/* 粒子容器 */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    display: block !important; /* 强制显示 */
    visibility: visible !important; /* 强制可见 */
}

/* ===== 金色粒子 ===== */
.golden-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 50%, rgba(212, 175, 55, 0) 100%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.9),
                0 0 25px rgba(255, 215, 0, 0.7),
                0 0 35px rgba(255, 165, 0, 0.5);
}

@keyframes goldenTwinkle {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    10% {
        opacity: 1;
        transform: scale(1.5) rotate(45deg);
        box-shadow: 0 0 20px rgba(255, 215, 0, 1),
                    0 0 30px rgba(255, 215, 0, 0.8),
                    0 0 40px rgba(255, 215, 0, 0.6);
    }
    20% {
        opacity: 0.9;
        transform: scale(2) rotate(90deg);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1),
                    0 0 50px rgba(255, 215, 0, 0.9),
                    0 0 70px rgba(255, 215, 0, 0.7);
    }
    30% {
        opacity: 1;
        transform: scale(1.8) rotate(135deg);
        box-shadow: 0 0 25px rgba(255, 215, 0, 1),
                    0 0 40px rgba(255, 215, 0, 0.8);
    }
    40% {
        opacity: 0.7;
        transform: scale(1.5) rotate(180deg);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    50% {
        opacity: 1;
        transform: scale(2.2) rotate(225deg);
        box-shadow: 0 0 35px rgba(255, 215, 0, 1),
                    0 0 60px rgba(255, 215, 0, 0.9),
                    0 0 80px rgba(255, 215, 0, 0.7);
    }
    60% {
        opacity: 0.85;
        transform: scale(1.6) rotate(270deg);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
    }
    70% {
        opacity: 1;
        transform: scale(2) rotate(315deg);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1),
                    0 0 50px rgba(255, 215, 0, 0.8);
    }
    80% {
        opacity: 0.6;
        transform: scale(1.2) rotate(360deg);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    }
    90% {
        opacity: 0.3;
        transform: scale(0.8) rotate(405deg);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(450deg);
        box-shadow: none;
    }
}

@keyframes goldenFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    25% {
        transform: translateY(-40px) translateX(30px) rotate(90deg);
    }
    50% {
        transform: translateY(-20px) translateX(60px) rotate(180deg);
    }
    75% {
        transform: translateY(-60px) translateX(30px) rotate(270deg);
    }
}

/* ===== 樱花花瓣容器 ===== */
.sakura-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ===== 樱花花瓣 ===== */
.sakura-petal {
    position: fixed;
    top: -20px;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #FFB7C5, #FFD1DC);
    border-radius: 50% 0 50% 50%;
    opacity: 0.6;
    pointer-events: none;
    animation-name: sakuraFall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes sakuraFall {
    0% {
        opacity: 0;
        transform: translateY(-10vh) translateX(0) rotate(0deg) scale(0.8);
        filter: brightness(1);
    }
    10% {
        opacity: 0.9;
        filter: brightness(1.1);
    }
    20% {
        transform: translateY(10vh) translateX(80px) rotate(72deg) scale(1.1);
        filter: brightness(1.2);
    }
    40% {
        transform: translateY(30vh) translateX(-60px) rotate(144deg) scale(0.95);
        filter: brightness(1);
    }
    60% {
        transform: translateY(50vh) translateX(100px) rotate(216deg) scale(1.05);
        filter: brightness(1.15);
    }
    80% {
        transform: translateY(70vh) translateX(-80px) rotate(288deg) scale(0.9);
        filter: brightness(1.05);
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(40px) rotate(360deg) scale(1);
        filter: brightness(1);
    }
}

@keyframes sakuraSway {
    0%, 100% {
        transform: rotate(-15deg) translateX(0);
    }
    25% {
        transform: rotate(-10deg) translateX(10px);
    }
    50% {
        transform: rotate(15deg) translateX(0);
    }
    75% {
        transform: rotate(10deg) translateX(-10px);
    }
}

/* ===== 粒子特效组合 ===== */
.particle-golden {
    animation: goldenTwinkle 4s ease-in-out infinite,
               goldenFloat 4s ease-in-out infinite !important;
    animation-play-state: running !important;
}

.particle-sakura {
    animation: sakuraFall 8s linear infinite,
               sakuraSway 3s ease-in-out infinite !important;
    animation-play-state: running !important;
    animation-fill-mode: forwards !important;
}

/* ===== 特殊效果区域 ===== */
.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 按钮粒子效果 */
.btn-particle-wrap {
    position: relative;
    overflow: hidden;
}

.btn-particle-wrap::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 215, 0, 0.3) 50%,
        transparent 70%
    );
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    50%, 100% {
        transform: translateX(100%) rotate(45deg);
    }
}

/* ===== 性能优化 ===== */
/* 注意：如果用户系统设置了"减少动画"，粒子特效会被禁用 */
/* 这是为了尊重用户的系统偏好设置 */

/* GPU 加速优化 - 提升樱花飘落流畅度 */
.particle-container,
.sakura-petal,
.golden-particle {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 移动端粒子数量优化 */
@media (max-width: 768px) {
    .particle-container {
        /* 移动端使用硬件加速层 */
        transform: translateZ(0);
    }
    
    /* 减少樱花复杂度，提升性能 */
    .sakura-petal {
        /* 使用 transform 代替 top/left 动画 */
        will-change: transform;
    }
}

/* 粒子控制开关 */
.particle-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-full);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.particle-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.particle-toggle.active {
    background: linear-gradient(135deg, #D4AF37, #B8941F);
}

.particle-toggle .icon {
    font-size: 1.25rem;
}

/* 移动端控制按钮位置调整 */
@media (max-width: 768px) {
    .particle-toggle {
        bottom: 15px;
        right: 15px;
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* 移动端优化 - 强制可见 */
@media (max-width: 768px) {
    .particle-container {
        opacity: 1 !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .golden-particle {
        width: 4px !important;
        height: 4px !important;
        display: block !important;
    }
    
    .sakura-petal {
        font-size: 22px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* 小屏手机优化 */
@media (max-width: 375px) {
    .particle-container {
        opacity: 1 !important;
    }
    
    .sakura-petal {
        /* 小屏手机樱花仍然可见 */
        font-size: 18px !important;
    }
}
