/* KeyRise Studio 加载动画样式 */

/* 全局加载遮罩 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0E0E13 0%, #141419 50%, #0E0E13 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

/* 浅色模式下的加载器背景 */
body.light-theme .page-loader {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 50%, #FFFFFF 100%);
}

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

/* 主加载动画容器 */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* KeyRise Studio Logo 动画 - 优雅抖音风格 */
.loader-logo {
    font-size: 32px;
    font-weight: 900;
    color: #FFFFFF;
    position: relative;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

/* 优雅的抖音特效幽灵元素 */
.logo-ghost {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-size: 32px;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.red-ghost {
    color: #FF4081;
    text-shadow: 0 0 8px rgba(255, 64, 129, 0.6);
}

.blue-ghost {
    color: #40E0D0;
    text-shadow: 0 0 8px rgba(64, 224, 208, 0.6);
}

/* 主加载器 - 科技风格 */
.main-loader {
    position: relative;
    width: 120px;
    height: 120px;
}

/* 旋转环 */
.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: rotate 2s linear infinite;
}

.loader-ring:nth-child(1) {
    border-top: 3px solid #6F98FF;
    animation-duration: 2s;
}

.loader-ring:nth-child(2) {
    border-right: 3px solid #cb55d2;
    animation-duration: 3s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    border-bottom: 3px solid #57AC84;
    animation-duration: 4s;
}

.loader-ring:nth-child(4) {
    border-left: 3px solid #D59A78;
    animation-duration: 5s;
    animation-direction: reverse;
}

/* 中心脉冲点 */
.loader-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #6F98FF 0%, #cb55d2 100%);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 浮动粒子 */
.loader-particles {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #6F98FF;
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 20%;
    background: #6F98FF;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 20%;
    right: 20%;
    background: #cb55d2;
    animation-delay: 0.5s;
}

.particle:nth-child(3) {
    bottom: 20%;
    left: 20%;
    background: #57AC84;
    animation-delay: 1s;
}

.particle:nth-child(4) {
    bottom: 20%;
    right: 20%;
    background: #D59A78;
    animation-delay: 1.5s;
}

/* 加载文本 */
.loader-text {
    font-size: 16px;
    color: #B3B3C1;
    text-align: center;
    animation: textFade 2s ease-in-out infinite;
}

.loader-progress {
    font-size: 14px;
    color: #6F98FF;
    margin-top: 10px;
    font-weight: 600;
}

/* 浅色模式下的文本颜色 */
body.light-theme .loader-text {
    color: #2C3E50;
}

body.light-theme .loader-progress {
    color: #3498DB;
}

/* 浅色模式下的优雅抖音风格logo */
body.light-theme .loader-logo {
    color: #2C3E50;
    text-shadow: 0 0 10px rgba(44, 62, 80, 0.3);
}

body.light-theme .red-ghost {
    color: #E91E63;
    text-shadow: 0 0 8px rgba(233, 30, 99, 0.6);
}

body.light-theme .blue-ghost {
    color: #00BCD4;
    text-shadow: 0 0 8px rgba(0, 188, 212, 0.6);
}

/* 页面特定加载器 */

/* 首页加载器 - 增强版 */
.index-loader .main-loader {
    width: 150px;
    height: 150px;
}

.index-loader .loader-logo {
    font-size: 36px;
}

/* 工具页加载器 */
.tool-loader .main-loader::before {
    content: "🛠️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    animation: toolSpin 2s linear infinite;
}

/* 博客页加载器 */
.blog-loader .main-loader::before {
    content: "📝";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    animation: blogBounce 1.5s ease-in-out infinite;
}

/* 作品页加载器 */
.work-loader .main-loader::before {
    content: "💼";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    animation: workPulse 2s ease-in-out infinite;
}

/* 关于页加载器 */
.about-loader .main-loader::before {
    content: "👥";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    animation: aboutWave 2s ease-in-out infinite;
}

/* 书籍页加载器 */
.book-loader .main-loader::before {
    content: "📚";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    animation: bookFlip 2s ease-in-out infinite;
}

/* 动画关键帧 */
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
}

