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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

h1 {
  color: #2c3e50;
  font-size: 24px;
}

.connect-btn {
  padding: 10px 20px;
  font-size: 16px;
  color: #fff;
  background-color: #3498db;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connect-btn i {
  font-size: 16px;
}

.connect-btn:hover {
  background-color: #2980b9;
}

.connect-btn:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  opacity: 0.7;
}

.connect-btn.connected {
  background-color: #e74c3c;
}

.connect-btn.connected:hover {
  background-color: #c0392b;
}

.connect-btn.connected i {
  transform: rotate(180deg);
}

.connect-btn.disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  opacity: 0.7;
}

.connect-btn.disabled:hover {
  background-color: #bdc3c7;
}

.data-grid {
  display: block;
  margin-bottom: 30px;
}

.data-block {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
}

.data-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.data-icon {
  width: 50px;
  height: 50px;
  background-color: #f8f9fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
}

.data-icon i {
  font-size: 24px;
  color: #3498db;
}

.data-content {
  flex: 1;
}

.data-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}

.data-value {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
}

.log-container {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.log-header span {
  font-weight: 600;
  color: #495057;
}

.timestamp {
  font-size: 0.9em;
  color: #6c757d;
}

.output {
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  background-color: #fff;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .data-block {
    padding: 15px;
  }

  .data-icon {
    width: 40px;
    height: 40px;
  }

  .data-icon i {
    font-size: 20px;
  }

  .data-value {
    font-size: 18px;
  }
}

.toggle-logs {
  margin: 1rem 0;
  text-align: center;
}

.toggle-btn {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background-color: #e5e7eb;
}

.logs-container {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-top: 1rem;
}

.log-container {
  flex: 1;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  min-width: 0;
}

.log-header {
  background-color: #f3f4f6;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log {
  padding: 1rem;
  font-family: monospace;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  background-color: #ffffff;
}

.timestamp {
  color: #6b7280;
  font-size: 0.875rem;
}

/* 右下角悬浮按钮容器 */
.isp-btn-group {
  position: fixed;
  right: 32px;
  bottom: 32px;
  display: flex;
  flex-direction: row;
  gap: 0;
  z-index: 9999;
}

.isp-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #3498db;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.isp-btn:hover {
  background: #217dbb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.isp-btn.disabled,
.isp-btn:disabled {
  background: #bdc3c7;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

.secondary-btn {
  border: 1.5px solid #3498db;
  background: transparent;
  color: #3498db;
  padding: 10px 20px;
  border-radius: 0.375em;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.secondary-btn i {
  color: #3498db;
}
.secondary-btn:enabled:hover {
  background: #e0f2ff;
  color: #217dbb;
  border-color: #217dbb;
}
.secondary-btn:enabled:hover i {
  color: #217dbb;
}
.secondary-btn:disabled {
  color: #bdc3c7;
  border-color: #bdc3c7;
  cursor: not-allowed;
  background: #fafafa;
}
.secondary-btn:disabled i {
  color: #bdc3c7;
}

.get-btn-green {
  background-color: #22c55e !important;
  color: #fff !important;
  border: none !important;
}
.get-btn-green:hover:enabled {
  background-color: #16a34a !important;
}
.get-btn-yellow {
  background-color: #facc15 !important;
  color: #fff !important;
  border: none !important;
}
.get-btn-yellow:hover:enabled {
  background-color: #eab308 !important;
}

.get-btn-green:disabled,
.get-btn-yellow:disabled {
  background-color: #bdc3c7 !important;
  color: #fff !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
  border: none !important;
}

/* DataTables表格样式 */
.data-grid {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  border: 1px solid #dee2e6;
  overflow: hidden;
  padding: 20px;
}

/* 自定义DataTables样式 */
#dataTable {
  width: 100% !important;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* 修复表头和内容对齐问题 */
.dataTables_wrapper .dataTables_scroll {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
}

/* 表头容器样式 */
.dataTables_wrapper .dataTables_scrollHead {
  overflow: visible !important;
  position: relative;
}

/* 表头内部容器样式 */
.dataTables_wrapper .dataTables_scrollHeadInner {
  width: 100% !important;
  overflow: visible !important;
}

/* 表头样式 */
#dataTable thead th,
.dataTables_wrapper .dataTables_scrollHead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  color: #495057;
  font-weight: 600;
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
  position: relative;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 100px;
  max-width: none !important;
  word-wrap: normal !important;
  word-break: keep-all !important;
  line-height: 1.2 !important;
  height: auto !important;
  box-sizing: border-box !important;
}

/* UID列表头特殊样式 - 允许自动调整宽度 */
#dataTable thead th:first-child,
.dataTables_wrapper .dataTables_scrollHead th:first-child {
  overflow: visible !important;
  text-overflow: clip !important;
  min-width: 250px;
  max-width: none !important;
  white-space: nowrap !important;
  word-wrap: normal !important;
  word-break: keep-all !important;
}

/* 确保表头内容不换行 */
.dataTables_wrapper .dataTables_scrollHead th span,
.dataTables_wrapper .dataTables_scrollHead th div,
.dataTables_wrapper .dataTables_scrollHeadInner th span,
.dataTables_wrapper .dataTables_scrollHeadInner th div {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-wrap: normal !important;
  word-break: keep-all !important;
  display: inline-block !important;
  width: 100% !important;
  line-height: 1.2 !important;
}

#dataTable thead th:last-child,
.dataTables_wrapper .dataTables_scrollHead th:last-child {
  border-right: none;
}

#dataTable thead th i,
.dataTables_wrapper .dataTables_scrollHead th i {
  color: #6c757d;
  font-size: 12px;
  margin-right: 6px;
}

/* 表格内容样式 */
#dataTable tbody td {
  border-bottom: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
  color: #333;
  word-break: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 44px;
  box-sizing: border-box;
  min-width: 100px;
}

