/* =============================================================================
 * GallopWave 智能驾驶舱 · 设计系统（深色科技蓝 + 发光模块化卡片）
 * ===========================================================================*/
:root {
  --bg-0: #03081a;
  --bg-1: #061229;
  --panel: rgba(9, 24, 52, 0.55);
  --panel-solid: rgba(7, 18, 40, 0.92);
  --border: rgba(45, 212, 255, 0.35);
  --border-strong: rgba(45, 212, 255, 0.7);
  --accent: #2dd4ff;
  --accent2: #3b82f6;
  --text: #d6ecff;
  --muted: #8fb4dd;
  --good: #22d3a7;
  --warn: #f7b955;
  --bad: #ff5c7c;
  --header-h: 70px;
  --glow: 0 0 18px rgba(45, 212, 255, 0.16), inset 0 0 22px rgba(45, 212, 255, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 18% -8%, rgba(34, 110, 220, 0.22), transparent 60%),
    radial-gradient(1100px 800px at 100% 0%, rgba(45, 212, 255, 0.14), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(59, 130, 246, 0.16), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0));
  overflow: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(45, 212, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 35%, #000 30%, transparent 85%);
}

/* ---------------- 顶部 ---------------- */
.gw-header {
  position: relative; z-index: 2;
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid rgba(45, 212, 255, 0.2);
  background: linear-gradient(180deg, rgba(8, 22, 48, 0.85), rgba(8, 22, 48, 0.25));
}
.gw-title-wrap { display: flex; flex-direction: column; line-height: 1.15; }
.gw-title {
  font-size: 26px; font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(90deg, #eaf6ff, #2dd4ff 60%, #3b82f6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 18px rgba(45, 212, 255, 0.35);
}
.gw-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin-top: 3px; }

/* 看板导航 */
.gw-nav { display: flex; align-items: center; gap: 6px; }
.gw-nav-item {
  font-size: 13px; color: var(--muted); text-decoration: none; padding: 6px 12px;
  border: 1px solid transparent; border-radius: 16px; transition: .2s; white-space: nowrap;
}
.gw-nav-item:hover { color: var(--text); border-color: rgba(45, 212, 255, 0.25); }
.gw-nav-item.active {
  color: #eaf6ff; border-color: var(--border-strong);
  background: rgba(45, 212, 255, 0.14); box-shadow: var(--glow);
}

/* 顶部中央装饰线 */
.gw-header::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: -1px;
  width: 46%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent);
}

/* ---------------- 统一顶栏组件 ---------------- */
.topbar-cluster { display: flex; align-items: center; gap: 14px; }
.tb-user {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text);
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 16px;
  background: rgba(45, 212, 255, 0.08);
}
.tb-user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.tb-sep { width: 1px; height: 26px; background: rgba(45, 212, 255, 0.25); }
.tb-clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.tb-time { font-family: "Bahnschrift", "Consolas", monospace; font-size: 20px; font-weight: 700; color: var(--accent); text-shadow: 0 0 10px rgba(45, 212, 255, 0.5); letter-spacing: 1px; }
.tb-date { font-size: 11px; color: var(--muted); }
.tb-label { font-size: 12px; color: var(--muted); }
.tb-carousel, .tb-filter { display: flex; align-items: center; gap: 8px; }

.tb-select {
  background: rgba(8, 22, 48, 0.8); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; outline: none; cursor: pointer;
}
.tb-select:focus { border-color: var(--border-strong); }

.tb-switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.tb-switch input { display: none; }
.tb-slider { position: absolute; inset: 0; background: rgba(45, 212, 255, 0.15); border: 1px solid var(--border); border-radius: 20px; transition: .25s; cursor: pointer; }
.tb-slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 2px; border-radius: 50%; background: var(--muted); transition: .25s; }
.tb-switch input:checked + .tb-slider { background: rgba(45, 212, 255, 0.35); border-color: var(--border-strong); }
.tb-switch input:checked + .tb-slider::before { transform: translateX(20px); background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.tb-hint { font-size: 11px; color: var(--muted); }

.tb-gear {
  background: rgba(8, 22, 48, 0.8); color: var(--accent); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: .2s;
}
.tb-gear:hover { background: rgba(45, 212, 255, 0.18); box-shadow: var(--glow); }
.tb-logout { color: var(--warn); border-color: rgba(247, 185, 85, 0.4); }
.tb-logout:hover { background: rgba(247, 185, 85, 0.16); box-shadow: 0 0 14px rgba(247, 185, 85, 0.3); }

/* ---------------- 网格 ---------------- */
.gw-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(6, 1fr);
  gap: 14px; height: calc(100vh - var(--header-h)); padding: 14px;
}

