/* ===============================================================
   壹圆助农 · 数据大屏（深色主题）
   ---------------------------------------------------------------
   配色：深蓝黑底 + 商城绿/橙作为强调色
   用途：办公室投屏展示

   ★ 投屏适配方案（重要）
     大屏采用【固定 1920×1080 设计画布 + transform 等比缩放】：
       · 设计稿按 1920×1080 写死，所有元素尺寸、字号、间距都是绝对值
       · 运行时按浏览器窗口实际大小计算缩放比例，整体等比放大/缩小
       · 好处：不管投屏设备是 4K、1080P 还是笔记本，
               布局比例完全一致，文字不会被挤压变形，也不会出现错位
     .screen-stage 是缩放容器，.screen 是 1920×1080 的画布本体。
   =============================================================== */

:root {
  --bg-deep: #070D14;
  --bg-panel: #0E1A26;
  --bg-card: #122334;
  --line: #1D3547;
  --green: #24D07A;
  --green-dim: #17A35C;
  --orange: #FFA53D;
  --blue: #4FC3F7;
  --purple: #A78BFA;
  --text: #E8F1F8;
  --text-dim: #7E97AC;

  /* 投屏设计画布尺寸 */
  --stage-w: 1920px;
  --stage-h: 1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

.hidden { display: none !important; }

/* ===== 投屏缩放舞台 =====
   用 CSS 变量 --scale 做整体等比缩放，由 JS 按窗口大小实时计算 */
.screen-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  overflow: hidden;
}

/* ===== 背景网格光效 ===== */
.screen {
  position: relative;
  width: var(--stage-w);
  height: var(--stage-h);
  flex: 0 0 auto;
  transform: scale(var(--scale, 1));
  transform-origin: center center;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(36, 208, 122, .12), transparent),
    radial-gradient(ellipse 50% 40% at 15% 100%, rgba(255, 165, 61, .07), transparent),
    var(--bg-deep);
}

/* ===== 顶栏 ===== */
.screen-head {
  height: 62px;
  flex: 0 0 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 35, 52, .85), transparent);
}

.head-left { display: flex; align-items: center; gap: 8px; width: 200px; }

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(36, 208, 122, .7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(36, 208, 122, .6); }
  70% { box-shadow: 0 0 0 9px rgba(36, 208, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(36, 208, 122, 0); }
}

.live-text {
  font-size: 12px;
  color: var(--green);
  border: 1px solid rgba(36, 208, 122, .45);
  padding: 1px 9px;
  border-radius: 20px;
  letter-spacing: 1px;
}

