/**
 * 凯蒂科技 · 光睿云 · 全局动感 / 科技感增强
 * 通过 CSS 动画 + pvMotion.js 数字滚动，覆盖壳层与全部内页
 */

@media (prefers-reduced-motion: reduce) {
    .pv-motion-enabled *,
    .pv-motion-enabled *::before,
    .pv-motion-enabled *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .pv-page-ambient,
    .pv-platform-bg .pv-ambient-canvas {
        display: none !important;
    }
}

/* ========== 环境背景 ========== */
.pv-platform-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 180, 255, 0.03) 50%, transparent 100%);
    background-size: 100% 200%;
    background-repeat: no-repeat;
    animation: pvScanV 8s ease-in-out infinite;
    pointer-events: none;
}

.pv-platform-bg .pv-ambient-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 180, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 180, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: pvGridDrift 24s linear infinite;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
}

.pv-page-ambient,
.pv-page-ambient::before,
.pv-page-ambient::after {
    display: none !important;
}

.pv-ambient-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.55;
}

.layuimini-container {
    position: relative;
    z-index: 1;
}

/* ========== 入场动画 ========== */
@keyframes pvFadeUp {
    from {
        opacity: 0;
        transform: translate3d(0, 16px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes pvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pvScaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pvScanH {
    0% { transform: translateY(0); opacity: 0; }
    8% { opacity: 0.7; }
    92% { opacity: 0.7; }
    100% { transform: translateY(100vh); opacity: 0; }
}

@keyframes pvScanV {
    0% { background-position: 0 -100%; opacity: 0; }
    10%, 90% { opacity: 1; }
    50% { background-position: 0 100%; opacity: 1; }
    100% { background-position: 0 200%; opacity: 0; }
}

@keyframes pvGridDrift {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(48px, 48px, 0); }
}

@keyframes pvBorderGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(0, 200, 255, 0); }
    50% { box-shadow: 0 0 18px rgba(0, 180, 255, 0.12); }
}

@keyframes pvTopLineShine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pvIconPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.3)); }
    50% { filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.65)); }
}

@keyframes pvNumGlow {
    0%, 100% { text-shadow: 0 0 8px rgba(0, 212, 255, 0.2); }
    50% { text-shadow: 0 0 16px rgba(0, 212, 255, 0.55); }
}

@keyframes pvRowIn {
    from {
        opacity: 0;
        transform: translate3d(-8px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes pvCornerBlink {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.85; }
}

/* 页面就绪后依次入场 */
.pv-motion-enabled .pv-page-hero,
.pv-motion-enabled .pv-page-hero-auto,
.pv-motion-enabled .cockpit-head {
    animation: pvFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pv-motion-enabled .pv-kpi-row .pv-kpi-card,
.pv-motion-enabled .cockpit-kpi .kpi-card,
.pv-motion-enabled .lowgen-summary-bar .sum-item,
.pv-motion-enabled .pv-stat-card {
    animation: pvFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(1),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(1) { animation-delay: 0.06s; }
.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(2),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(2) { animation-delay: 0.12s; }
.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(3),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(3) { animation-delay: 0.18s; }
.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(4),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(4) { animation-delay: 0.24s; }
.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(5),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(5) { animation-delay: 0.30s; }
.pv-motion-enabled .pv-kpi-row .pv-kpi-card:nth-child(6),
.pv-motion-enabled .cockpit-kpi .kpi-card:nth-child(6) { animation-delay: 0.36s; }

.pv-motion-enabled .pv-glass-block,
.pv-motion-enabled .pv-panel-block,
.pv-motion-enabled fieldset.table-search-fieldset,
.pv-motion-enabled .cockpit-filter,
.pv-motion-enabled .cockpit-panel {
    animation: pvFadeUp 0.48s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.pv-motion-enabled .pv-table-wrap,
.pv-motion-enabled .layui-table-view {
    animation: pvFadeIn 0.45s ease 0.22s both;
}

/* ========== 卡片 hover / 呼吸 ========== */
.pv-motion-enabled .pv-kpi-card,
.pv-motion-enabled .kpi-card,
.pv-motion-enabled .pv-stat-card,
.pv-motion-enabled .lowgen-summary-bar .sum-item {
    transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1),
                box-shadow 0.25s ease,
                border-color 0.25s ease;
}

.pv-motion-enabled .pv-kpi-card:hover,
.pv-motion-enabled .kpi-card:hover,
.pv-motion-enabled .pv-stat-card:hover,
.pv-motion-enabled .lowgen-summary-bar .sum-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 136, 255, 0.22);
    border-color: rgba(0, 220, 255, 0.42);
}

.pv-motion-enabled .pv-kpi-card::after,
.pv-motion-enabled .kpi-card::after,
.pv-motion-enabled .pv-stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    animation: pvBorderGlow 4s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.pv-motion-enabled .pv-kpi-card:hover::after,
.pv-motion-enabled .kpi-card:hover::after,
.pv-motion-enabled .pv-stat-card:hover::after {
    opacity: 1;
}

/* 顶栏流光已移至 public.css，此处不再重复 */

.pv-motion-enabled .pv-page-hero .pv-page-title i,
.pv-motion-enabled .cockpit-title i {
    animation: pvIconPulse 3s ease-in-out infinite;
}

/* ========== 数字滚动高亮 ========== */
.pv-motion-enabled .pv-kpi-value.pv-counting,
.pv-motion-enabled .kpi-value.pv-counting,
.pv-motion-enabled .pv-stat-card .val.pv-counting,
.pv-motion-enabled .sum-value.pv-counting,
.pv-motion-enabled [data-pv-count].pv-counting {
    animation: pvNumGlow 0.8s ease;
}

/* 危险指标脉冲 */
.pv-motion-enabled .pv-kpi-card.danger .pv-kpi-value,
.pv-motion-enabled .kpi-card.accent-danger .kpi-value,
.pv-motion-enabled .kpi-value.is-negative {
    animation: pvDangerPulse 2.5s ease-in-out infinite;
}

@keyframes pvDangerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.82; text-shadow: 0 0 12px rgba(255, 87, 34, 0.45); }
}

