/* 统一的二次元风格加载动画 */

/* 加载动画容器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffeef8 0%, #f0f8ff 50%, #e6f3ff 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 主要加载动画 */
.loading-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
}

/* 旋转的樱花花瓣 */
.loading-petal {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #ff6b9d, #ff8fab);
    border-radius: 50% 0 50% 50%;
    animation: petal-rotate 2s linear infinite;
}

.loading-petal:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0s;
}

.loading-petal:nth-child(2) {
    top: 20px;
    right: 20px;
    animation-delay: 0.2s;
}

.loading-petal:nth-child(3) {
    bottom: 20px;
    right: 20px;
    animation-delay: 0.4s;
}

.loading-petal:nth-child(4) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.6s;
}

.loading-petal:nth-child(5) {
    bottom: 20px;
    left: 20px;
    animation-delay: 0.8s;
}

.loading-petal:nth-child(6) {
    top: 20px;
    left: 20px;
    animation-delay: 1s;
}

/* 中心装饰 */
.loading-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #ff6b9d, #ff8fab);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.6);
    animation: center-pulse 1.5s ease-in-out infinite;
}

/* 加载文字 */
.loading-text {
    font-family: 'Arial', sans-serif;
    font-size: 18px;
    color: #ff6b9d;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    animation: text-fade 2s ease-in-out infinite;
}

/* 加载进度条 */
.loading-progress {
    width: 200px;
    height: 6px;
    background: rgba(255, 107, 157, 0.2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b9d, #ff8fab);
    border-radius: 3px;
    animation: progress-fill 3s ease-in-out infinite;
    position: relative;
    width: 0%;
    transition: width 0.3s ease;
}

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

/* 可爱的小装饰 */
.loading-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.loading-star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffd700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: star-twinkle 1.5s ease-in-out infinite;
}

.loading-star:nth-child(1) {
    top: 10%;
    left: 15%;
    animation-delay: 0s;
}

.loading-star:nth-child(2) {
    top: 20%;
    right: 20%;
    animation-delay: 0.3s;
}

.loading-star:nth-child(3) {
    bottom: 15%;
    left: 25%;
    animation-delay: 0.6s;
}

.loading-star:nth-child(4) {
    bottom: 25%;
    right: 15%;
    animation-delay: 0.9s;
}

/* 动画关键帧 */
@keyframes petal-rotate {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(180deg) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

@keyframes center-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 20px rgba(255, 107, 157, 0.6);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 30px rgba(255, 107, 157, 0.8);
    }
}

@keyframes text-fade {
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-5px);
    }
}

@keyframes progress-fill {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

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

@keyframes star-twinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2) rotate(180deg);
    }
}

/* 加载完成动画 */
.loading-complete {
    animation: complete-bounce 0.8s ease-out;
}

@keyframes complete-bounce {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .loading-animation {
        width: 100px;
        height: 100px;
    }
    
    .loading-petal {
        width: 16px;
        height: 16px;
    }
    
    .loading-center {
        width: 32px;
        height: 32px;
    }
    
    .loading-text {
        font-size: 16px;
    }
    
    .loading-progress {
        width: 160px;
    }
}