/* UID列特殊样式 - 允许自动调整宽度 */
#dataTable tbody td:first-child {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: 250px;
  max-width: none;
}

#dataTable tbody td:last-child {
  border-right: none;
}

#dataTable tbody tr:hover {
  background-color: #f8f9fa;
}

/* 响应状态背景颜色样式 */
.dataTables_wrapper #dataTable tbody tr.has-response {
  background-color: #f0fdf4 !important; /* 淡绿色背景 - 在线 */
}

.dataTables_wrapper #dataTable tbody tr.no-response {
  background-color: #fef2f2 !important; /* 淡红色背景 - 离线 */
}

.dataTables_wrapper #dataTable tbody tr.has-response:hover {
  background-color: #dcfce7 !important; /* 在线时的悬停颜色 */
}

.dataTables_wrapper #dataTable tbody tr.no-response:hover {
  background-color: #fee2e2 !important; /* 离线时的悬停颜色 */
}

/* 内联样式的悬停效果 */
.dataTables_wrapper
  #dataTable
  tbody
  tr[style*="background-color: #f0fdf4"]:hover {
  background-color: #dcfce7 !important;
}

.dataTables_wrapper
  #dataTable
  tbody
  tr[style*="background-color: #fef2f2"]:hover {
  background-color: #fee2e2 !important;
}

/* 默认状态保持表格默认样式 */

/* 隐藏DataTables默认的分页和搜索控件 */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  display: none !important;
}

/* 确保横向滚动容器正常工作 */
.dataTables_wrapper .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  min-width: 1200px;
}

/* 隐藏表头容器的滚动条，只保留内容区域的滚动条 */
.dataTables_wrapper .dataTables_scrollHead {
  overflow: hidden !important;
  position: relative !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner {
  overflow: hidden !important;
  width: 100% !important;
}

/* 确保表头容器不会出现滚动条 */
.dataTables_wrapper .dataTables_scrollHead::-webkit-scrollbar {
  display: none !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner::-webkit-scrollbar {
  display: none !important;
}

/* 修复滚动条样式 */
.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 确保表头和内容列宽一致 */
.dataTables_wrapper .dataTables_scrollHead table,
.dataTables_wrapper .dataTables_scrollBody table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* 确保表头容器和内容容器宽度完全一致 */
.dataTables_wrapper .dataTables_scrollHead,
.dataTables_wrapper .dataTables_scrollBody {
  width: 100% !important;
  overflow-x: auto !important;
}

/* 修复可能的滚动条导致的宽度差异 */
.dataTables_wrapper .dataTables_scrollHeadInner {
  width: 100% !important;
  overflow: visible !important;
}

/* 确保表格单元格边框对齐 */
.dataTables_wrapper .dataTables_scrollHead th,
.dataTables_wrapper .dataTables_scrollBody td {
  box-sizing: border-box !important;
  border-right: 1px solid #dee2e6 !important;
}

.dataTables_wrapper .dataTables_scrollHead th:last-child,
.dataTables_wrapper .dataTables_scrollBody td:last-child {
  border-right: none !important;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  #dataTable thead th,
  #dataTable tbody td,
  .dataTables_wrapper .dataTables_scrollHead th {
    font-size: 12px;
    padding: 8px 4px;
    min-width: 80px;
  }

  .dataTables_wrapper .dataTables_scrollBody {
    min-width: 1000px;
  }
}

@media (max-width: 768px) {
  #dataTable thead th,
  #dataTable tbody td,
  .dataTables_wrapper .dataTables_scrollHead th {
    font-size: 11px;
    padding: 6px 2px;
    min-width: 70px;
  }

  .dataTables_wrapper .dataTables_scrollBody {
    min-width: 900px;
  }
}

/* 选中行样式 */
.dataTables_wrapper #dataTable tbody tr.selected-row {
  background-color: #e3f2fd !important; /* 淡蓝色背景 */
  border: 2px solid #007bff !important; /* 蓝色边框 */
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3) !important; /* 蓝色阴影 */
}

.dataTables_wrapper #dataTable tbody tr.selected-row:hover {
  background-color: #bbdefb !important; /* 选中时的悬停颜色 */
}

/* 选中行与在线/离线状态结合 */
.dataTables_wrapper
  #dataTable
  tbody
  tr.selected-row[style*="background-color: #f0fdf4"] {
  background-color: #d1fae5 !important; /* 在线+选中状态 */
}

.dataTables_wrapper
  #dataTable
  tbody
  tr.selected-row[style*="background-color: #fef2f2"] {
  background-color: #fecaca !important; /* 离线+选中状态 */
}

/* 确保选中行的边框在所有状态下都可见 */
.dataTables_wrapper #dataTable tbody tr.selected-row td {
  border-color: #007bff !important;
}

/* 选中行的文字颜色 */
.dataTables_wrapper #dataTable tbody tr.selected-row td {
  color: #0056b3 !important;
  font-weight: 500;
}
