/* eShop 进商城过渡：会员商城接待感 — 优惠券票根 + 轻 spark（充值 / 买券）
 * 色调对齐 MenuPage Catalog 浅灰（menuStylePreset → style-preset-menu-catalog）
 * 主色参考：#f7f8fa / #e7e8ea / #fff / #333 / #67686a
 * 排版基准（手机 414 宽、1rem≈41px 时）：票根约 35% 屏宽；标题为主视觉文案
 */

.eshop-transition {
  --eshop-bg: #f7f8fa;
  --eshop-ink: #333333;
  --eshop-muted: #67686a;
  --eshop-line: rgba(0, 0, 0, 0.08);
  --eshop-card: #ffffff;
  --eshop-card-edge: #e5e5e5;
  --eshop-accent: var(--styleColor, #e5e5e5);
  --eshop-accent-soft: color-mix(in srgb, var(--eshop-accent) 10%, #e7e8ea);
  --eshop-soft-shadow: rgba(0, 0, 0, 0.1);

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.56rem 0.48rem;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 88% 62% at 50% 12%, var(--eshop-accent-soft), transparent 60%),
    radial-gradient(
      ellipse 50% 40% at 12% 88%,
      color-mix(in srgb, var(--eshop-accent) 5%, transparent),
      transparent 55%
    ),
    var(--eshop-bg);
  color: var(--eshop-ink);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.eshop-transition.is-active {
  display: flex;
}

.eshop-transition__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 2.8rem 2.8rem;
  mix-blend-mode: multiply;
}

.eshop-transition__card {
  position: relative;
  width: 100%;
  max-width: 7.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
}

/* ---------- 品牌：产品标，略小于标题，用色拉开层级 ---------- */
.eshop-transition__brand {
  margin: 0 0 0.12rem;
  font-size: 0.54rem;
  line-height: 1.15;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--eshop-accent);
}

/* ---------- 视觉：优惠券票根（放大，约 35% 屏宽） ---------- */
.eshop-transition__visual {
  position: relative;
  width: 3.8rem;
  height: 2.9rem;
  margin: 0.16rem 0 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.eshop-transition__spark {
  position: absolute;
  width: 0.12rem;
  height: 0.12rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--eshop-accent) 70%, #fff);
  opacity: 0;
  animation: eshop-spark 2.6s ease-in-out infinite;
}

.eshop-transition__spark--a {
  top: 0.16rem;
  left: 0.52rem;
  animation-delay: 0s;
}

.eshop-transition__spark--b {
  top: 0.04rem;
  left: 1.78rem;
  width: 0.14rem;
  height: 0.14rem;
  animation-delay: 0.55s;
}

.eshop-transition__spark--c {
  top: 0.22rem;
  right: 0.5rem;
  animation-delay: 1.1s;
}

.eshop-transition__ticket {
  position: relative;
  width: 3.4rem;
  height: 2.08rem;
  border-radius: 0.22rem;
  background: linear-gradient(
    160deg,
    #ffffff 0%,
    var(--eshop-card) 55%,
    color-mix(in srgb, var(--eshop-accent) 6%, #f0f1f3) 100%
  );
  border: 0.02rem solid var(--eshop-card-edge);
  box-shadow:
    0 0.1rem 0.28rem var(--eshop-soft-shadow),
    inset 0 0.02rem 0.06rem rgba(255, 255, 255, 0.95);
  box-sizing: border-box;
  animation: eshop-breathe 2.8s ease-in-out infinite;
  overflow: hidden;
}

/* 票根两侧圆缺，像实体优惠券 */
.eshop-transition__ticket-notch {
  position: absolute;
  top: 50%;
  width: 0.36rem;
  height: 0.36rem;
  margin-top: -0.18rem;
  border-radius: 50%;
  background: var(--eshop-bg);
  box-shadow: inset 0 0 0 0.02rem var(--eshop-card-edge);
}

.eshop-transition__ticket-notch--l {
  left: -0.19rem;
}

.eshop-transition__ticket-notch--r {
  right: -0.19rem;
}

/* 虚线撕口 */
.eshop-transition__ticket::after {
  content: "";
  position: absolute;
  left: 0.36rem;
  right: 0.36rem;
  top: 50%;
  height: 0;
  border-top: 0.02rem dashed color-mix(in srgb, var(--eshop-muted) 38%, transparent);
}

/* 左上角小印章点：主题色 */
.eshop-transition__ticket-stamp {
  position: absolute;
  left: 0.36rem;
  top: 0.3rem;
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--eshop-accent) 72%, #fff);
  box-shadow: 0 0 0 0.05rem color-mix(in srgb, var(--eshop-accent) 18%, transparent);
  animation: eshop-dot-soft 2.8s ease-in-out infinite;
}

