/* Panels (BlackboxFlightLab.Web/Panels): stat boxes, Tune card, Betaflight-style sliders view, Details report,
   Filter guide flyout content. Ports of the desktop MetricsPanel, StepStatsPanel, TuneSummary,
   BetaflightSlidersView and FilterGuide. Every colour is a token from theme.css (or declared below). */

/* ---- stat boxes (MetricsPanel, StepStatsPanel) ------------------------------------------------ */
.stat-box {
  flex: 1; min-width: 0; min-height: 0; margin: 4px 0; border: 1px solid var(--sp-border); border-radius: 6px; background: var(--sp-surface-alt);
}
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stat-title { font-size: 13px; font-weight: 600; color: var(--sp-text-muted); overflow-wrap: anywhere; }
.btn.expand { padding: 0 6px; margin: 0; font-size: 14px; min-height: 0; line-height: 1.4; flex: none; }
.metrics-panel { padding: 6px 10px; overflow-y: auto; }
.metrics-panel .stat-head { margin-bottom: 4px; }
.metrics-cells { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.metric { margin: 0 10px 3px 0; min-width: 0; cursor: default; }
.metric-label { font-size: 13px; color: var(--sp-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value { font-size: 17px; line-height: 1.3; font-weight: 600; color: var(--sp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-stats { display: flex; flex-direction: column; padding: 4px 8px 6px; }
.step-summary { font-size: 13px; color: var(--sp-text); margin: 2px 0 4px; white-space: pre-wrap; }
.dot-plots { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 6px; }
.dot-cell { min-width: 0; min-height: 0; position: relative; }

/* ---- Tune in this log (TuneSummary) ------------------------------------------------------------ */
.tune-summary { display: flex; flex-direction: column; gap: 2px; }
.tune-heading { font-size: 13px; font-weight: 700; color: var(--sp-text-muted); margin-bottom: 4px; }
.tune-table { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 2px 0 6px; font-size: 14px; }
.tune-table span { margin: 1px 0; text-align: right; color: var(--sp-text); }
.tune-table span:nth-child(6n+1) { text-align: left; }
.tune-table .th { font-weight: 600; color: var(--sp-text-muted); }
.tune-row { margin: 2px 0; }
.tune-label { font-size: 12px; color: var(--sp-text-muted); }
.tune-value { font-size: 14px; color: var(--sp-text); overflow-wrap: anywhere; }

/* ---- Betaflight-style sliders view (BetaflightSlidersView) ---------------------------------------- */
.bf-view { flex: 1; min-width: 0; overflow-y: auto; background: var(--sp-bf-surface); color: var(--sp-bf-ink); }
.bf-root { padding: 16px; }
.bf-text { font-size: 13px; }
.bf-muted { color: var(--sp-bf-muted); }
.bf-title { font-size: 22px; padding-bottom: 5px; border-bottom: 2px solid var(--sp-bf-yellow); }
.bf-subtitle { font-size: 12px; font-weight: 600; color: var(--sp-bf-yellow); margin: 10px 0 14px; white-space: pre-wrap; }
.bf-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.bf-left { margin-right: 10px; min-width: 0; }
.bf-right { min-width: 0; }
.bf-section { margin: 5px 0 10px; padding: 8px 10px 10px; border: 1px solid var(--sp-bf-edge); border-radius: 6px; min-width: 0; }
.bf-section > legend { font-size: 11px; font-weight: 600; padding: 0 5px; margin-left: -1px; }
.bf-mode { font-size: 11px; margin-bottom: 5px; white-space: pre; }
.bf-sep { height: 1px; background: var(--sp-bf-edge); margin: 8px 0; }
.bf-scale { display: flex; justify-content: space-between; margin: 0 6px 2px 179px; font-size: 9px; color: var(--sp-bf-muted); }
.bf-slider { display: grid; grid-template-columns: 133px 40px minmax(0, 1fr); align-items: center; margin: 4px 0; font-size: 11px; }
.bf-slider-label { text-align: right; }
.bf-detail { font-size: 9px; color: var(--sp-bf-muted); }
.bf-slider-value { text-align: center; font-weight: 600; }
.bf-bar { height: 26px; padding: 0 6px; display: flex; align-items: center; }
.bf-bar.disabled { opacity: .45; }
.bf-rail { position: relative; flex: 1; height: 4px; background: var(--sp-bf-edge); }
.bf-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--sp-bf-yellow); }
.bf-thumb { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--sp-bf-surface); border: 1.5px solid var(--sp-bf-yellow); box-sizing: border-box; }
.bf-wrap { display: flex; flex-wrap: wrap; }
.bf-field { margin: 0 9px 6px 0; min-width: 65px; }
.bf-field.bf-stretch { margin-right: 0; }
.bf-label { font-size: 10px; color: var(--sp-bf-muted); }
.bf-box { font-size: 11px; background: var(--sp-bf-surface); border: 1px solid var(--sp-bf-edge); border-radius: 3px; padding: 2px 6px; margin-top: 3px; min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-subhead { font-size: 12px; font-weight: 600; margin: 4px 0 5px; }
.bf-toggle { display: flex; align-items: center; margin: 6px 0 5px; font-size: 11px; }
.bf-track { width: 25px; height: 12px; border-radius: 6px; background: var(--sp-bf-muted); margin: 1px 7px 0 0; position: relative; flex: none; }
.bf-track.on { background: var(--sp-bf-yellow); }
.bf-knob { position: absolute; top: 1px; left: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--sp-bf-knob); }
.bf-track.on .bf-knob { left: 14px; }
.bf-pid { display: grid; grid-template-columns: 48px repeat(5, minmax(0, 1fr)); align-items: center; }
.bf-pid-head { font-size: 10px; font-weight: 600; text-align: center; margin: 0 2px 6px; }
.bf-pid .bf-box { margin: 3px 2px 0; }
.bf-axis { font-size: 12px; font-weight: 700; color: var(--sp-bf-axis-text); border-radius: 2px; padding: 2px 3px; margin: 4px 5px 0 0; }
.bf-axis.roll { background: var(--sp-bf-roll); }
.bf-axis.pitch { background: var(--sp-bf-pitch); }
.bf-axis.yaw { background: var(--sp-bf-yaw); }
.bf-valuerow { display: grid; grid-template-columns: 85px minmax(0, 1fr); align-items: center; margin: 2px 0; font-size: 11px; }
.bf-valuerow .bf-box { margin: 0 8px 0 0; }
.bf-foot { font-size: 11px; margin-top: 4px; }

/* ---- Details report (DetailsReport) ----------------------------------------------------------- */
.details {
  margin: 16px; font-family: Consolas, "DejaVu Sans Mono", "Cascadia Mono", Menlo, monospace; font-size: 14px; line-height: 1.22;
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; cursor: text; color: var(--sp-text);
}

/* ---- Filter guide flyout (FilterGuideFlyout) ----------------------------------------------------- */
.filter-guide .guide-button { padding: 4px 10px; margin: 0; }
.filter-guide .flyout-panel { width: min(748px, calc(100vw - 32px)); max-height: min(620px, 70vh); overflow-y: auto; }
.guide-text { font-size: 14px; line-height: 1.33; white-space: pre-wrap; margin-right: 14px; user-select: text; -webkit-user-select: text; }

/* ---- phone width ------------------------------------------------------------------------------- */
@media (max-width: 700px) {
  .track-grid .metrics-panel { overflow: visible; }
  .bf-view { overflow: visible; }
  .bf-root { padding: 12px 8px; }
  .bf-body { grid-template-columns: minmax(0, 1fr); }
  .bf-left { margin-right: 0; }
  .bf-scale { margin-left: 120px; }
  .bf-slider { grid-template-columns: 82px 38px minmax(0, 1fr); }
  .bf-pid { grid-template-columns: 44px repeat(5, minmax(0, 1fr)); }
  .bf-pid-head { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .details { margin: 10px; font-size: 12px; }
  .guide-text { font-size: 13px; }
}