/* ========== 表格行动画 ========== */
.pv-motion-enabled .layui-table-view .layui-table tbody tr.pv-row-animate {
    animation: pvRowIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ========== 按钮光效 ========== */
.pv-motion-enabled .layui-btn-normal,
.pv-motion-enabled .layui-btn-warm {
    position: relative;
    overflow: hidden;
}

.pv-motion-enabled .layui-btn-normal::after,
.pv-motion-enabled .layui-btn-warm::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transform: translateX(-150%);
    transition: transform 0.45s ease;
    pointer-events: none;
}

.pv-motion-enabled .layui-btn-normal:hover::after,
.pv-motion-enabled .layui-btn-warm:hover::after {
    transform: translateX(250%);
}

/* ========== 图表面板角标 ========== */
.pv-motion-enabled .cockpit-panel.is-chart::before,
.pv-motion-enabled .cockpit-panel.is-chart::after,
.pv-motion-enabled .pv-chart-panel::before,
.pv-motion-enabled .pv-chart-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: rgba(0, 212, 255, 0.5);
    border-style: solid;
    pointer-events: none;
    animation: pvCornerBlink 3s ease-in-out infinite;
    z-index: 2;
}

.pv-motion-enabled .cockpit-panel.is-chart::before,
.pv-motion-enabled .pv-chart-panel::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
}

.pv-motion-enabled .cockpit-panel.is-chart::after,
.pv-motion-enabled .pv-chart-panel::after {
    bottom: 8px;
    right: 8px;
    border-width: 0 2px 2px 0;
    animation-delay: 1.5s;
}

.pv-motion-enabled .cockpit-panel.is-chart,
.pv-motion-enabled .pv-chart-panel {
    position: relative;
}

/* ========== 壳层增强 ========== */
.pv-motion-enabled .pv-clock-time {
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.35);
}

.pv-motion-enabled .pv-tab-pill.is-active {
    box-shadow: 0 0 14px rgba(0, 180, 255, 0.25);
}

.pv-motion-enabled .pv-module-nav .layui-this > a {
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

.pv-motion-enabled .pv-side-icon-item.is-active .pv-side-icon-btn {
    box-shadow: 0 0 16px rgba(0, 180, 255, 0.35);
}

/* 加载态扫描 */
.pv-motion-enabled .layui-table-init {
    position: relative;
    overflow: hidden;
}

.pv-motion-enabled .layui-table-init::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.08), transparent);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: pvTableInitSweep 1.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pvTableInitSweep {
    0% { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}
