/* css/components.css — 通用组件：面板、按钮、表单控件、表格、分页、状态徽标 */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(6px);
  position: relative;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(24, 180, 190, 0.2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* 按钮 */
.btn-tech {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--cyan);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-tech:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: var(--border-bright);
}

.btn-tech.primary {
  background: rgba(34, 211, 238, 0.2);
  border-color: var(--border-bright);
}

.btn-tech.btn-red {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.btn-tech.btn-red:hover { background: rgba(239, 68, 68, 0.18); }

.btn-tech.small { padding: 4px 10px; font-size: 12px; }

/* 时间范围按钮 / tab */
.range-btns button, .tab-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(24, 180, 190, 0.25);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.range-btns button:hover, .tab-btn:hover { color: var(--cyan); border-color: var(--border-bright); }

.range-btns button.active, .tab-btn.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: var(--border-bright);
}

/* 表单控件 */
.select-box, .date-picker {
  padding: 7px 10px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(24, 180, 190, 0.3);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.select-box:focus, .date-picker:focus { border-color: var(--border-bright); }
.select-box.small { padding: 4px 8px; font-size: 12px; }
.date-picker { color-scheme: dark; }

/* 开关 */
.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch-wrap input { display: none; }

.switch {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(127, 179, 199, 0.3);
  position: relative;
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.2s;
}

.switch-wrap input:checked + .switch { background: rgba(34, 211, 238, 0.5); }
.switch-wrap input:checked + .switch::after { transform: translateX(16px); background: var(--cyan); }

/* 图例 */
.chart-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid rgba(24, 180, 190, 0.25);
  border-radius: 12px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.legend-item.off { opacity: 0.35; }

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* 状态徽标 */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  border: 1px solid;
  white-space: nowrap;
}

