/* ============ 气举清砂排液智能系统数据监控平台 样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

/* 顶部导航 */
.topbar {
  background: #1e293b;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid #334155;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .title {
  font-size: 18px;
  font-weight: bold;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .title .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 6px #22c55e;
}
.topbar .title .dot.off { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.topbar nav a {
  color: #94a3b8;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  margin-left: 6px;
  font-size: 14px;
}
.topbar nav a.active { background: #0ea5e9; color: #fff; }
.topbar nav a:hover { color: #e2e8f0; }
.topbar .userbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .userbox .user-role {
  font-size: 13px;
  color: #94a3b8;
  padding: 3px 12px;
  border: 1px solid #334155;
  border-radius: 20px;
  background: #0f172a;
  white-space: nowrap;
}
.btn.sm { font-size: 12px; padding: 4px 12px; border-radius: 6px; }
.btn-param {
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  margin-right: 8px;
}
.btn-param:hover { background: #0284c7; }

/* 主容器 */
.container { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* 井选择行 */
.wellbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #1e293b;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.wellbar label { font-size: 14px; color: #94a3b8; }
.wellbar select {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 180px;
}
.wellbar .status {
  margin-left: auto;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #334155;
  color: #94a3b8;
}
.wellbar .status.online { background: #052e16; color: #4ade80; }
.wellbar .status.offline { background: #450a0a; color: #f87171; }

/* 实时数据卡片 - 名称在上,数值在下 */
.data-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.data-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  transition: border-color .2s;
  cursor: pointer;
}
.data-card:hover { border-color: #0ea5e9; }
.data-card .c-name {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
  line-height: 1.2;
}
.data-card .c-value {
  font-size: 18px;
  font-weight: bold;
  color: #f8fafc;
  line-height: 1.2;
}
.data-card .c-unit {
  font-size: 10px;
  color: #64748b;
}
.data-card .c-acc { color: #f59e0b; font-size: 10px; margin-right: 2px; }

/* 更新时间显示 */
.update-time {
  font-size: 12px;
  color: #64748b;
  margin-left: 12px;
}

/* 弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #334155;
}
.modal-header h3 { font-size: 15px; color: #e2e8f0; }
.modal-close {
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
}
.modal-close:hover { color: #f87171; }
.modal-body {
  padding: 12px 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}
.modal-body label {
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-body input[type="checkbox"] {
  accent-color: #0ea5e9;
  cursor: pointer;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #334155;
}

/* 曲线区域 */
.chart-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}
.chart-box h3 {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.chart-box h3 .tip { font-size: 12px; color: #475569; font-weight: normal; margin-left: auto; }
.chart { width: 100%; height: 360px; }
.time-range-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.time-range-row label { width: 70px; color: #94a3b8; font-size: 13px; }
.time-range-row input[type="datetime-local"] {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

/* 多图表容器 */
.chart-item {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.chart-item:last-child { margin-bottom: 0; }
.chart-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #16233c;
  border-bottom: 1px solid #1e293b;
  cursor: context-menu;
  user-select: none;
}
.chart-titlebar .ct-title { font-size: 13px; color: #38bdf8; font-weight: 600; }
.chart-titlebar .ct-tip { font-size: 11px; color: #475569; }
.chart-item .chart { width: 100%; height: 340px; }

/* 右键菜单 */
.ctx-menu {
  display: none;
  position: fixed;
  z-index: 300;
  min-width: 170px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ctx-menu.show { display: block; }
.ctx-item {
  padding: 9px 12px;
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
}
.ctx-item:hover { background: #0ea5e9; color: #fff; }
.ctx-item.danger:hover { background: #ef4444; color: #fff; }
.ctx-sep { height: 1px; background: #334155; margin: 5px 4px; }

/* 弹窗内颜色点 */
.dotc {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 2px;
  flex-shrink: 0;
}

/* Y轴范围设置行 */
.yrange-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed #243247;
}
.yrange-row:last-child { border-bottom: none; }
.yrange-name {
  flex: 1;
  font-size: 13px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  min-width: 0;
}
.yrange-name small { color: #64748b; margin-left: 3px; }
.yrange-row input[type="number"] {
  width: 90px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #e2e8f0;
  padding: 5px 8px;
  font-size: 13px;
}
.yrange-row input[type="number"]:focus { outline: none; border-color: #0ea5e9; }
.yrange-row input::placeholder { color: #475569; }
.yrange-color {
  width: 34px;
  height: 26px;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0f172a;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.yrange-color::-webkit-color-swatch-wrapper { padding: 0; }
.yrange-color::-webkit-color-swatch { border: none; border-radius: 3px; }
#yrangeModalBody { grid-template-columns: 1fr; }

/* 历史查询页 */
.querybar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: #1e293b;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.querybar .field { display: flex; flex-direction: column; gap: 4px; }
.querybar .field label { font-size: 12px; color: #94a3b8; }
.querybar input, .querybar select {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.querybar input[type="datetime-local"] { color-scheme: dark; }
.btn {
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 22px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: #0284c7; }
.btn.ghost { background: transparent; border: 1px solid #334155; color: #94a3b8; }

/* 历史表格 */
.table-wrap {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  display: none;
}
.table-wrap.show { display: block; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.data-table th, table.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #334155;
  text-align: right;
}
table.data-table th:first-child, table.data-table td:first-child { text-align: center; }
table.data-table th {
  background: #0f172a;
  color: #38bdf8;
  position: sticky;
  top: 0;
}
table.data-table tr:hover td { background: #243247; }

/* 页脚 */
.footer { text-align: center; color: #475569; font-size: 12px; padding: 20px; }

/* 加载提示 */
.loading { text-align: center; color: #64748b; padding: 40px; font-size: 14px; }

/* 空状态 */
.empty { text-align: center; color: #64748b; padding: 30px; font-size: 14px; }

/* 移动端适配 */
@media (max-width: 768px) {
  .data-cards { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .data-card .c-value { font-size: 15px; }
  .data-card .c-name { font-size: 10px; }
  .chart { height: 300px; }
  .chart-titlebar { justify-content: center; }
  .chart-titlebar .ct-tip { display: none; }
  .topbar .title { font-size: 15px; }
  .container { padding: 12px 10px; }
  .querybar { padding: 12px; }
  .querybar .field { flex: 1 1 100%; }
  .querybar .btn { flex: 1 1 100%; }
  .chart-box h3 { flex-wrap: wrap; gap: 6px; }
  .chart-box h3 .tip { width: 100%; margin-left: 0; order: 3; }
  .modal-body { grid-template-columns: 1fr; }
  .btn-param { font-size: 12px; padding: 5px 10px; }
  table.data-table { font-size: 12px; }
  table.data-table th, table.data-table td { padding: 6px 8px; }
  .yrange-row { flex-wrap: wrap; }
  .yrange-row input[type="number"] { flex: 1 1 40%; }
  .ctx-menu { z-index: 2000; }
}
