/**
 * FITP 方便菜肴标签追溯平台 - 运行总览专属样式
 * 版本: 20260904-modern-ui-v3
 * 100% 完美复现效果图中的核心卡片、自适应双栏、平滑面积图与现代化数据表格
 */

/* 整体总览容器 */
.modern-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   1. 四大核心 KPI 卡片网格（与效果图完全一致）
   ========================================================================== */
.kpi-banner-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.kpi-card {
  position: relative;
  background: #ffffff;
  border-radius: 18px;
  padding: 24px 26px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 136px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.09);
}

/* 4 种微光渐变背景（与效果图 100% 呼应） */
.kpi-card.card-blue {
  background: linear-gradient(135deg, #ffffff 40%, #eff6ff 100%);
}

.kpi-card.card-emerald {
  background: linear-gradient(135deg, #ffffff 40%, #ecfdf5 100%);
}

.kpi-card.card-teal {
  background: linear-gradient(135deg, #ffffff 40%, #f0fdfa 100%);
}

.kpi-card.card-purple {
  background: linear-gradient(135deg, #ffffff 40%, #faf5ff 100%);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.kpi-unit-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  margin-top: 14px;
}

.kpi-big-number {
  font-size: 38px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. 中间双栏监控与趋势（完全还原效果图）
   ========================================================================== */
.dual-monitor-grid {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  gap: 20px;
}

.card-panel {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-title-group h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

/* 现场监控抓拍容器 */
.monitor-stage-container {
  width: 100%;
  aspect-ratio: 16 / 9.5;
  background-color: #091319;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.stage-frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-frame img {
  max-width: 90%;
  max-height: 88%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* AI 识别悬浮徽章 */
.ai-box-badge {
  position: absolute;
  top: 22px;
  left: 36%;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

/* 平滑趋势波浪图容器 */
.chart-stage-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.modern-svg-chart {
  width: 100%;
  height: 250px;
  overflow: visible;
}

/* ==========================================================================
   3. 底部现代化数据表格（完全还原效果图）
   ========================================================================== */
.table-card {
  padding: 20px 24px 28px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  font-size: 14px;
}

.modern-table thead th {
  padding: 12px 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: transparent;
  white-space: nowrap;
}

.modern-table tbody tr {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
  background: #f8fafc;
  transform: scale(1.002);
}

.modern-table tbody td {
  padding: 16px 18px;
  color: var(--text-main);
  font-weight: 500;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  vertical-align: middle;
}

.modern-table tbody td:first-child {
  border-left: 1px solid #f1f5f9;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  font-weight: 600;
  color: #334155;
}

.modern-table tbody td:last-child {
  border-right: 1px solid #f1f5f9;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* 状态胶囊徽章 */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.pass {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.status-pill.ng {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

/* 操作按键组 */
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-detail {
  padding: 6px 14px;
  background: #ffffff;
  color: #0284c7;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-detail:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

.btn-review {
  padding: 6px 14px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-review:hover {
  background: #0369a1;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

@media (max-width: 1280px) {
  .kpi-banner-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dual-monitor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-banner-grid {
    grid-template-columns: 1fr;
  }
}

/* 设备微型状态指示胶囊栏 */
.device-status-capsules {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.device-chip.online {
  border-color: #a7f3d0;
  background: #f0fdf4;
  color: #166534;
}

.device-chip.offline {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

/* 监控大图左右分栏 */
.monitor-dual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(200px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.monitor-side-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
}

.side-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
}

.side-detail-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.side-lbl {
  color: var(--text-muted);
  font-weight: 600;
}

.side-val {
  color: var(--text-main);
  font-weight: 700;
}

.side-val.bold {
  font-size: 15px;
  color: #0f172a;
}

.side-val.danger {
  color: #e11d48;
}

.side-val.font-mono {
  font-family: ui-monospace, SFMono-Regular, monospace;
}