/* ---------------- 模块化卡片（发光蓝边框 + 四角装饰） ---------------- */
.gw-card {
  position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--glow);
  backdrop-filter: blur(2px);
  background-image:
    linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--accent), var(--accent)),
    linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--accent), var(--accent)),
    linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--accent), var(--accent)),
    linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom;
}
.gw-card-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px 7px;
  border-bottom: 1px solid rgba(45, 212, 255, 0.16);
}
.gw-card-bar { width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent2)); box-shadow: 0 0 8px var(--accent); }
.gw-card-title { font-size: 14px; font-weight: 700; color: #eaf6ff; letter-spacing: 1px; }
.gw-card-live { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.gw-card-body { position: relative; flex: 1; min-height: 0; padding: 8px 10px 10px; overflow: hidden; }
.gw-chart { position: absolute; inset: 0; width: 100%; height: 100%; }

.widget-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 13px; }

/* ---------------- 数字翻牌器 ---------------- */
.flip-card { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; }
.flip-label { font-size: 14px; color: var(--muted); letter-spacing: 2px; }
.flip-row { display: flex; align-items: baseline; gap: 8px; }
.flip-number {
  font-family: "Bahnschrift", "DIN Alternate", "Consolas", monospace;
  font-size: 46px; font-weight: 800; color: #fff; line-height: 1;
  text-shadow: 0 0 16px rgba(45, 212, 255, 0.6);
  display: flex; align-items: flex-end;
}
.flip-digit { display: inline-block; width: 0.62em; height: 1em; overflow: hidden; position: relative; }
.flip-reel { display: flex; flex-direction: column; transition: transform 0.9s cubic-bezier(0.2, 0.85, 0.2, 1); }
.flip-reel b { height: 1em; line-height: 1em; display: block; text-align: center; }
.flip-sep { display: inline-block; }
.flip-unit { font-size: 15px; color: var(--accent); align-self: flex-end; margin-bottom: 6px; }
.flip-delta { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.flip-delta.up { color: var(--good); background: rgba(34, 211, 167, 0.12); }
.flip-delta.down { color: var(--bad); background: rgba(255, 92, 124, 0.12); }

/* ---------------- 告警列表 ---------------- */
.alarm-list { height: 100%; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.alarm-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; background: rgba(8, 22, 48, 0.6); border-left: 3px solid var(--muted); font-size: 12px; }
.alarm-item.lv-high { border-left-color: var(--bad); }
.alarm-item.lv-mid { border-left-color: var(--warn); }
.alarm-item.lv-low { border-left-color: var(--good); }
.alarm-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.lv-high .alarm-dot { color: var(--bad); box-shadow: 0 0 6px var(--bad); }
.lv-mid .alarm-dot { color: var(--warn); box-shadow: 0 0 6px var(--warn); }
.lv-low .alarm-dot { color: var(--good); box-shadow: 0 0 6px var(--good); }
.alarm-time { color: var(--muted); font-family: monospace; flex: none; }
.alarm-src { color: var(--accent); flex: none; font-weight: 700; }
.alarm-msg { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alarm-level { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,0.06); }

/* ---------------- 设置抽屉 ---------------- */
.gw-drawer-mask { position: fixed; inset: 0; z-index: 50; background: rgba(2, 8, 20, 0.55); display: none; }
.gw-drawer-mask.open { display: block; }
.gw-drawer {
  position: absolute; top: 0; right: 0; height: 100%; width: 360px; max-width: 86vw;
  background: var(--panel-solid); border-left: 1px solid var(--border-strong);
  box-shadow: -8px 0 30px rgba(0,0,0,0.5); padding: 18px; overflow-y: auto;
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.gw-drawer-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; color: #eaf6ff; margin-bottom: 14px; }
.gw-drawer-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.gw-drawer-sec { font-size: 12px; color: var(--accent); margin: 14px 0 8px; letter-spacing: 1px; }
.gw-drawer-ctl { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.gw-drawer-ctl select { background: rgba(8,22,48,0.8); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.gw-drawer-list { display: flex; flex-direction: column; gap: 7px; }
.gw-drawer-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: rgba(8,22,48,0.5); border: 1px solid rgba(45,212,255,0.15); border-radius: 6px; cursor: pointer; font-size: 13px; }
.gw-drawer-row input { width: 15px; height: 15px; accent-color: var(--accent); }
.gw-drawer-name { color: var(--text); min-width: 92px; }
.gw-drawer-ep { color: var(--muted); font-size: 11px; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-drawer-foot { margin-top: 16px; font-size: 11px; color: var(--muted); line-height: 1.6; }
