/* ==================== 加载动画容器 ==================== */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  overflow: hidden;
  pointer-events: auto;
}

/* 白色背景层（独立且更晚淡出） */
#page-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #ffffff;
  z-index: -1;
  /* 延迟到 9.5s 才开始淡出，持续 1.5s，让 Logo 完全消失后背景才慢慢隐去 */
  animation: bgFadeOut 1.5s 9.5s ease-out forwards;
}

@keyframes bgFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== 阶段1：青色线条 ========== */
.loader-line {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 3px;
  background: #00a79d;
  width: 0;
  margin-left: -50vw;
  transform: translateY(-50%);
  animation:
    lineGrow   1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    lineShrink 1.0s 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes lineGrow {
  0%   { width: 0; }
  100% { width: 50vw; }
}

@keyframes lineShrink {
  0%   { width: 50vw; margin-left: -50vw; }
  100% { width: 0; margin-left: 0; }
}

/* ========== 阶段2：圆点 ========== */
.loader-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: #00a79d;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation:
    dotIn     0.7s 2.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
    dotExpand 0.8s 3.2s ease-out forwards;
}

@keyframes dotIn {
  0%   { transform: translate(-50%, -50%) scale(0); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes dotExpand {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* ========== 阶段3-6：品牌容器（仅 Logo，严格 60×60 中心） ========== */
.loader-brand {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation:
    brandIn        0.6s 3.2s ease-out forwards,
    brandMoveLeft  1.2s 4.0s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    brandMoveRight 1.6s 5.2s ease-in-out forwards,
    brandScaleUp   1.2s 6.8s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    brandFadeOut   1.8s 8.0s ease-out forwards;
}

@keyframes brandIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes brandMoveLeft {
  0%   { transform: translate(-50%, -50%) translateX(0) scale(1); }
  100% { transform: translate(-50%, -50%) translateX(-120px) scale(1); }
}

@keyframes brandMoveRight {
  0%   { transform: translate(-50%, -50%) translateX(-120px) scale(1); }
  100% { transform: translate(-50%, -50%) translateX(0) scale(1); }
}

@keyframes brandScaleUp {
  0%   { transform: translate(-50%, -50%) translateX(0) scale(1); }
  100% { transform: translate(-50%, -50%) translateX(0) scale(3); }
}

/* 阶段6：放大至 12 倍并消失 */
@keyframes brandFadeOut {
  0%   { transform: translate(-50%, -50%) translateX(0) scale(3); opacity: 1; }
  100% { transform: translate(-50%, -50%) translateX(0) scale(12); opacity: 0; }
}

/* Logo */
.loader-logo {
  width: 60px;
  height: 60px;
}

.loader-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 文字：绝对定位，不占据容器空间 */
.loader-text {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  margin-left: 28px;
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 2px;
  white-space: nowrap;
  opacity: 0;
  animation:
    textIn  0.6s 4.3s ease-out forwards,
    textOut 1.6s 5.2s ease-out forwards;
}

@keyframes textIn {
  0%   { opacity: 0; transform: translateY(-50%) translateX(-15px); }
  100% { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@keyframes textOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== 阶段6：拖影 ========== */
.loader-echoes {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.echo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 根据实际目录调整路径 */
  background: url('../../static/images/logo.png') center/contain no-repeat;
  opacity: 0;
  animation: echoOut 1.8s ease-out forwards;
}

.echo:nth-child(1) { animation-delay: 8.00s; }
.echo:nth-child(2) { animation-delay: 8.12s; }
.echo:nth-child(3) { animation-delay: 8.24s; }
.echo:nth-child(4) { animation-delay: 8.36s; }
.echo:nth-child(5) { animation-delay: 8.48s; }
.echo:nth-child(6) { animation-delay: 8.60s; }
.echo:nth-child(7) { animation-delay: 8.72s; }
.echo:nth-child(8) { animation-delay: 8.84s; }

@keyframes echoOut {
  0%   { opacity: 0.5; transform: scale(3); filter: blur(0px); }
  100% { opacity: 0; transform: scale(12); filter: blur(2px); }
}

/* ========== 动画结束后彻底隐藏 ========== */
#page-loader.done {
  display: none;
  pointer-events: none;
}