/* ==========================================================================
   入场动画（管理后台 / 代理商后台）
   由 theme-welcome.js 在登录后进入 #/admin、#/agent 时注入，配置来自
   api/site-theme.php（welcome_* 系列字段）。样式独立成文件，方便单独回退：
   删掉 vue-dist/index.html 里本文件与 theme-welcome.js 的两行引用即可。
   ========================================================================== */

.saas-welcome {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.45s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
.saas-welcome.sw-in { opacity: 1; }
.saas-welcome.sw-out { opacity: 0; transition-duration: 0.5s; }

/* 底层：直接复用站点背景图 + 深色水面压暗，和后台观感一致 */
.sw-bg {
    position: absolute;
    inset: 0;
    background-image: var(--sw-bg-image, none);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transform: scale(1.06);
    transition: transform 3.2s ease-out, opacity 0.5s ease;
}
.saas-welcome.sw-in .sw-bg { transform: scale(1); }
.sw-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 90% at 50% 45%, rgba(20, 26, 58, 0.30) 0%, rgba(12, 16, 42, 0.62) 55%, rgba(8, 10, 30, 0.80) 100%);
}

/* 漂浮光点 */
.sw-dust { position: absolute; inset: 0; }
.sw-dust i {
    position: absolute;
    bottom: -12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 214, 236, 0.85);
    box-shadow: 0 0 12px 3px rgba(244, 114, 182, 0.55);
    opacity: 0;
    animation: swRise linear infinite;
}
@keyframes swRise {
    0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
    12%  { opacity: 0.9; }
    100% { transform: translate3d(28px, -104vh, 0) scale(1.1); opacity: 0; }
}

/* 主卡片 */
.sw-card {
    position: relative;
    z-index: 2;
    width: min(760px, 90vw);
    padding: 44px 48px 34px;
    text-align: center;
    border-radius: 24px;
    /* 磨砂观感用「半透明渐变 + 高光边」模拟：
       原来用 backdrop-filter: blur(14px) saturate(1.2)，它要在卡片下方的整块区域
       每帧重新采样并模糊一遍，实测把入场动画从 56fps 拖到 37fps（掉帧 39%）。
       现在的做法不改变视觉风格，但彻底不再有逐帧的模糊采样。 */
    background: linear-gradient(162deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.135) 52%, rgba(255, 255, 255, 0.085) 100%);
    border: 1px solid rgba(255, 255, 255, 0.30);
    box-shadow: 0 30px 80px rgba(6, 8, 24, 0.48),
                inset 0 1px 0 rgba(255, 255, 255, 0.16),
                inset 0 0 64px rgba(236, 72, 153, 0.10);
    transform: translateY(26px) scale(0.96);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.22, 0.68, 0.28, 1), opacity 0.6s ease;
}
.saas-welcome.sw-in .sw-card { transform: translateY(0) scale(1); opacity: 1; }

/* 徽标：渐变环 + 旋转弧线 + “晚”字 */
.sw-emblem {
    position: relative;
    width: 92px;
    height: 92px;
    margin: 0 auto 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.92) 0%, rgba(190, 24, 93, 0.92) 100%);
    box-shadow: 0 12px 34px rgba(190, 24, 93, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.22);
    transform: scale(0.4) rotate(-25deg);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.2, 0.9, 0.25, 1.05), opacity 0.5s ease;
}
.saas-welcome.sw-in .sw-emblem { transform: scale(1) rotate(0deg); opacity: 1; transition-delay: 0.18s; }
.sw-emblem span {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(96, 10, 58, 0.5);
}
.sw-emblem::before,
.sw-emblem::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(251, 207, 232, 0.85);
    animation: swSpin 2.6s linear infinite;
}
.sw-emblem::after {
    inset: -19px;
    border-top-color: transparent;
    border-right-color: rgba(244, 114, 182, 0.55);
    animation-duration: 4.2s;
    animation-direction: reverse;
}
@keyframes swSpin { to { transform: rotate(360deg); } }

/* 标题：逐字浮现 + 模糊转清晰 */
.sw-title {
    margin: 0 0 14px;
    font-size: clamp(22px, 3.4vw, 34px);
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 4px 22px rgba(30, 8, 40, 0.55);
    line-height: 1.35;
}
.sw-title .ch {
    display: inline-block;
    opacity: 0;
    transform: translateY(22px) rotateX(-45deg);
    filter: blur(6px);
    animation: swChar 0.62s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
}
@keyframes swChar {
    to { opacity: 1; transform: translateY(0) rotateX(0); filter: blur(0); }
}
.sw-title .sp { display: inline-block; width: 0.34em; }

