/* 基础样式 */
body {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  font-family: "Arial", sans-serif;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  overflow: auto;
}

/* 容器布局 */
.container-fluid {
  height: 100vh;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* 主视图区域 */
.split-view {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 面板通用样式 */
.left-panel,
.right-panel {
  overflow-y: auto;
  padding: 15px;
  height: 100%;
  box-sizing: border-box;
}

/* 左侧面板 */
.left-panel {
  flex: 0 0 70%;
  background-color: white;
  border-right: 1px solid #ddd;
  min-width: 300px;
}

/* 右侧面板 */
.right-panel {
  flex: 1;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

/* 内容区域 */
.panel-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 表格容器 */
.table-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 15px;
  height: calc(100% - 30px);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

/* 过滤区域 */
.filter-section {
  margin-bottom: 12px;
  padding: 12px;
  background-color: #e9ecef;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* 表格样式 */
table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  line-height: 1.2;
}

th {
  background-color: #343a40;
  color: white;
}

.slow-query-cell {
  background-color: #fff3cd;
  color: #856404;
  font-weight: bold;
}

.critical-query-cell {
  background-color: #dc3545;
  color: white;
  font-weight: bold;
}

/* 徽章组 */
.badge-group {
  display: flex;
  gap: 5px;
}

.badge {
  font-size: 0.9em;
  padding: 5px 10px;
}

/* 按钮组 */
.button-group {
  display: flex;
  gap: 5px;
  margin-left: auto;
}

/* 固定表头 */
.sticky-header {
  position: sticky;
  top: 0;
  background-color: #f8f9fa;
  z-index: 10;
}

/* 表格响应式容器 */
.table-responsive {
  overflow-y: auto;
  flex-grow: 1;
}
.table-responsive::-webkit-scrollbar {
  width: 8px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 浮动选择框 */
.floating-select-wrapper {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 280px;
  z-index: 9999;
}

#dynamicSelect {
  font-size: 0.825rem;
  padding: 0.25rem 1.5rem 0.25rem 0.5rem;
  border-radius: 4px;
  background-color: #f8f9fa;
  transition: all 0.2s ease;
}

#dynamicSelect:hover {
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

#dynamicSelect:focus {
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

optgroup {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6c757d;
}

option {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

.form-select-sm {
  height: calc(1.5em + 0.5rem + 2px);
}

/* 令牌模态框 */
#tokenModal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 350px;
  animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-title {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.5rem;
  text-align: center;
}

.token-input-container {
  position: relative;
  margin-bottom: 20px;
}

#tokenInput {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  -webkit-text-security: disc;
}

#tokenInput:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.error-message {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 5px;
  display: none;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-submit:hover {
  background-color: #357abd;
}

#mainContent {
  display: none;
  padding: 20px;
}

/* 工具提示 */
.monitor-title {
  position: relative;
  display: inline-block;
}

.monitor-title .tooltip {
  visibility: hidden;
  width: auto;
  min-width: 80px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 5px 10px;
  position: absolute;
  z-index: 1000;
  white-space: nowrap;
  top: 100%;
  left: 220%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.monitor-title .tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 10%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent #333 transparent;
}

.monitor-title:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* 错误报告 */
.error-report-button {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.2rem;
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
  cursor: pointer;
}

.error-report-button:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

/* 错误模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1200;
}

.modal-container {
  position: relative;
  z-index: 1201;
  width: 80%;
  max-height: 80vh;
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  overflow: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.modal-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #aaa;
}

.close-button:hover {
  color: #000;
}

.error-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.error-table th {
  background-color: #f5f5f5;
  padding: 12px 15px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid #ddd;
}

.error-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}

.error-table tr:hover {
  background-color: #f9f9f9;
}

.loading {
  text-align: center;
  padding: 20px;
  font-style: italic;
  color: #666;
}

/* 通用工具提示 */
[data-tooltip] {
  position: relative;
  cursor: pointer;
  z-index: auto;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: auto;
  transform: translateX(-50%);
  top: 100%;
  background: #6c757d;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: pre-wrap;
  min-width: auto;
  max-width: auto;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.05s ease;
  pointer-events: none;
  margin-top: 5px;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
  opacity: 1;
  transition-delay: 0s !important;
}

/* 二次重构 */

/* 通用工具提示 */
[data-tooltip-msg] {
  position: relative;
  cursor: pointer;
  z-index: auto;
}

[data-tooltip-msg]::after {
  content: attr(data-tooltip-msg);
  position: absolute;
  right: 100%; * 左侧显示 */
  bottom: 100%; /* 上方显示 */
  background: #6c757d;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: normal; * 允许正常换行 */
  word-wrap: break-word; /* 允许单词内换行 */
  width: 150px;/* 固定宽度，超出自动换行 */
  text-align: left; * 文字左对齐 */
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.05s ease;
  pointer-events: none;
  margin-right: 5px;
  margin-bottom: 5px;
  box-shadow: 0 2px 5px rgba(0,  0 ,  0, 0.2); /* 可选：添加阴影效果 */
}

[data-tooltip-msg]:hover::after,
[data-tooltip-msg]:focus::after {
  opacity: 1;
  transition-delay: 0s !important;
}
/* end */

/* 饼图容器 */
#pie-modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.pie-container {
  width: 100%;
  height: 100%;
  padding: 20px;
}

#pieChartContainer {
  width: 100%;
  height: 100%;
  min-height: 900px;
}

