/* ============================================================
   APP LOADING SCREEN - Clean Business Edition
   ============================================================ */

/* ========== 字体导入 ========== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* ========== 基础重置 ========== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
}

/* ========== 主容器 ========== */
#app-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(145deg, #f0f4ff 0%, #f8fafc 30%, #eff6ff 60%, #f4f7fb 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-loading.fade-out {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

/* ========== 网格背景 ========== */
.loading-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 50px 50px, 50px 50px; }
}

/* ========== 粒子画布层 ========== */
#bg-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ========== 背景装饰 - 流动几何图形 ========== */
.loading-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 大圆环 */
.loading-bg-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.06);
    animation: bgRingFloat 20s ease-in-out infinite;
}

.loading-bg-ring.r1 {
    width: 700px;
    height: 700px;
    top: -250px;
    right: -200px;
    border-color: rgba(37, 99, 235, 0.05);
    animation-delay: 0s;
}

.loading-bg-ring.r2 {
    width: 500px;
    height: 500px;
    bottom: -180px;
    left: -120px;
    border-color: rgba(14, 165, 233, 0.06);
    animation-delay: -7s;
}

@keyframes bgRingFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -20px) rotate(3deg); }
    50% { transform: translate(-20px, -45px) rotate(-2deg); }
    75% { transform: translate(-35px, 10px) rotate(1deg); }
}

/* 模糊光斑 */
.loading-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: blobMorph 12s ease-in-out infinite;
}

.loading-bg-blob.b1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -60px;
    background: #3b82f6;
    opacity: 0.12;
    animation-delay: 0s;
}

.loading-bg-blob.b2 {
    width: 350px;
    height: 350px;
    bottom: -120px;
    right: -80px;
    background: #0ea5e9;
    opacity: 0.1;
    animation-delay: -4s;
}

@keyframes blobMorph {
    0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50%; }
    20% { transform: translate(40px, -30px) scale(1.12); border-radius: 45% 55% 55% 45% / 55% 45% 45% 55%; }
    40% { transform: translate(-20px, -50px) scale(0.92); border-radius: 55% 45% 40% 60% / 40% 55% 60% 45%; }
    60% { transform: translate(-45px, 20px) scale(1.08); border-radius: 45% 55% 50% 50% / 60% 40% 55% 45%; }
    80% { transform: translate(25px, 35px) scale(0.95); border-radius: 50% 50% 45% 55% / 45% 55% 50% 50%; }
}

/* ========== 内容容器 ========== */
.app-loading-wrapper {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 420px;
    padding: 40px 28px;
    box-sizing: border-box;
}

.app-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========== Logo 区域 ========== */
.app-loading-logo {
    text-align: center;
    margin-bottom: 56px;
}

/* 主图形 - 半圆环 + 脉冲核心 */
.logo-emblem {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 32px;
}

/* 外环 - 断续圆弧 */
.emblem-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.emblem-arc.arc-top {
    border-top-color: #2563eb;
    border-right-color: #2563eb;
    opacity: 0.8;
    animation: arcRotate 4s linear infinite;
}

.emblem-arc.arc-bot {
    border-bottom-color: #0ea5e9;
    border-left-color: #0ea5e9;
    opacity: 0.6;
    animation: arcRotate 5s linear infinite reverse;
}

@keyframes arcRotate {
    to { transform: rotate(360deg); }
}

/* 中心图标 */
.emblem-core {
    position: absolute;
    inset: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.25), 0 4px 12px rgba(37, 99, 235, 0.1);
    animation: coreBreath 3s ease-in-out infinite;
}

.emblem-core svg {
    width: 28px;
    height: 28px;
}

@keyframes coreBreath {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(37, 99, 235, 0.25); }
    50% { transform: scale(1.06); box-shadow: 0 12px 40px rgba(37, 99, 235, 0.35), 0 6px 16px rgba(14, 165, 233, 0.15); }
}

/* 外脉冲波纹 */
.emblem-ripple {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.2);
    animation: rippleOut 2.5s ease-out infinite;
}

.emblem-ripple.r2 {
    animation-delay: 0.8s;
}

.emblem-ripple.r3 {
    animation-delay: 1.6s;
}

@keyframes rippleOut {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* 标题 */
.app-loading-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 10px;
    color: #1e293b;
    line-height: 1.2;
}

.app-loading-title span {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    margin-left: 2px;
}

/* 副标题 */
.app-loading-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 3px;
    margin: 0;
    text-transform: uppercase;
}

/* ========== 三个加载指示点 ========== */
.loading-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 36px;
    height: 8px;
    align-items: center;
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dots .dot:nth-child(1) { animation-delay: 0s; background: #2563eb; }
.loading-dots .dot:nth-child(2) { animation-delay: 0.2s; background: #3b82f6; }
.loading-dots .dot:nth-child(3) { animation-delay: 0.4s; background: #0ea5e9; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ========== 状态提示 ========== */
.loading-status-area {
    margin-bottom: 28px;
    height: 16px;
    display: flex;
    align-items: center;
}

.loading-status {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 1.5px;
    margin: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.loading-status.status-changing {
    opacity: 0;
    transform: translateY(-8px);
}

/* ========== 进度条区域 ========== */
.app-loading-footer {
    width: 100%;
    max-width: 320px;
}

.progress-track {
    width: 100%;
    height: 26px;
    background: #e2e8f0;
    border-radius: 13px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
    border-radius: 13px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* 进度条流光效果 */
.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 40%,
        transparent 70%
    );
    animation: shimmer 1.8s ease-in-out infinite;
    border-radius: 13px;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* 百分比 - 置于进度条内部居中 */
.percentage-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    z-index: 2;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .app-loading-wrapper {
        max-width: 320px;
        padding: 30px 18px;
    }

    .app-loading-title {
        font-size: 22px;
    }

    .app-loading-logo {
        margin-bottom: 44px;
    }

    .logo-emblem {
        width: 76px;
        height: 76px;
        margin-bottom: 26px;
    }

    .emblem-core {
        inset: 16px;
        border-radius: 13px;
    }

    .emblem-core svg {
        width: 22px;
        height: 22px;
    }

    .app-loading-footer {
        max-width: 260px;
    }

    .loading-grid {
        background-size: 36px 36px;
    }

    .loading-bg-ring.r1 { width: 500px; height: 500px; }
    .loading-bg-ring.r2 { width: 360px; height: 360px; }

    .loading-bg-blob.b1 { width: 280px; height: 280px; }
    .loading-bg-blob.b2 { width: 250px; height: 250px; }
}