/* 票面两行占位，像金额/标题骨架 */
.eshop-transition__ticket-line {
  position: absolute;
  left: 0.9rem;
  top: 0.34rem;
  width: 1.5rem;
  height: 0.16rem;
  border-radius: 999rem;
  background: color-mix(in srgb, var(--eshop-muted) 24%, transparent);
}

.eshop-transition__ticket-line--short {
  top: 0.64rem;
  width: 0.96rem;
  opacity: 0.7;
}

/* 右下角角标：暗示优惠 / 充值 */
.eshop-transition__ticket-badge {
  position: absolute;
  right: 0.3rem;
  bottom: 0.26rem;
  width: 0.56rem;
  height: 0.36rem;
  border-radius: 0.08rem;
  background: color-mix(in srgb, var(--eshop-accent) 18%, #fff);
  border: 0.02rem solid color-mix(in srgb, var(--eshop-accent) 35%, transparent);
  box-sizing: border-box;
}

.eshop-transition__shadow {
  display: block;
  width: 2.4rem;
  height: 0.16rem;
  margin-top: 0.16rem;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--eshop-soft-shadow), transparent 70%);
  opacity: 0.55;
  animation: eshop-shadow 2.8s ease-in-out infinite;
}

/* ---------- 文案层级：标题主、状态次、hint 可读 ---------- */
.eshop-transition__loading-block {
  width: 100%;
  max-width: 6.4rem;
  margin-top: 0.08rem;
}

.eshop-transition__title {
  margin: 0.16rem 0 0;
  font-size: 0.58rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--eshop-ink);
}

.eshop-transition__status {
  margin: 0.14rem 0 0;
  min-height: 0.52rem;
  font-size: 0.38rem;
  line-height: 1.45;
  color: var(--eshop-muted);
}

.eshop-transition__steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  margin: 0.24rem 0 0;
  list-style: none;
  padding: 0;
}

.eshop-transition__step {
  width: 0.2rem;
  height: 0.2rem;
  border-radius: 50%;
  background: var(--eshop-line);
  transition:
    background 0.3s ease,
    transform 0.3s ease,
    opacity 0.3s ease;
  opacity: 0.75;
}

.eshop-transition__step.is-done {
  background: color-mix(in srgb, var(--eshop-accent) 45%, #c8c8c8);
  opacity: 0.9;
}

.eshop-transition__step.is-active {
  background: var(--eshop-accent);
  transform: scale(1.28);
  opacity: 1;
}

.eshop-transition__hint {
  margin: 0.26rem 0 0;
  font-size: 0.34rem;
  line-height: 1.5;
  color: var(--eshop-muted);
  letter-spacing: 0.02em;
  opacity: 1;
}

/* i18n 未就绪：文案骨架，避免空白 → 文案闪入 */
.eshop-transition__text-skel {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 999rem;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--eshop-muted) 14%, transparent) 0%,
    color-mix(in srgb, var(--eshop-muted) 28%, transparent) 45%,
    color-mix(in srgb, var(--eshop-muted) 14%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: eshop-skel-shimmer 1.4s ease-in-out infinite;
}