/* 仪表盘 */
.gauges-background {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 15px;
  z-index: 100;
  opacity: 0.9;
}

.gauge {
  width: 120px;
  height: 120px;
  position: relative;
  border-radius: 50%;
  background: rgba(22, 33, 62, 0.9);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), 0 0 0 rgba(76, 175, 80, 0.6);
  padding: 10px;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1.5), box-shadow 0.3s ease, opacity 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  overflow: hidden;
}

.gauge:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7), 0 0 20px 5px rgba(76, 175, 80, 0.4);
  opacity: 1;
  z-index: 101;
}

.gauge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
  transition: all 0.8s ease;
}

.gauge:hover::after {
  width: 200px;
  height: 200px;
  opacity: 0.3;
  transform: scale(1, 1) translate(-50%, -50%);
}

.gauge-cpu:hover {
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7), 0 0 20px 5px rgba(76, 175, 80, 0.6);
}

.gauge-memory:hover {
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7), 0 0 20px 5px rgba(33, 150, 243, 0.6);
}

.gauge-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.5s ease;
}

.gauge:hover .gauge-inner {
  transform: scale(0.95);
}

.gauge-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: rotate(-90deg);
  transition: all 1s ease, background 0.5s ease;
}

.gauge-center {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: rgba(26, 26, 46, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  transition: all 0.5s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 0 0 rgba(255, 255, 255, 0.3);
}

.gauge:hover .gauge-center {
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 255, 255, 0.5);
  background: rgba(26, 26, 46, 0.95);
}

.gauge-value {
  font-size: 1.4rem;
  font-weight: bold;
  color: white;
  transition: all 0.3s ease;
  text-shadow: 0 0 0 rgba(255, 255, 255, 0.5);
}

.gauge:hover .gauge-value {
  transform: scale(1.1);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.gauge-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.gauge:hover .gauge-label {
  color: white;
  letter-spacing: 1.5px;
}

/* 仪表盘入场动画 */
@keyframes gaugeEntrance {
  0% {
    transform: translateY(50px) rotate(15deg);
    opacity: 0;
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 0.9;
  }
}

.gauge {
  animation: gaugeEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gauge-memory {
  animation-delay: 0.15s;
}

/* 响应式设计 */
@media (max-width: 992px) {
  .split-view {
    flex-direction: column;
  }

  .left-panel {
    flex: 0 0 60%;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .right-panel {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .left-panel {
    flex: 0 0 50%;
  }

  .floating-select-wrapper {
    width: 200px;
    top: 10px;
    right: 10px;
  }

  .gauges-background {
    bottom: 10px;
    right: 10px;
    flex-direction: column;
  }

  .gauge {
    width: 80px;
    height: 80px;
  }

  .gauge-value {
    font-size: 1rem;
  }

  .modal-container {
    width: 95%;
  }

  .error-table {
    display: block;
    overflow-x: auto;
  }
}
