/* ============================================================
   charts.css — 1:1 from original LiveScatter3D/wwwroot/index.html
   ============================================================ */

/* ── Overview top row ── */
#overview-top {
  display: flex; flex: 0 0 auto;
  height: 330px;
  gap: 6px; padding: 6px 6px 3px;
}
#main-chart-wrap {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
#main-chart-header {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 3px; flex-shrink: 0;
}
.main-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #4e5a66; }
#main-chart { flex: 1; min-height: 0; height: 100%; width: 100%; }

/* ── Overview sidebar ── */
#ov-sidebar { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: hidden; }
#ov-card { flex-shrink: 0; padding: 7px 10px; }
#ov-card .ov-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
#ov-card .ov-hdr span { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #4e5a66; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ov-cell { display: flex; flex-direction: column; gap: 1px; }
.ov-lbl  { font-size: 10px; color: #6f7883; text-transform: uppercase; letter-spacing: .06em; }
.ov-val  { font-size: 17px; font-weight: 700; color: #1a1a1a; line-height: 1.1; }
.ov-peak { font-size: 10px; color: #6f7883; }

#pins-card { flex: 1; min-height: 0; padding: 6px 10px; overflow: hidden; }
#pins-card .ov-hdr { margin-bottom: 4px; }
#pins-footnote { font-size: 9px; color: #8f98a3; margin-top: 3px; line-height: 1.3; }

/* ── Overview bottom row ── */
#ov-summary-bottom { margin: 0 6px 6px 6px; display: flex; gap: 6px; flex: 1; min-height: 0; overflow: hidden; }

#diag-summary-card {
  width: 200px; box-sizing: border-box; flex: 0 0 200px;
  min-height: 0; height: 100%; padding: 6px 10px; overflow: hidden;
}
#ov-safety-card {
  flex: 1; min-height: 0; height: 100%;
  padding: 4px 0 4px; overflow: hidden;
  display: flex; flex-direction: column;
}
#ov-safety-chart { width: 100%; flex: 1; height: 100%; min-height: 0; }

/* ── Pin grid (overview + pins tab) ── */
#pin-grid {
  display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(2,1fr);
  gap: 6px; padding: 6px; flex: 1; min-height: 0;
}
#pin-grid-full {
  display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(2,1fr);
  gap: 6px; padding: 8px; flex: 1; min-height: 0;
}

/* ── Diagnostics ── */
.diag-shell {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-rows: repeat(3,minmax(0,1fr));
  gap: 8px; padding: 8px; flex: 1; min-height: 0; overflow: hidden;
}
.diag-panel { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.diag-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 5px; border-bottom: 1px solid #f0f0f0; }
.diag-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #555; }
.diag-sub   { font-size: 10px; color: #888; }
.diag-chart { flex: 1; min-height: 0; width: 100%; }
.diag-kpi   { display: flex; align-items: center; gap: 6px; }
.diag-kpi-val { font-size: 11px; font-weight: 700; color: #1a1a1a; }

/* ── Diagnostics new layout ── */
.diag-grid-new {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  grid-template-rows: repeat(3,minmax(0,1fr));
  grid-template-areas: "info tests" "info tests" "info tests";
  gap: 8px; padding: 8px; flex: 1; min-height: 0;
}
.diag-info-panel, .diag-fault-panel, .diag-trigger-panel, .diag-display-panel, .diag-raw-panel {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
}
.diag-info-panel, .diag-trigger-panel, .diag-raw-panel { background: linear-gradient(180deg,#fff 0%,#fcfcfc 100%); }
.diag-zone-info { grid-area: info; }
.diag-zone-tests { grid-area: tests; }
.diag-info-body, .diag-fault-body, .diag-trigger-body, .diag-display-body, .diag-raw-body { padding: 10px; min-height: 0; overflow: hidden; }
.diag-zone-info .diag-info-body { display: flex; flex-direction: column; }
.diag-block-title { font-size: 10px; color: #6f7883; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.diag-info-refresh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.diag-info-split { display: flex; flex-direction: column; gap: 10px; height: 100%; flex: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 14px; height: 14px; border: 2px solid #e0e0e0; border-top-color: #0078d4; border-radius: 50%; animation: spin .6s linear infinite; display: none; }
.loading .spinner { display: block; }

/* ── Load/Thermal ── */
.rel-shell { display: flex; flex: 1; min-height: 0; gap: 8px; padding: 8px; background: #f0f0f0; }
.rel-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.rel-panel { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rel-panel.equal { flex: 1; }
.rel-panel-header { display: flex; align-items: center; gap: 10px; padding: 5px 12px 4px; flex-shrink: 0; border-bottom: 1px solid #f0f0f0; }
.rel-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #555; }
.rel-sub   { font-size: 10px; color: #aaa; }
.rel-scale-label { font-size: 10px; color: #888; font-weight: 600; }
.rel-grow  { flex: 1; min-height: 0; }
.rel-heatmap-foot { padding: 4px 12px 6px; border-top: 1px solid #f0f0f0; flex-shrink: 0; }
.rel-heatmap-foot-inner { margin-left: 56px; margin-right: 70px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; row-gap: 4px; column-gap: 8px; }
.rel-heatmap-note { grid-column: 1/-1; font-size: 10px; color: #888; font-weight: 600; text-align: center; }
.rel-grad-bar { width: 100%; min-width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(to right,#1f4db6,#1fa3d6,#35b779,#f08c2e,#d13438); border: 1px solid #e0e0e0; }
.rel-side { width: 240px; flex-shrink: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.rel-section { padding: 8px 10px; }
.rel-section + .rel-section { border-top: 1px solid #f0f0f0; }
.rel-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #666; margin-bottom: 6px; }
.rel-live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rel-metric-label { font-size: 8px; color: #888; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.rel-metric-value { font-size: 14px; font-weight: 700; line-height: 1.1; color: #1a1a1a; }
.rel-metric-value.warn { color: #f28e2b; }
.rel-table-wrap { padding: 8px 10px; flex: 1; overflow: hidden; }
.rel-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rel-table th { text-align: right; color: #777; font-weight: 600; padding: 2px 4px; }
.rel-table th:first-child { text-align: left; }
#heatmap-canvas-wrap { position: relative; overflow: hidden; }
#heatmap-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }

/* ── Temp tab ── */
#temp-toolbar { display: flex; align-items: center; gap: 6px; }
#temp-metrics { display: grid; grid-template-columns: repeat(6,1fr); gap: 6px; padding: 8px; flex-shrink: 0; }
.temp-metric { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 7px 9px; display: flex; flex-direction: column; gap: 1px; }
.temp-metric-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #888; }
.temp-metric-val { font-size: 18px; font-weight: 700; color: #1a1a1a; line-height: 1.1; }
.temp-metric-sub { font-size: 10px; color: #888; }
#temp-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 0 8px 8px; }
.temp-panel { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.temp-panel-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px 4px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0; }
.temp-panel-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #555; }
.temp-panel-sub   { font-size: 10px; color: #888; }
#temp-line-panel { flex: 1; }
#temp-chart { width: 100%; height: 100%; min-height: 0; flex: 1; }
@media (max-width: 1150px) { #temp-metrics { grid-template-columns: repeat(3,1fr); } }

/* ── Media ── */
@media (max-width: 920px) {
  .diag-grid-new { grid-template-columns: 1fr; grid-template-rows: auto auto; grid-template-areas: "info" "tests"; overflow: hidden; }
  .fault-grid { grid-template-columns: 1fr 1fr; }
  .test-grid-2 { grid-template-columns: 1fr; }
}
