/* =========================================================
   会员中心 · 卡通加载动画（弹跳方块 + 文案「小佛为你快速加载中」）
   配套：mfy2026 主题
   引入：header.php 中放在 common.css 之后
   特点：纯 CSS 实现，不改动任何 PHP 页面里的 DOM 结构。
        - 复用 #mainLoading 内已有的 5 个 .ddr 元素，重绘为圆角方块
        - 文案用 #mainLoading::after 的 content 插入
        - 落地阴影线用 #mainLoading::before 绘制
   ========================================================= */

/* ---------- 1. 外层容器 ---------- */
#mainLoading {
  /* 原来已是 fixed + flex 居中，这里只调整排列方式 */
  flex-wrap: wrap;
  align-content: center;
  gap: 0;
}

/* ---------- 2. 色条 → 卡通方块 ---------- */
#mainLoading .ddr {
  width: 20px;
  height: 20px;
  float: none;
  margin: 0 4.5px;
  border-radius: 6px;
  background-color: #C8102E;
  /* 覆盖原有的 scaleY 动画 */
  animation: mfyCubeBounce 1.25s infinite both;
  /* 每根柱子略微错开相位，形成依次弹跳 */
  transform-origin: center bottom;
  will-change: transform, opacity;
}

/* 深浅红交替，形成节奏 */
#mainLoading .ddr2 {
  background-color: #E8435C;
  animation-delay: -0.25s;
}
#mainLoading .ddr3 {
  background-color: #C8102E;
  animation-delay: -0.5s;
}
#mainLoading .ddr4 {
  background-color: #E8435C;
  animation-delay: -0.75s;
}
#mainLoading .ddr5 {
  background-color: #C8102E;
  animation-delay: -1s;
}

/* 经典弹跳：每根柱子独立循环，相位靠 animation-delay 错开
   0%      落地（扁一点）
   15%     起跳加速
   40%     最高点（拉长）
   70%     下落触地（压扁）
   85%     轻微回弹
   100%    回到落地
   用 ease-out / ease-in 分段，避免顶点"顿一下"的抽搐感 */
@keyframes mfyCubeBounce {
  0% {
    transform: translateY(0) scale(1, 1);
    opacity: 0.5;
  }
  12% {
    transform: translateY(-7px) scale(0.95, 1.07);
    opacity: 0.82;
  }

  18% {
    transform: translateY(-11px) scale(0.98, 1.03);
    opacity: 0.88;
  }

  24% {
    transform: translateY(-17px) scale(1.02, 1);
    opacity: 0.94;
  }

  32% {
    transform: translateY(-22.5px) scale(1.05, 0.98);
    opacity: 0.98;
  }
  40% {
    transform: translateY(-26px) scale(1.06, 0.96);
    opacity: 1;
  }
  70% {
    transform: translateY(0) scale(1.1, 0.88);
    opacity: 0.9;
  }
  82% {
    transform: translateY(-5px) scale(0.97, 1.04);
    opacity: 0.75;
  }
  100% {
    transform: translateY(0) scale(1, 1);
    opacity: 0.5;
  }
}

/* ---------- 3. 文案（插入到方块下方一行） ---------- */
#mainLoading::after {
  content: "小佛为你快速加载中";
  flex-basis: 100%;
  margin-top: 22px;
  color: #3D4048;
  font-size: 15px;
  font-family: inherit;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 1.6;
  text-align: center;
  white-space: nowrap;
}

/* ---------- 4. 落地阴影线 ---------- */
/* 方块合计宽 20*5 + 间距 4.5*2*5 = 145px，中心在容器正中 */
#mainLoading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 2px;
  margin-left: -60px;
  /* 方块底边在中心下方 10px，再下移 24px 留出落地间距 */
  margin-top: 34px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #F3D2D8, transparent);
  pointer-events: none;
}

/* ---------- 5. 产品详情内嵌加载（pro-des）不显示文案与阴影 ---------- */
#mainLoading.pro-des {
  flex-wrap: nowrap;
}
#mainLoading.pro-des::after,
#mainLoading.pro-des::before {
  content: none;
}

/* ---------- 6. 无障碍：系统开启「减弱动态效果」时放慢 ---------- */
@media (prefers-reduced-motion: reduce) {
  #mainLoading .ddr {
    animation-duration: 2.4s;
  }
}

/* ---------- 7. 移动端 ---------- */
@media screen and (max-width: 750px) {
  #mainLoading .ddr {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    margin: 0 3.5px;
  }
  #mainLoading::after {
    margin-top: 18px;
    font-size: 14px;
    letter-spacing: 0.5px;
  }
  #mainLoading::before {
    width: 96px;
    margin-left: -48px;
    margin-top: 30px;
  }
}

/* ============================================================
   ⚠️ fxxx 补充：全局 common.css 未被本模板引入，
   #mainLoading 缺少 fixed 定位 + flex 居中，会导致方块堆在左上角。
   这里补回容器定位（与 fxuser 的 common.css 定义一致）。
   ============================================================ */
#mainLoading {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
  gap: 0;
  background: transparent;
  pointer-events: none;
}

/* 详情页内嵌加载：跟随内容流，不遮全屏 */
.pro-des-loading #mainLoading {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
}