.screen-head h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 4px;
  background: linear-gradient(90deg, var(--green), #7FE7B0, var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.head-right { display: flex; align-items: center; gap: 14px; width: 200px; justify-content: flex-end; }
.clock { font-size: 19px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.date { font-size: 12px; color: var(--text-dim); }

.fs-btn {
  background: rgba(36, 208, 122, .12);
  border: 1px solid rgba(36, 208, 122, .35);
  color: var(--green);
  padding: 4px 11px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.fs-btn:hover { background: rgba(36, 208, 122, .24); }

/* ===== 主体三栏 ===== */
.screen-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 21% 1fr 21%;
  gap: 14px;
  padding: 14px 18px;
}

.col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

/* ===== 卡片 ===== */
.card {
  background: linear-gradient(160deg, rgba(18, 35, 52, .95), rgba(14, 26, 38, .95));
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 13px 15px;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

/* 卡片顶部装饰线 */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: .65;
}
.card.accent-line::before {
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
}

/* ===== 轮播焦点卡片 =====
   投屏时无人操作，靠「焦点轮转」让注意力在核心指标间自动流动，
   配合后端可配置的 rotateSeconds（轮播间隔，秒）。 */
.card.rotating-focus {
  border-color: rgba(255, 165, 61, .55);
  box-shadow: 0 0 0 1px rgba(255, 165, 61, .18), 0 0 26px rgba(255, 165, 61, .13);
}
.card.rotating-focus::before {
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  opacity: 1;
}
.card.rotating-focus .card-title::before {
  background: var(--orange);
}
/* 焦点卡片的数值做轻微呼吸放大，远距离也能看清正在强调哪个指标 */
.card.rotating-focus .hero-value,
.card.rotating-focus .big-value {
  animation: focusPulse 2.4s ease-in-out infinite;
}

@keyframes focusPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.card-title {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-title::before {
  content: '';
  width: 3px; height: 13px;
  background: var(--green);
  border-radius: 2px;
}

.card-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.card-sub b { color: var(--text); font-weight: 500; }

/* ===== 细项小格（2026-11-28：充值金额 / 客单价 两张卡的明细） =====
   2×2 网格，投屏时一眼看到「今日充值 / 笔数 / 已消费 / 余额剩」 */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  margin-top: 10px;
}
.kpi {
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(41, 71, 94, .7);
  border-radius: 6px;
  padding: 5px 9px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.kpi span {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: 0 0 auto;
}
.kpi b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 充值卡的主数值略小一点，给下面 4 个小格腾地方，避免左栏挤爆 */
.card-kpi .big-value { font-size: 33px; }

/* ===== 主数值（超大号）===== */
.card-hero { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }

.hero-value {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(36, 208, 122, .38);
  letter-spacing: -1px;
}

.hero-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 9px; }
.hero-sub b { color: var(--orange); font-weight: 600; }

.big-value {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(79, 195, 247, .22);
}
.big-value.accent { color: var(--orange); text-shadow: 0 0 20px rgba(255, 165, 61, .3); }

/* ===== 图表卡片 ===== */
.card-chart { flex: 1 1 50%; display: flex; flex-direction: column; min-height: 0; }
.chart-box { flex: 1; min-height: 0; position: relative; }

/* ===== 排行榜 ===== */
.card-rank { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.rank-list { list-style: none; flex: 1; overflow-y: auto; min-height: 0; }
.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(29, 53, 71, .8);
  font-size: 13.5px;
}
.rank-list li:last-child { border-bottom: none; }

.rank-no {
  width: 21px; height: 21px;
  flex: 0 0 21px;
  border-radius: 4px;
  background: rgba(126, 151, 172, .16);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
}
.rank-list li:nth-child(1) .rank-no { background: var(--orange); color: #14202C; }
.rank-list li:nth-child(2) .rank-no { background: #FFC978; color: #14202C; }
.rank-list li:nth-child(3) .rank-no { background: rgba(255, 165, 61, .35); color: var(--orange); }

.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar-wrap { width: 34%; height: 5px; background: rgba(126, 151, 172, .16); border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--green), var(--green-dim)); transition: width .6s ease; }
.rank-list li:nth-child(1) .rank-bar { background: linear-gradient(90deg, var(--orange), #FF7A1A); }
.rank-val { width: 52px; text-align: right; color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ===== 底部 ===== */
.screen-foot {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  background: rgba(14, 26, 38, .6);
  font-size: 12px;
  color: var(--text-dim);
}

.foot-marquee {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  height: 18px;
}
.foot-marquee-inner {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 26s linear infinite;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.foot-marquee b { color: var(--green); font-weight: 500; }
.foot-marquee .sep { color: var(--line); margin: 0 14px; }

.foot-refresh { white-space: nowrap; }
.foot-refresh b { color: var(--orange); }

/* ===== 实时推送连接状态指示 =====
   投屏时运营需要一眼看出「数据是不是实时的」，所以状态要显眼 */
.conn-on  { color: var(--green); }
.conn-off { color: #FF6B6B; }
.conn-wait { color: var(--orange); }

/* ===== 登录遮罩 ===== */
.screen-login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #10202F, var(--bg-deep));
  z-index: 100;
}

.screen-login-box {
  width: 350px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 30px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.screen-login-box h2 {
  font-size: 19px;
  margin-bottom: 4px;
  color: var(--green);
  letter-spacing: 2px;
}
.screen-login-box .tip { font-size: 12px; color: var(--text-dim); margin-bottom: 18px; }
.screen-login-box label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 12px 0 5px; }
.screen-login-box input {
  width: 100%; height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 13, 20, .6);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.screen-login-box input:focus { border-color: var(--green); }
.screen-login-box button {
  width: 100%; height: 42px;
  margin-top: 20px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  color: #062014;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
}
.screen-login-box button:hover { filter: brightness(1.1); }
.screen-login-box .err { margin-top: 11px; min-height: 17px; font-size: 12.5px; color: #FF6B6B; text-align: center; }

/* ===== 数字滚动动画 ===== */
@keyframes numberFlash {
  0% { color: var(--green); }
  50% { color: #FFFFFF; }
  100% { color: var(--green); }
}
.flash { animation: numberFlash .8s ease; }

/* ===== 小屏适配 ===== */
@media (max-width: 1400px) {
  .screen-body { grid-template-columns: 24% 1fr 24%; }
  .hero-value { font-size: 38px; }
  .big-value { font-size: 31px; }
  .screen-head h1 { font-size: 20px; letter-spacing: 2px; }
}