@keyframes particleFloat {
    0%, 100% { 
        transform: translateY(0px) scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
}

@keyframes textFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 优雅的抖音风格动画关键帧 */
@keyframes elegantMainGlitch {
    0%, 100% { 
        transform: translate(0); 
    }
    10% { 
        transform: translate(-0.8px, 0.8px); 
    }
    20% { 
        transform: translate(0.8px, -0.8px); 
    }
    30% { 
        transform: translate(-0.8px, -0.8px); 
    }
    40% { 
        transform: translate(0.8px, 0.8px); 
    }
    50% { 
        transform: translate(-0.5px, 0.5px); 
    }
    60% { 
        transform: translate(0.5px, -0.5px); 
    }
    70% { 
        transform: translate(0); 
    }
}

@keyframes elegantRedGlitch {
    0%, 100% { 
        transform: translate(0); 
        opacity: 0; 
    }
    15% { 
        transform: translate(-1.5px, -1px); 
        opacity: 0.4; 
    }
    25% { 
        transform: translate(0); 
        opacity: 0; 
    }
    35% { 
        transform: translate(-1px, 1px); 
        opacity: 0.3; 
    }
    45% { 
        transform: translate(0); 
        opacity: 0; 
    }
}

@keyframes elegantBlueGlitch {
    0%, 100% { 
        transform: translate(0); 
        opacity: 0; 
    }
    20% { 
        transform: translate(1.5px, 1px); 
        opacity: 0.3; 
    }
    30% { 
        transform: translate(0); 
        opacity: 0; 
    }
    40% { 
        transform: translate(1px, -1px); 
        opacity: 0.25; 
    }
    50% { 
        transform: translate(0); 
        opacity: 0; 
    }
}

/* 页面特定动画 */
@keyframes toolSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes blogBounce {
    0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
    50% { transform: translate(-50%, -50%) translateY(-10px); }
}

@keyframes workPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1);
        filter: brightness(1.2);
    }
}

@keyframes aboutWave {
    0%, 100% { transform: translate(-50%, -50%) rotateY(0deg); }
    50% { transform: translate(-50%, -50%) rotateY(180deg); }
}

@keyframes bookFlip {
    0%, 100% { transform: translate(-50%, -50%) rotateX(0deg); }
    50% { transform: translate(-50%, -50%) rotateX(180deg); }
}

/* 进度条动画 */
.progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6F98FF 0%, #cb55d2 50%, #57AC84 100%);
    border-radius: 2px;
    animation: progressFill 3s ease-in-out infinite;
}

/* 浅色模式下的进度条 */
body.light-theme .progress-bar {
    background: rgba(44, 62, 80, 0.1);
}

body.light-theme .progress-fill {
    background: linear-gradient(90deg, #3498DB 0%, #9B59B6 50%, #27AE60 100%);
}

@keyframes progressFill {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .loader-logo {
        font-size: 24px;
    }
    
    .main-loader {
        width: 100px;
        height: 100px;
    }
    
    .index-loader .main-loader {
        width: 120px;
        height: 120px;
    }
    
    .index-loader .loader-logo {
        font-size: 28px;
    }
    
    .loader-particles {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .loader-logo {
        font-size: 20px;
    }
    
    .main-loader {
        width: 80px;
        height: 80px;
    }
    
    .index-loader .main-loader {
        width: 100px;
        height: 100px;
    }
    
    .index-loader .loader-logo {
        font-size: 24px;
    }
    
    .loader-container {
        gap: 30px;
    }
}

/* 加载完成后的页面入场动画 */
.page-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.page-content.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* 特殊效果：数据流动画 */
.data-stream {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, #6F98FF, transparent);
    animation: dataFlow 2s linear infinite;
}

.data-stream:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.data-stream:nth-child(2) {
    left: 30%;
    animation-delay: 0.5s;
    background: linear-gradient(to bottom, transparent, #cb55d2, transparent);
}

.data-stream:nth-child(3) {
    left: 50%;
    animation-delay: 1s;
    background: linear-gradient(to bottom, transparent, #57AC84, transparent);
}

.data-stream:nth-child(4) {
    left: 70%;
    animation-delay: 1.5s;
    background: linear-gradient(to bottom, transparent, #D59A78, transparent);
}

.data-stream:nth-child(5) {
    left: 90%;
    animation-delay: 2s;
    background: linear-gradient(to bottom, transparent, #6F98FF, transparent);
}

@keyframes dataFlow {
    0% {
        transform: translateY(-100vh);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}