.eshop-transition__text-skel--brand {
  width: 1.6rem;
  height: 0.42rem;
}

.eshop-transition__text-skel--title {
  width: 4.4rem;
  max-width: 100%;
  height: 0.48rem;
}

.eshop-transition__text-skel--status {
  width: 3.6rem;
  max-width: 100%;
  height: 0.32rem;
  margin-top: 0.06rem;
}

.eshop-transition__text-skel--hint {
  width: 3.2rem;
  max-width: 100%;
  height: 0.28rem;
}

.eshop-transition__text-skel--retry {
  display: inline-block;
  width: 1.4rem;
  height: 0.32rem;
  margin: 0;
  vertical-align: middle;
  background: color-mix(in srgb, #fff 55%, transparent);
  animation: none;
}

@keyframes eshop-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ---------- 错误态 ---------- */
.eshop-transition.is-error .eshop-transition__spark {
  animation: none;
  opacity: 0;
}

.eshop-transition.is-error .eshop-transition__ticket {
  animation: none;
}

.eshop-transition.is-error .eshop-transition__ticket-stamp {
  animation: none;
  background: color-mix(in srgb, #b42318 55%, #fff);
  box-shadow: 0 0 0 0.05rem color-mix(in srgb, #b42318 18%, transparent);
}

.eshop-transition.is-error .eshop-transition__shadow {
  animation: none;
}

.eshop-transition__error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  width: 100%;
  max-width: 6.4rem;
  margin-top: 0.08rem;
}

.eshop-transition.is-error .eshop-transition__loading-block {
  display: none;
}

.eshop-transition.is-error .eshop-transition__error {
  display: flex;
}

.eshop-transition__error-msg {
  margin: 0;
  font-size: 0.36rem;
  line-height: 1.5;
  color: #4d4d4f;
  max-width: 6.4rem;
}

.eshop-transition__retry {
  appearance: none;
  border: none;
  margin: 0.08rem 0 0;
  padding: 0.28rem 0.8rem;
  border-radius: 999rem;
  font-size: 0.36rem;
  font-weight: 600;
  color: #fff;
  background: var(--eshop-accent);
  box-shadow: 0 0.06rem 0.16rem var(--eshop-soft-shadow);
  cursor: pointer;
}

.eshop-transition__retry:active {
  transform: scale(0.98);
  opacity: 0.92;
}

/* 过渡期间隐藏 index 业务壳，保留本组件可见（visible → #app.eshop-hidden-shell） */
#app.eshop-hidden-shell > *:not(.eshop-transition) {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* body / layui 挂在 #app 外：用 :has 跟随 #app 动态 class，避免 JS 改 html */
body:has(#app.eshop-hidden-shell) {
  background: #f7f8fa;
}

body:has(#app.eshop-hidden-shell) .layui-layer-loading,
body:has(#app.eshop-hidden-shell) .layui-layer-shade {
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes eshop-spark {
  0%,
  100% {
    opacity: 0;
    transform: translateY(0.08rem) scale(0.6);
  }
  40% {
    opacity: 0.85;
    transform: translateY(-0.06rem) scale(1);
  }
  75% {
    opacity: 0.15;
    transform: translateY(-0.16rem) scale(0.85);
  }
}

@keyframes eshop-breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.05rem);
  }
}

@keyframes eshop-dot-soft {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@keyframes eshop-shadow {
  0%,
  100% {
    transform: scaleX(1);
    opacity: 0.5;
  }
  50% {
    transform: scaleX(0.9);
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eshop-transition__spark,
  .eshop-transition__ticket,
  .eshop-transition__ticket-stamp,
  .eshop-transition__shadow,
  .eshop-transition__text-skel {
    animation: none;
  }

  .eshop-transition__spark {
    opacity: 0.35;
    transform: none;
  }

  .eshop-transition__ticket-stamp {
    opacity: 0.9;
  }
}
