/* ============================================================
   事件本地动态预测（/Event 事件列表底部「预测」按钮 → 弹窗）
   视觉与 Wiki/EventPrediction 保持一致；此处只负责「弹窗外壳」与尺寸。
   ============================================================ */

/* ---- 弹窗外壳：宽 80%、高 90%（对齐联网预测页的宽高比）---- */
.elp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    /* 高于 /Event 自身弹层(1000) 与全局 AI 助手浮窗(10000)：全屏推演弹窗应盖住它们；
       弹窗内部嵌套的「对标案例」弹窗(.rc-modal-overlay 10002) 在本层级上下文内继续居顶。 */
    z-index: 10500;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.elp-modal-overlay.show { display: flex; }

.elp-modal-card {
    width: 80vw;
    height: 90vh;
    max-width: 1900px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(148, 163, 184, 0.12);
    animation: elp-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes elp-pop {
    from { transform: scale(0.96) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---- 弹窗头部 ---- */
.elp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    background: linear-gradient(90deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.9));
    flex-shrink: 0;
}
.elp-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.elp-head-badge {
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 5px;
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
    flex-shrink: 0;
}
.elp-head-titles { display: flex; flex-direction: column; min-width: 0; }
.elp-head-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52vw;
}
.elp-head-sub { font-size: 11px; color: #94a3b8; }
.elp-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.elp-head-horizon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #64748b;
    white-space: nowrap;
}
.elp-head-horizon select {
    padding: 4px 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #4f46e5;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 7px;
    cursor: pointer;
    outline: none;
}
.elp-head-stat {
    font-size: 11.5px;
    font-weight: 700;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 9999px;
    padding: 2px 10px;
    white-space: nowrap;
}
.elp-head-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 0.15s;
}
.elp-head-btn:hover:not(:disabled) { filter: brightness(1.07); }
.elp-head-btn:disabled { opacity: 0.6; cursor: default; }

/* 空闲首帧里的主行动按钮：开始预测（弹窗不再自动推演，由用户点它触发） */
.elp-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 26px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 18px -6px rgba(79, 70, 229, 0.65);
    transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
}
.elp-start-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(79, 70, 229, 0.7);
}
.elp-start-btn:active { transform: translateY(0); }
.elp-start-btn svg { flex-shrink: 0; }

/* 历史基线改动后：只有点了「重新推演」才会按新基线重算，
   这里给按钮加一圈呼吸光环，把注意力引过去（改动不再自动触发推演）。 */
.elp-head-btn.elp-rerun-pending {
    animation: elp-rerun-pulse 1.6s ease-in-out infinite;
}
@keyframes elp-rerun-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
    50%      { box-shadow: 0 0 0 6px rgba(79, 70, 229, 0); }
}
.elp-head-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
}
.elp-head-close:hover { background: rgba(226, 232, 240, 0.9); color: #475569; }

/* ---- 预测加载转圈：纯 CSS，不依赖 Tailwind ----
 * 原来用一组 Tailwind 类画转圈（w-14 h-14 / absolute inset-0 / rounded-full / border-4 / animate-spin），
 * 一旦这些类没被 Tailwind 生成，元素就塌成 0 尺寸且无边框 → 完全不可见，
 * 表现为「点击预测后只有加载文字、上面没有圆圈」。这里用独立类绕开。 */
.elp-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e0e7ff;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: elp-spin 0.8s linear infinite;
    flex-shrink: 0;
    margin-bottom: 16px;   /* 不依赖 Tailwind 的 gap-4 */
}

@keyframes elp-spin { to { transform: rotate(360deg); } }

/* ---- 弹窗主体：左侧预测历史栏 + 右侧预测大盘，横向排布 ---- */
.elp-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

/* 展开左侧历史栏时把弹窗加宽（80vw → 92vw），让右侧大盘宽度基本不变 —— 
   否则 300px 历史栏会从大盘里"抢"走宽度，图表被压扁。 */
.elp-modal-card { transition: width 0.22s ease; }
.elp-modal-card.ph-expanded { width: 92vw; }

/* ---- 弹窗内容区（承载原预测页大盘） ---- */
/* ⚠️ 这行的结束符以前漏了（写成了 `----.elp-app {`），导致下面这条 .elp-app 规则
   （flex/min-height/background）连同 .elp-app > main、.elp-app #dashboardGrid 一起被当成注释吃掉，
   大盘因此是「按整卡高度布局」而不是「按去掉头部后的高度布局」，底部会被 overflow:hidden 裁掉。 */
.elp-app {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    color: #1e293b;
    background: radial-gradient(120% 120% at 50% 10%, #fcfdfe 0%, #f1f5fa 60%, #e5ebf4 100%);
}
.elp-app > main { height: 100%; }
.elp-app #dashboardGrid { height: 100%; }

/* 窄屏：弹窗贴近满屏，避免内部卡片被压扁 */
@media (max-width: 1280px) {
html:not([data-fit]) .elp-modal-card { width: 96vw; height: 94vh; }
html:not([data-fit]) .elp-modal-card.ph-expanded { width: 99vw; }
html:not([data-fit]) .elp-head-title { max-width: 40vw; }
/* 窄屏下历史栏收窄，把宽度留给大盘 */
html:not([data-fit]) .ph-host { width: 250px; }
}

/* ============================================================
   以下为与联网预测页共用的视觉语言（磨砂面板 / 战情卡片 / 时间线 / 对标弹窗）
   ============================================================ */

/* 磨砂玻璃科技白控制面板 */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.015),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 战情指挥微拟物卡片 */
.tactical-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tactical-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