.status-normal   { color: #34d399; border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.12); }
.status-warning  { color: #fbbf24; border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.12); }
.status-critical { color: #f87171; border-color: rgba(239, 68, 68, 0.5);  background: rgba(239, 68, 68, 0.12); }
.status-offline  { color: #94a3b8; border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.1); }
.status-none     { color: #94a3b8; border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.1); }

.status-text-normal   { color: #34d399; }
.status-text-warning  { color: #fbbf24; }
.status-text-critical { color: #f87171; }

/* 数据表格 */
.table-wrap {
  overflow-x: auto;
  padding: 0 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.data-table th, .data-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(24, 180, 190, 0.12);
  white-space: nowrap;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  user-select: none;
}

.data-table th[data-sort] { cursor: pointer; }
.data-table th[data-sort]:hover { color: var(--cyan); }
.data-table th.sort-asc::after  { content: ' ▲'; font-size: 9px; color: var(--cyan); }
.data-table th.sort-desc::after { content: ' ▼'; font-size: 9px; color: var(--cyan); }

.data-table tbody tr:hover { background: rgba(34, 211, 238, 0.05); }

.data-table .desc-cell {
  white-space: normal;
  min-width: 180px;
  color: var(--text-secondary);
  font-size: 12px;
}

.table-empty {
  text-align: center !important;
  color: var(--text-secondary);
  padding: 32px 0 !important;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 30px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(24, 180, 190, 0.25);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { color: var(--cyan); border-color: var(--border-bright); }
.page-btn.active { color: var(--cyan); background: var(--cyan-dim); border-color: var(--border-bright); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-ellipsis { color: var(--text-secondary); }
.page-total { margin-left: auto; font-size: 12px; color: var(--text-secondary); }

/* 面板状态覆盖层（empty / error / loading 文案） */
.panel-state {
  position: absolute;
  inset: 44px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(2, 6, 23, 0.55);
  z-index: 5;
  border-radius: 0 0 8px 8px;
  pointer-events: none;
}

.panel-state.error { color: #fca5a5; }
.panel-state.loading { color: var(--cyan); }

/* ---------- 原版组件：横幅标题 / 设备统计 / 搜索 / 导出 ---------- */

/* 斜角发光横幅（面板标题） */
.banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 2px 0;
  padding: 7px 34px 7px 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.4), rgba(34, 211, 238, 0.12) 60%, transparent);
  clip-path: polygon(0 0, 100% 0, calc(100% - 24px) 100%, 0 100%);
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.35));
}

.pond-banner { margin-top: 4px; }

.banner-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid var(--cyan);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  filter: drop-shadow(0 0 4px var(--cyan));
}

/* 面板头部内的小横幅文字 */
.banner-inline {
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  padding-left: 10px;
  border-left: 3px solid var(--cyan);
}

/* 顶栏设备统计项（圆形发光图标） */
.equip-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.equip-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-bright);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.35), inset 0 0 10px rgba(34, 211, 238, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--cyan);
}

.equip-icon svg {
  width: 17px;
  height: 17px;
}

.equip-text { display: flex; flex-direction: column; gap: 2px; }

.equip-label { font-size: 12px; color: var(--text); white-space: nowrap; }

.equip-value {
  font-family: 'JetBrains Mono', monospace;
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  line-height: 1;
}

/* 平台标题（流光渐变 + 装饰线） */
.board-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.title-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 5px;
  margin-right: -5px; /* 抵消末字间距，视觉居中 */
  background: linear-gradient(90deg, #22d3ee 0%, #7dd3fc 25%, #818cf8 50%, #22d3ee 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-flow 6s linear infinite;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.45));
  white-space: nowrap;
}

.title-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 4px;
  margin-right: -4px;
  color: rgba(127, 179, 199, 0.65);
  white-space: nowrap;
}

@keyframes title-flow {
  to { background-position: 200% 0; }
}

.title-deco {
  position: relative;
  width: 32px;
  height: 2px;
  flex: 0 0 auto;
}

.title-deco.left  { background: linear-gradient(90deg, transparent, var(--cyan)); }
.title-deco.right { background: linear-gradient(90deg, var(--cyan), transparent); }

.title-deco::before, .title-deco::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.title-deco::before { width: 7px; height: 7px; }
.title-deco::after { width: 4px; height: 4px; opacity: 0.7; }

.title-deco.left::before  { right: 0; }
.title-deco.left::after   { right: 14px; }
.title-deco.right::before { left: 0; }
.title-deco.right::after  { left: 14px; }

/* 导出按钮 */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  color: var(--cyan);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.export-btn:hover { background: rgba(34, 211, 238, 0.24); }

/* 图表面板内联指标行（溶氧：xx 样式） */
.inline-metrics {
  display: flex;
  gap: 34px;
  flex-wrap: wrap;
}

.metric-item { display: flex; align-items: baseline; gap: 2px; font-size: 14px; }

.metric-item label { font-weight: 500; }

.metric-item value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* 在线状态 */
.online-status { font-size: 13px; }
.online-status.online { color: #34d399; }
.online-status.offline { color: #f87171; }

/* 事件查看 */
.event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-right: 14px;
  flex-wrap: wrap;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(24, 180, 190, 0.2);
  border-left-width: 3px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.35);
}

.event-msg { font-size: 13px; line-height: 1.5; }

.event-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

.event-level {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  border: 1px solid;
}

.event-level.normal   { color: #34d399; border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.12); }
.event-level.warning  { color: #fbbf24; border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.12); }
.event-level.critical { color: #f87171; border-color: rgba(239, 68, 68, 0.5);  background: rgba(239, 68, 68, 0.12); }

/* 空状态（原版插画） */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-illustration { width: 130px; height: auto; opacity: 0.9; }

@media (max-width: 768px) {
  .equip-icon { width: 38px; height: 38px; }
  .equip-value { font-size: 16px; }
  .inline-metrics { gap: 18px; }
  .title-text { font-size: 18px; letter-spacing: 4px; margin-right: -4px; }
  .title-sub { font-size: 7px; letter-spacing: 2px; margin-right: -2px; }
  .title-deco { width: 36px; }
  .board-title { gap: 12px; }
}

@media (max-width: 480px) {
  .title-text { font-size: 15px; letter-spacing: 2px; margin-right: -2px; }
  .title-sub { font-size: 6px; letter-spacing: 1px; margin-right: -1px; white-space: normal; text-align: center; }
}

/* ---------- 科技感装饰 ---------- */

/* 面板四角亮边 */
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--border-bright);
  border-style: solid;
  pointer-events: none;
  z-index: 2;
}

.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

/* 顶栏底部扫描光带 */
.topbar { position: relative; overflow: hidden; }

.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: -30%;
  height: 2px;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scanline 7s linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% { left: -30%; }
  100% { left: 100%; }
}

/* 图标按钮（齿轮设置等） */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--cyan);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: var(--border-bright);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}

.icon-btn svg { transition: transform 0.4s ease; }
.icon-btn:hover svg { transform: rotate(90deg); }

/* 在线状态脉冲点 */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 5px;
  vertical-align: 1px;
  animation: pulse 1.6s ease-in-out infinite;
}

/* 事件列表内部滚动（限高，保持左右栏高度接近） */
.event-content {
  overflow-y: auto;
  min-height: 0;
  max-height: 330px;
}

.event-content::-webkit-scrollbar { width: 8px; }
.event-content::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, 0.2); border-radius: 4px; }

@media (max-width: 1750px) {
  .title-deco { display: none; }
  .board-title { gap: 0; }
}
