/* ===== 矿用耦合器监测平台 · 深色科技风 V2.1 ===== */
* { box-sizing: border-box; }
body {
  margin:0;
  font-family:"Microsoft YaHei","PingFang SC",sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(0,90,160,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0,140,200,.10), transparent 55%),
    #0a0f1a;
  background-attachment: fixed;
  color:#d7e2f0;
}

/* ---- 顶栏 ---- */
.topbar {
  background:linear-gradient(90deg, #0c1526 0%, #0e1e38 55%, #0c1526 100%);
  border-bottom:1px solid rgba(0,212,255,.28);
  box-shadow:0 2px 18px rgba(0,212,255,.12);
  color:#e8f4ff; padding:12px 24px; display:flex; align-items:center; gap:32px;
}
.brand {
  font-size:18px; font-weight:700; letter-spacing:1px;
  color:#00d4ff;
  text-shadow:0 0 12px rgba(0,212,255,.65), 0 0 34px rgba(0,212,255,.28);
}
.topbar a { color:#9db8d8; text-decoration:none; margin-right:18px; transition:color .15s, text-shadow .15s; }
.topbar a:hover { color:#00d4ff; text-shadow:0 0 10px rgba(0,212,255,.6); }

.wrap { max-width:1280px; margin:20px auto; padding:0 16px; }
h2 { font-size:17px; margin:22px 0 10px; color:#eaf4ff; letter-spacing:.5px; }
h3 { font-size:14px; margin:6px 0 8px; color:#9fc3e8; }
.muted { color:#6d84a3; font-weight:400; font-size:12px; }
.mono { font-family:Consolas,"JetBrains Mono",monospace; font-size:12px; color:#8fd8ff; }

/* ---- 卡片：玻璃拟态 + 青色描边 + 发光 ---- */
.card {
  background:rgba(17,27,46,.82);
  border:1px solid rgba(0,212,255,.22);
  border-radius:10px;
  padding:14px 16px; margin-bottom:14px;
  box-shadow:0 0 0 1px rgba(0,0,0,.25), 0 6px 24px rgba(0,0,0,.45), inset 0 1px 0 rgba(120,200,255,.06);
  backdrop-filter:blur(4px);
}
.empty { color:#5f7492; padding:24px 8px; text-align:center; }

/* ---- 表格 ---- */
.tbl { width:100%; border-collapse:collapse; font-size:13px; }
.tbl th {
  text-align:left; background:rgba(0,90,160,.18); color:#7fd0ff;
  padding:8px; border-bottom:2px solid rgba(0,212,255,.30); white-space:nowrap;
}
.tbl td { padding:7px 8px; border-bottom:1px solid rgba(90,130,180,.16); color:#c6d6ea; }
.tbl tr:hover td { background:rgba(0,140,220,.08); }
.scroll { overflow-x:auto; }

/* ---- 标签 ---- */
.tag { display:inline-block; padding:2px 8px; border-radius:10px; font-size:12px; }
.tag.on    { background:rgba(34,197,94,.16);  color:#4ade80; border:1px solid rgba(34,197,94,.45); }
/* 在线呼吸灯 */
.tag.on::before {
  content:''; display:inline-block; width:7px; height:7px; margin-right:5px;
  border-radius:50%; background:#4ade80; vertical-align:1px;
  box-shadow:0 0 8px rgba(34,197,94,.9);
  animation:tagBlink 1.6s ease-in-out infinite;
}
@keyframes tagBlink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.35;transform:scale(.72)} }
/* 报警：红色急促闪烁 */
.tag.alarm {
  animation:alarmFlash 1s steps(2, jump-none) infinite;
}
@keyframes alarmFlash {
  0%,100% { box-shadow:0 0 10px rgba(239,68,68,.75); background:rgba(239,68,68,.30); }
  50%     { box-shadow:0 0 2px rgba(239,68,68,.2);  background:rgba(239,68,68,.10); }
}
/* 提醒：琥珀温和脉动 */
.tag.warn { animation:warnPulse 2.4s ease-in-out infinite; }
@keyframes warnPulse {
  0%,100% { box-shadow:0 0 8px rgba(245,158,11,.55); }
  50%     { box-shadow:0 0 1px rgba(245,158,11,.1); }
}

/* ---- 标题：左侧青色光条 ---- */
h2 {
  padding-left:12px; border-left:3px solid #00d4ff;
  text-shadow:0 0 14px rgba(0,212,255,.25);
}
h2 .form, h2 form { border-left:0; }

/* ---- 卡片悬停提亮 ---- */
.card { transition:border-color .2s, box-shadow .2s; }
.card:hover {
  border-color:rgba(0,212,255,.45);
  box-shadow:0 0 0 1px rgba(0,0,0,.25), 0 8px 30px rgba(0,0,0,.5), 0 0 18px rgba(0,212,255,.10);
}

/* ---- 按钮按压反馈 ---- */
.btn:active, .btn-block:active { transform:translateY(1px); }

/* ---- 导航悬停光晕 ---- */
.topbar nav a { padding:5px 10px; border-radius:6px; transition:background .15s, color .15s, text-shadow .15s; }
.topbar nav a:hover { background:rgba(0,212,255,.12); }

/* ---- 登录页进场动画 ---- */
.login-card { animation:riseIn .5s ease-out; }
@keyframes riseIn {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ---- 链接悬停下划光 ---- */
.wrap a { transition:color .15s, text-shadow .15s; }

/* ---- 首页统计数字带 ---- */
.stat-row { display:flex; gap:14px; flex-wrap:wrap; margin:4px 0 16px; }
.stat {
  flex:1; min-width:150px; position:relative; overflow:hidden;
  background:rgba(17,27,46,.82);
  border:1px solid rgba(0,212,255,.22); border-radius:10px;
  padding:14px 18px 12px;
  box-shadow:0 6px 24px rgba(0,0,0,.45);
  transition:border-color .2s, box-shadow .2s, transform .2s;
}
.stat:hover { transform:translateY(-2px); border-color:rgba(0,212,255,.5);
              box-shadow:0 10px 30px rgba(0,0,0,.5), 0 0 20px rgba(0,212,255,.12); }
/* 顶部光带 */
.stat::before {
  content:''; position:absolute; left:0; right:0; top:0; height:2px;
  background:linear-gradient(90deg, transparent, rgba(0,212,255,.8), transparent);
}
.stat .num {
  font-size:32px; font-weight:700; line-height:1.2;
  font-family:Consolas,"JetBrains Mono",monospace; letter-spacing:1px;
}
.stat .lbl { font-size:12px; color:#7f97b6; margin-top:2px; display:flex; justify-content:space-between; align-items:center; }
.stat .ico { font-size:14px; }
.stat.s-total .num { color:#00d4ff; text-shadow:0 0 14px rgba(0,212,255,.55); }
.stat.s-on    .num { color:#4ade80; text-shadow:0 0 14px rgba(34,197,94,.55); }
.stat.s-on    .ico { color:#4ade80; animation:tagBlink 1.6s ease-in-out infinite; }
.stat.s-off   .num { color:#8a9bb3; }
.stat.s-loc   .num { color:#38bdf8; text-shadow:0 0 14px rgba(56,189,248,.55); }
.stat.s-loc   .ico { filter:drop-shadow(0 0 4px rgba(56,189,248,.6)); }
.stat.s-alarm      { border-color:rgba(239,68,68,.45); }
.stat.s-alarm::before { background:linear-gradient(90deg, transparent, rgba(239,68,68,.85), transparent); }
.stat.s-alarm .num { color:#ff6b6b; text-shadow:0 0 14px rgba(239,68,68,.6);
                     animation:alarmNumPulse 1s ease-in-out infinite; }
.stat.s-alarm .ico { color:#ff6b6b; }
.stat.s-ok    .num { color:#4ade80; text-shadow:0 0 14px rgba(34,197,94,.5); }
.stat.s-ok    .ico { color:#4ade80; }
@keyframes alarmNumPulse { 0%,100%{opacity:1} 50%{opacity:.55} }
@media (max-width:640px){ .stat{min-width:44%;} .stat .num{font-size:26px;} }

/* ---- 手机端自适应（≤760px） ---- */
@media (max-width:760px){
  /* 顶栏允许换行，避免把页面撑宽导致整体偏移 */
  .topbar { flex-wrap:wrap; gap:8px 16px; padding:10px 14px; }
  .brand { font-size:16px; }
  .topbar nav { display:flex; flex-wrap:wrap; }
  .topbar a { margin-right:10px; font-size:13px; padding:4px 8px; }
  .topbar-right { margin-left:0; width:100%; justify-content:flex-end; gap:10px; }
  .wrap { padding:0 10px; margin:14px auto; }
  h2 { font-size:16px; }
  /* 统计卡两列 */
  .stat-row { gap:10px; }
  .stat { min-width:calc(50% - 5px); padding:10px 12px; }
  .stat .num { font-size:24px; }
  /* 靠近提醒条与状态卡全宽化 */
  .prox-bar { font-size:13px; gap:8px; }
  #prox-card { left:8px; right:8px; width:auto; bottom:8px; }
  /* 表格字体略缩，减少横向滚动 */
  .tbl { font-size:12px; }
  .tbl th, .tbl td { padding:6px 6px; }
  /* 内联表单输入框不溢出 */
  .inline-form input, .inline-form select { max-width:100%; }
  /* 登录卡片不超出窄屏 */
  .login-card { width:100%; max-width:340px; }
  .login-box { padding:0 14px; min-height:70vh; }
}
.tag.off   { background:rgba(120,140,165,.14); color:#8a9bb3; border:1px solid rgba(120,140,165,.35); }
.tag.alarm { background:rgba(239,68,68,.16);  color:#ff7b7b; border:1px solid rgba(239,68,68,.5);
             text-shadow:0 0 8px rgba(239,68,68,.5); }
.tag.warn  { background:rgba(245,158,11,.15); color:#fbbf24; border:1px solid rgba(245,158,11,.45); }
.row-off td { color:#5a6b84; }
.bat-low { color:#ff7b7b; font-weight:700; text-shadow:0 0 8px rgba(239,68,68,.45); }

/* ---- 数字/参数区 ---- */
.kv { display:flex; gap:36px; flex-wrap:wrap; font-size:14px; }
.kv input { padding:4px 8px; border:1px solid rgba(0,212,255,.35); border-radius:4px;
            background:#0c1626; color:#d7e2f0; }
.kv button { padding:5px 14px; border:0; border-radius:4px; background:#1d6fb8; color:#fff; cursor:pointer; }
.kv button:hover { background:#2a86d8; }

a { color:#4fc3ff; text-decoration:none; }
a:hover { color:#8fe0ff; text-shadow:0 0 8px rgba(0,212,255,.5); }

.foot { text-align:center; color:#4d617c; font-size:12px; padding:26px 0 18px; }
canvas { width:100%; }

/* ---- 顶栏右侧 / 登录 ---- */
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:12px; }
.muted-light { color:#7f97b6; font-size:12px; }
.flash {
  background:rgba(245,158,11,.12); color:#fbbf24;
  border:1px solid rgba(245,158,11,.45); border-radius:6px;
  padding:8px 14px; margin-bottom:12px; font-size:13px;
}
.login-box { display:flex; justify-content:center; align-items:center; min-height:80vh; }
.login-card { width:340px; box-shadow:0 0 40px rgba(0,212,255,.14), 0 12px 40px rgba(0,0,0,.55); }
.login-card h2 { text-align:center; color:#00d4ff; text-shadow:0 0 14px rgba(0,212,255,.6); }
.login-card label { display:block; margin:12px 0 4px; font-size:13px; color:#8ba6c8; }
.login-card input {
  width:100%; padding:8px 10px; font-size:14px;
  background:#0c1626; color:#e2f0ff;
  border:1px solid rgba(0,212,255,.35); border-radius:5px;
}
.login-card input:focus { outline:none; border-color:#00d4ff; box-shadow:0 0 10px rgba(0,212,255,.4); }
.btn-block {
  width:100%; margin-top:16px; padding:9px 0; border:0; border-radius:5px;
  background:linear-gradient(90deg,#0e6db0,#00a8d8); color:#fff; font-size:15px; cursor:pointer;
  letter-spacing:6px; box-shadow:0 4px 16px rgba(0,150,220,.35); transition:box-shadow .15s;
}
.btn-block:hover { box-shadow:0 4px 24px rgba(0,190,255,.55); }

/* ---- 按钮 ---- */
.btn {
  padding:5px 12px; border-radius:4px; font-size:12px; cursor:pointer;
  background:rgba(20,40,70,.7); border:1px solid rgba(0,212,255,.35); color:#bfe2ff;
  transition:box-shadow .15s, border-color .15s;
}
.btn:hover { border-color:#00d4ff; box-shadow:0 0 10px rgba(0,212,255,.35); color:#eaf8ff; }
.btn.primary {
  background:linear-gradient(90deg,#0e6db0,#00a8d8); border-color:transparent; color:#fff;
  box-shadow:0 2px 10px rgba(0,150,220,.3);
}
.btn.primary:hover { box-shadow:0 2px 18px rgba(0,190,255,.5); }
.btn.danger { background:rgba(80,20,26,.5); border-color:rgba(239,68,68,.55); color:#ff9a9a; }
.btn.danger:hover { border-color:#ef4444; box-shadow:0 0 12px rgba(239,68,68,.4); color:#ffc4c4; }

/* ---- 表单 ---- */
.inline-form { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin:8px 0 14px; }
.inline-form input, .inline-form select {
  padding:6px 9px; font-size:13px;
  background:#0c1626; color:#d7e2f0;
  border:1px solid rgba(0,212,255,.30); border-radius:4px;
}
.inline-form input:focus, .inline-form select:focus,
.tbl input:focus, .tbl select:focus {
  outline:none; border-color:#00d4ff; box-shadow:0 0 8px rgba(0,212,255,.35);
}
.tbl input { width:62px; padding:4px 6px; font-size:12px;
             background:#0c1626; color:#d7e2f0; border:1px solid rgba(0,212,255,.28); border-radius:4px; }
.tbl input.w90 { width:90px; }
.tbl select { padding:4px 6px; font-size:12px;
              background:#0c1626; color:#d7e2f0; border:1px solid rgba(0,212,255,.28); border-radius:4px; }
.row-new td { background:rgba(0,140,220,.07); }
.kv form input { margin-top:4px; }
select option { background:#0c1626; color:#d7e2f0; }

/* ---- 滚动条（深色） ---- */
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track { background:#0a0f1a; }
::-webkit-scrollbar-thumb { background:#1d3556; border-radius:5px; }
::-webkit-scrollbar-thumb:hover { background:#2a5a8a; }

/* ---- Leaflet 深色化（地图页） ---- */
.leaflet-container { background:#0a0f1a; }
.dark-tiles { filter:invert(0.92) hue-rotate(180deg) saturate(0.72) brightness(0.86) contrast(1.05); }
.leaflet-control-zoom a, .leaflet-control-layers {
  background:rgba(17,27,46,.92) !important; color:#bfe2ff !important;
  border:1px solid rgba(0,212,255,.3) !important;
}
.leaflet-control-layers label { color:#bfe2ff; }
.leaflet-control-scale-line { background:rgba(17,27,46,.8); color:#9fc3e8; border-color:rgba(0,212,255,.35); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background:#101d33 !important; color:#d7e2f0 !important;
  border:1px solid rgba(0,212,255,.35); box-shadow:0 6px 24px rgba(0,0,0,.6) !important;
}
.leaflet-popup-content a { color:#4fc3ff !important; }
.leaflet-control-attribution { background:rgba(10,15,26,.75) !important; color:#4d617c !important; }
.leaflet-control-attribution a { color:#4d617c !important; }