/* 超大屏微滚动条 */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); }

/* 启动按钮呼吸微光 */
@keyframes pulse-cyan {
    0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); }
}
.pulse-active { animation: pulse-cyan 2s infinite; }

/* 风险脉冲高亮 */
@keyframes risk-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.35; }
}
.risk-glow-active { animation: risk-pulse 1.5s infinite ease-in-out; }

/* line-clamp-2（Tailwind兼容） */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   最新消息 - 竖向时间线
   布局基准：容器 padding-left 18px；轴线中心 x=6；
   节点 left:-17px / 宽 10px → 中心 18-17+5=6，与轴线对齐。
   ============================================================ */
.feed-timeline {
    position: relative;
    padding-left: 18px;
    padding-top: 2px;
}
/* 主轴线：今日（顶部）绿→靛，越往后越淡，暗示时间由近及远 */
.feed-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 4px;
    bottom: 2px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg,
        rgba(16, 185, 129, 0.55) 0%,
        rgba(99, 102, 241, 0.35) 45%,
        rgba(148, 163, 184, 0.15) 100%);
}

/* 日期分组标尺 */
.feed-tl-day {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
}
.feed-tl-day::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 2px;
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.95);
}
.feed-tl-day em {
    font-style: normal;
    font-weight: 600;
    font-size: 11px;
    color: #64748b;
    background: rgba(241, 245, 249, 0.9);
    border-radius: 9999px;
    padding: 0 7px;
}

/* 单条消息 */
.feed-tl-item {
    position: relative;
    padding-bottom: 10px;
}
.feed-tl-node {
    position: absolute;
    left: -17px;
    top: 8px;
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border-radius: 9999px;
    background: #fff;
    border: 2px solid #6366f1;
    z-index: 1;
}
/* 最新一条：绿色呼吸节点 */
@keyframes feed-node-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
    50%      { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
}
.feed-tl-item.is-latest .feed-tl-node {
    border-color: #10b981;
    animation: feed-node-pulse 2s infinite ease-in-out;
}

.feed-tl-body { min-width: 0; }

.feed-tl-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    line-height: 1.2;
}
.feed-tl-time {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    font-variant-numeric: tabular-nums;
}
.feed-tl-badge {
    font-size: 11px;
    font-weight: 700;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 9999px;
    padding: 0 6px;
}
.feed-tl-rel {
    font-size: 11px;
    color: #94a3b8;
}
.feed-tl-src {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0 5px;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-tl-card {
    border-radius: 12px;
    padding: 8px 10px;
}
.feed-tl-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    color: #1e293b;
    text-decoration: none;
}
a.feed-tl-title:hover {
    color: #4f46e5;
    text-decoration: underline;
}
.feed-tl-desc {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

/* ============================================================
   对标历史事件：可点击卡片 + 详情弹窗内部分块样式
   （弹窗外壳复用 report-chunk-modal.css 的 .rc-* 全局样式）
   ============================================================ */
.an-card {
    cursor: pointer;
    position: relative;
}
.an-card:hover,
.an-card:focus-visible {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 10px 25px -8px rgba(79, 70, 229, 0.25);
}
.an-card:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 1px;
}
.an-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(203, 213, 225, 0.7);
}
.an-card-date {
    font-size: 11px;
    color: #94a3b8;
}
.an-card-hint {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #6366f1;
    flex-shrink: 0;
}
.an-card:hover .an-card-hint { color: #4338ca; }

/* 操作反馈 Toast 需浮在弹窗之上（.rc-modal-overlay 的 z-index 为 10002） */
#elpApp #toast { z-index: 10010; }

/* 弹窗报告纸内：指标块 + 小节标题
   （改纵向行式布局：来源报告/推定时间等长文本不会在窄列里折成多行） */
.an-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.an-metric {
    background: rgba(241, 245, 249, 0.7);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 10px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.an-metric-label {
    font-size: 11.5px;
    color: #94a3b8;
    flex-shrink: 0;
}
.an-metric-value {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    text-align: right;
    word-break: break-word;
}
.an-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    letter-spacing: 1px;
    margin: 4px 0 8px;
    padding-left: 8px;
    border-left: 3px solid rgba(79, 70, 229, 0.6);
}

/* 侧栏相似度进度条 */
.an-bar {
    height: 6px;
    border-radius: 9999px;
    background: rgba(226, 232, 240, 0.9);
    overflow: hidden;
    margin: -6px 0 4px;
}
.an-bar > span {
    display: block;
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
}

/* ============================================================
   整页字号放大：页面大量使用 9~11px 小字，整体上移一个层级
   （同时作用于 JS 动态生成的卡片内容，因为用的是同一批 class）
   ============================================================ */
#elpApp [class*="text-[9px]"]   { font-size: 11px !important; }
#elpApp [class*="text-[10px]"]  { font-size: 12px !important; }
#elpApp [class*="text-[11px]"]  { font-size: 13px !important; }
#elpApp .text-xs                { font-size: 13px !important; }

/* 适配布局容器高度 */
#elpApp {
    min-height: 0;
    overflow: hidden;
}

/* 不允许body滚动（弹窗打开时由 JS 加 hidden 内联样式，此处仅兜底） */
body.elp-modal-open {
    overflow: hidden;
}

/* 响应式微调 */
@media (max-width: 1024px) {
html:not([data-fit]) #elpApp {
        overflow-y: auto;
    }
html:not([data-fit]) #dashboardGrid > section {
        max-height: none;
    }
}
