/* 设备检测页面 - 浅色主题 */
:root {
  --bg: #f5f3ef;
  --bg-card: #ffffff;
  --bg-card-soft: #faf8f5;
  --gold: #b8860b;
  --gold-light: #d4a843;
  --gold-pale: rgba(184, 134, 11, 0.12);
  --purple: #7e6bc8;
  --text: #2c2c2c;
  --text-dim: #666666;
  --text-muted: #999999;
  --border: rgba(184, 134, 11, 0.25);
  --border-light: #e8e4dd;
  --danger: #c0392b;
  --success: #27ae60;
  --warning: #e67e22;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

.bg-layer {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #f5f3ef 0%, #ede8e0 50%, #f5f3ef 100%);
  z-index: -2;
}
.bg-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ctext x='10' y='60' font-size='40' fill='%23b8860b' opacity='0.03'%3E%E2%99%AA%3C/text%3E%3C/svg%3E");
  z-index: -1;
}

/* 顶部栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 28px; background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px); border-bottom: 2px solid var(--gold);
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 40px; width: auto; }
.topbar-title { font-family: 'Noto Serif SC', serif; font-size: 16px; font-weight: 700; color: var(--gold); }
.topbar-sub { font-size: 12px; color: var(--text-dim); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

/* 按钮 */
.btn {
  padding: 8px 18px; border: none; border-radius: 8px; cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif; font-size: 14px; font-weight: 500;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: #9a7309; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); background: var(--gold-pale); }
.btn-danger { background: var(--danger); color: #fff; }

/* 主内容 */
.diag-main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

.diag-header { text-align: center; margin-bottom: 36px; }
.diag-h1 {
  font-family: 'Noto Serif SC', serif; font-size: 28px; color: var(--gold);
  margin-bottom: 8px;
}
.diag-desc { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }

/* 测试卡片网格 */
.test-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.test-card {
  background: var(--bg-card); border-radius: 12px; padding: 20px;
  box-shadow: var(--shadow); transition: box-shadow 0.3s;
  border: 1px solid var(--border-light);
}
.test-card:hover { box-shadow: var(--shadow-hover); }

.card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.card-icon { font-size: 24px; }
.card-title {
  font-family: 'Noto Serif SC', serif; font-size: 16px; font-weight: 600;
  color: var(--text); flex: 1;
}
.card-status {
  font-size: 12px; padding: 4px 12px; border-radius: 12px; font-weight: 500;
  white-space: nowrap;
}
.card-status.pending { background: #f0f0f0; color: var(--text-muted); }
.card-status.running { background: rgba(230,126,34,0.12); color: var(--warning); }
.card-status.pass { background: rgba(39,174,96,0.12); color: var(--success); }
.card-status.fail { background: rgba(192,57,43,0.12); color: var(--danger); }

.card-body { display: flex; flex-direction: column; gap: 12px; }
.test-detail { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

/* 延迟图表 */
.latency-chart {
  display: flex; align-items: flex-end; gap: 3px; height: 60px;
  padding: 8px 0;
}
.latency-bar {
  flex: 1; min-width: 4px; border-radius: 3px 3px 0 0;
  transition: height 0.3s;
}

/* 网速显示 */
.speed-display { display: flex; gap: 24px; justify-content: center; padding: 12px 0; }
.speed-item { text-align: center; }
.speed-label { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.speed-value { font-size: 28px; font-weight: 700; color: var(--gold); }
.speed-unit { font-size: 12px; color: var(--text-muted); }
.speed-progress { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.speed-bar { height: 100%; background: var(--gold); width: 0%; transition: width 0.3s; }

/* 麦克风电平 */
.mic-level-container { display: flex; align-items: center; gap: 10px; }
.mic-label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.mic-level-bar {
  flex: 1; height: 20px; background: var(--border-light);
  border-radius: 10px; overflow: hidden; position: relative;
}
.mic-level-fill {
  height: 100%; width: 0%; border-radius: 10px;
  background: linear-gradient(90deg, var(--success) 0%, var(--success) 60%, var(--warning) 80%, var(--danger) 100%);
  transition: width 0.1s;
}
.mic-level-num { font-size: 13px; color: var(--text); font-weight: 500; min-width: 40px; text-align: right; }
.mic-info, .cam-info {
  font-size: 12px; color: var(--text-dim); line-height: 1.8;
  background: var(--bg-card-soft); padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border-light);
}
.mic-info .info-line, .cam-info .info-line { display: flex; justify-content: space-between; }

/* 摄像头预览 */
.cam-preview { border-radius: 8px; overflow: hidden; background: #000; }
.cam-preview video { width: 100%; display: block; }

/* WebRTC结果 */
.webrtc-results { font-size: 13px; line-height: 1.8; }
.webrtc-result-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border-light);
}
.webrtc-result-item:last-child { border-bottom: none; }
.webrtc-result-icon { font-size: 16px; }
.webrtc-result-label { flex: 1; color: var(--text-dim); }
.webrtc-result-value { font-weight: 500; }

/* 汇总 */
.diag-summary {
  margin-top: 36px; background: var(--bg-card); border-radius: 12px;
  padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border-light);
}
.summary-title {
  font-family: 'Noto Serif SC', serif; font-size: 20px; color: var(--gold);
  margin-bottom: 20px; text-align: center;
}
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.summary-item {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; border-radius: 8px; background: var(--bg-card-soft);
  border: 1px solid var(--border-light);
}
.summary-item .si-icon { font-size: 20px; }
.summary-item .si-label { font-size: 13px; color: var(--text-dim); }
.summary-item .si-value { font-size: 14px; font-weight: 600; }
.summary-advice {
  padding: 16px; border-radius: 8px; font-size: 14px; line-height: 1.8;
  background: var(--gold-pale); border: 1px solid var(--border);
  color: var(--text);
}

/* 通知 */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  padding: 12px 28px; border-radius: 8px; font-size: 14px; z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

/* 响应式 */
@media (max-width: 600px) {
  .test-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 14px; }
  .diag-h1 { font-size: 22px; }
}