/* 副标题：延迟淡入 + 高光扫过 */
.sw-sub {
    margin: 0 auto;
    max-width: 30em;
    font-size: clamp(14px, 1.9vw, 19px);
    line-height: 1.9;
    letter-spacing: 0.5px;
    color: rgba(255, 240, 248, 0.94);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.7s ease 0.9s, transform 0.7s ease 0.9s;
}
.saas-welcome.sw-in .sw-sub { opacity: 1; transform: translateY(0); }
.sw-sub em {
    font-style: normal;
    background: linear-gradient(100deg, #fbcfe8 0%, #ffffff 28%, #f9a8d4 52%, #ffffff 74%, #fbcfe8 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 600;
    /* 高光扫过只跑一次：原来 infinite 会让这行文字在整个动画期间逐帧重绘 */
    animation: swShine 1.6s linear 1.1s 1 both;
}
@keyframes swShine { to { background-position: -220% 0; } }

/* 分隔装饰：用 scaleX 展开，不再补间 width（width 每帧都会触发布局） */
.sw-rule {
    width: 62%;
    height: 2px;
    margin: 18px auto 16px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(244, 114, 182, 0.95), transparent);
    transform: scaleX(0);
    transform-origin: center center;
    transition: transform 0.9s ease 0.75s;
}
.saas-welcome.sw-in .sw-rule { transform: scaleX(1); }

/* 进度条：同样用 scaleX 推进，避免 3 秒里每帧重排 */
.sw-bar {
    position: relative;
    height: 3px;
    margin: 20px auto 10px;
    width: 210px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
}
.sw-bar i {
    position: absolute;
    inset: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, #f9a8d4, #ec4899);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform linear;
    will-change: transform;
}

.sw-hint {
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.62);
    opacity: 0;
    transition: opacity 0.5s ease 1.5s;
}
.saas-welcome.sw-in .sw-hint { opacity: 1; }

/* 收起时卡片轻微放大散开 */
.saas-welcome.sw-out .sw-card { transform: scale(1.05); }
.saas-welcome.sw-out .sw-bg { opacity: 0.2; }

/* 窄屏 */
@media (max-width: 640px) {
    .sw-card { padding: 34px 20px 26px; border-radius: 20px; }
    .sw-emblem { width: 74px; height: 74px; margin-bottom: 18px; }
    .sw-emblem span { font-size: 34px; }
    .sw-hint { font-size: 11px; }
}

/* 尊重系统“减少动态效果”设置：不闪屏，只留极短静态提示 */
@media (prefers-reduced-motion: reduce) {
    .sw-dust i, .sw-emblem::before, .sw-emblem::after, .sw-sub em { animation: none !important; }
    .sw-title .ch { animation-duration: 0.01s; }
    .saas-welcome, .sw-card, .sw-bg, .sw-sub, .sw-rule, .sw-hint, .sw-emblem { transition-duration: 0.15s !important; transition-delay: 0s !important; }
}

/* 后台「界面美化」抽屉里的入场动画设置面板 */
.saas-wp { margin-top: 22px; padding-top: 18px; border-top: 1px dashed rgba(236, 72, 153, 0.45); }
.saas-wp h4 { margin: 0 0 4px; font-size: 15px; color: #be185d; }
.saas-wp .tip { margin: 0 0 14px; font-size: 12px; color: #9ca3af; line-height: 1.7; }
.saas-wp .row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.saas-wp .row > label { min-width: 78px; font-size: 13px; color: #374151; }
.saas-wp input[type="text"], .saas-wp select { flex: 1; min-width: 200px; height: 32px; padding: 0 10px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px; color: #333; background: #fff; }
.saas-wp input[type="range"] { flex: 1; min-width: 140px; accent-color: #ec4899; }
.saas-wp .vnum { font-size: 12px; color: #6b7280; min-width: 46px; }
.saas-wp button { height: 32px; padding: 0 14px; border: 1px solid #ec4899; border-radius: 8px; background: #fff; color: #ec4899; font-size: 13px; cursor: pointer; }
.saas-wp button.solid { background: #ec4899; color: #fff; }
.saas-wp button:hover { background: #fce7f3; color: #be185d; }
