/* ==================== 初始加载页 ==================== */
/* 独立设计：轻量呼吸风格，区别于 SSO 卡片式布局 */

/* ==================== 容器 ==================== */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    background: #f7f8fc;
}

/* ==================== 背景网格纹理 ==================== */
#loader-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(22, 119, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

/* ==================== 背景浮动光斑 ==================== */
.loader-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
}

.loader-orb-1 {
    width: 300px;
    height: 300px;
    top: -80px;
    right: -60px;
    background: rgba(22, 119, 255, 0.08);
    animation: orb-drift 18s ease-in-out infinite;
}

.loader-orb-2 {
    width: 240px;
    height: 240px;
    bottom: -60px;
    left: -40px;
    background: rgba(139, 92, 246, 0.06);
    animation: orb-drift 22s ease-in-out infinite reverse;
}

.loader-orb-3 {
    width: 180px;
    height: 180px;
    top: 40%;
    left: 60%;
    background: rgba(59, 130, 246, 0.04);
    animation: orb-drift 15s ease-in-out infinite 3s;
}

@keyframes orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(20px, -30px) scale(1.05); }
    50% { transform: translate(-15px, 15px) scale(0.95); }
    75% { transform: translate(10px, 25px) scale(1.02); }
}

/* ==================== 内容区 ==================== */
.loader-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==================== Logo ==================== */
.loader-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #1677FF 0%, #0958D9 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(22, 119, 255, 0.25);
    position: relative;
    margin-bottom: 20px;
    animation: logo-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes logo-in {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.loader-logo-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1.5px;
}

.loader-logo-line-1 {
    width: 22px;
    height: 2.5px;
    top: 15px;
    left: 15px;
}

.loader-logo-line-2 {
    width: 16px;
    height: 2.5px;
    top: 23px;
    left: 18px;
    opacity: 0.85;
}

.loader-logo-line-3 {
    width: 10px;
    height: 2.5px;
    top: 31px;
    left: 21px;
    opacity: 0.7;
}

/* ==================== 品牌名 ==================== */
.loader-brand-name {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px 0;
    letter-spacing: -0.5px;
    animation: fade-up 0.5s ease-out 0.15s both;
}

.loader-brand-sub {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 40px 0;
    letter-spacing: 1px;
    animation: fade-up 0.5s ease-out 0.25s both;
}

@keyframes fade-up {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 波浪点动画 ==================== */
.loader-wave {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 28px;
    animation: fade-up 0.5s ease-out 0.35s both;
}

.loader-wave-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1677FF;
    animation: wave-bounce 1.4s ease-in-out infinite;
}

.loader-wave-dot:nth-child(1) {
    animation-delay: 0s;
}

.loader-wave-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.loader-wave-dot:nth-child(3) {
    animation-delay: 0.32s;
}

.loader-wave-dot:nth-child(4) {
    animation-delay: 0.48s;
}

@keyframes wave-bounce {
    0%, 80%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.6);
        opacity: 1;
    }
}

/* ==================== 进度条 ==================== */
.loader-progress {
    width: 160px;
    height: 2px;
    background: rgba(22, 119, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 20px;
    animation: fade-up 0.5s ease-out 0.4s both;
}

.loader-progress-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #1677FF, #4f94ff);
    border-radius: 1px;
    animation: progress-sweep 1.8s ease-in-out infinite;
}

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

/* ==================== 加载文字 ==================== */
.loader-text {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    letter-spacing: 0.3px;
    animation: fade-up 0.5s ease-out 0.45s both;
}

/* ==================== 底部版本 ==================== */
.loader-footer {
    position: absolute;
    bottom: 28px;
    font-size: 11px;
    color: #c8cdd5;
    letter-spacing: 0.2px;
    z-index: 2;
}

/* ==================== Loading 完成过渡 ==================== */
.loaded #loader-wrapper {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

.loaded .loader-logo {
    transform: scale(0.85) translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.loaded .loader-wave-dot {
    animation-play-state: paused;
}

.loaded .loader-progress-bar {
    animation-play-state: paused;
}

/* ==================== 无 JS 降级 ==================== */
.no-js #loader-wrapper {
    display: none;
}

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
    .loader-logo {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .loader-logo-line-1 {
        width: 18px;
        top: 12px;
        left: 13px;
    }

    .loader-logo-line-2 {
        width: 13px;
        top: 19px;
        left: 16px;
    }

    .loader-logo-line-3 {
        width: 8px;
        top: 26px;
        left: 18px;
    }

    .loader-brand-name {
        font-size: 18px;
    }
}

/* ==================== 减少动画偏好 ==================== */
@media (prefers-reduced-motion: reduce) {
    .loader-wave-dot {
        animation: none;
        opacity: 0.6;
    }

    .loader-progress-bar {
        animation: none;
        width: 30%;
    }

    .loader-orb {
        animation: none;
    }

    .loader-logo {
        animation: none;
    }

    .loader-brand-name,
    .loader-brand-sub,
    .loader-wave,
    .loader-progress,
    .loader-text {
        animation: none;
    }
}
