/**
 * diagnostics.css
 *
 * Full-screen diagnostics overlay for the kiosk display. Scrollable panels with
 * touch-friendly controls while chrome auto-hide is suspended.
 */

.diagnosticsOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: #0b1220;
  color: #e8eef8;
}

.diagnosticsOverlay.is-open {
  display: block;
}

.diagnosticsShell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.diagnosticsHeader {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
}

.diagnosticsSourceBanner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  line-height: 1.35;
}

.diagnosticsSourceBanner--local {
  background: rgba(93, 168, 255, 0.1);
  color: #d7e8ff;
}

.diagnosticsSourceBanner--cloud {
  background: rgba(245, 166, 35, 0.14);
  color: #ffe8c2;
}

.diagnosticsSourceBannerTitle {
  font-weight: 700;
}

.diagnosticsSourceBannerDetail {
  opacity: 0.92;
}

.diagnosticsPageIntro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(232, 238, 248, 0.82);
}

.diagnosticsPageIntro code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.diagnosticsTitle {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.diagnosticsNav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.diagnosticsNavBtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.diagnosticsNavBtn.is-active {
  border-color: rgba(93, 168, 255, 0.8);
  background: rgba(93, 168, 255, 0.18);
}

.diagnosticsCloseBtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.diagnosticsBody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.diagnosticsPage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.diagnosticsLogFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnosticsLogToolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.diagnosticsLogTailBtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.diagnosticsLogTailBtn.is-active {
  border-color: rgba(92, 184, 122, 0.75);
  background: rgba(92, 184, 122, 0.16);
  color: #b8e8c8;
}

.diagnosticsLogFilterBtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.diagnosticsLogFilterBtn.is-active {
  border-color: rgba(93, 168, 255, 0.8);
  background: rgba(93, 168, 255, 0.18);
}

.diagnosticsLogFilterBtn:not(.is-active) {
  opacity: 0.55;
}

.diagnosticsPageMeta {
  font-size: 12px;
  color: #9eb4d8;
}

.diagnosticsPageMeta--path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.diagnosticsCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.diagnosticsCard {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.diagnosticsCardTitle,
.diagnosticsSectionTitle {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b8cce8;
}

.diagnosticsKv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
}

.diagnosticsKv dt {
  margin: 0;
  color: #8fa6c9;
}

.diagnosticsKv dd {
  margin: 0;
  word-break: break-word;
}

.diagnosticsOk {
  color: #7dcea0;
}

.diagnosticsWarn {
  color: #f5c96b;
}

.diagnosticsBad {
  color: #f08c7e;
}

.diagnosticsTableWrap {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}

.diagnosticsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.diagnosticsTable th,
.diagnosticsTable td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.diagnosticsTable th {
  position: sticky;
  top: 0;
  background: #101a2c;
  color: #b8cce8;
  font-weight: 650;
}

.diagnosticsLogScroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}

.diagnosticsLogLine {
  display: grid;
  grid-template-columns: 190px 52px 1fr;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.diagnosticsLogTs {
  color: #8fa6c9;
}

.diagnosticsLogLevel {
  font-weight: 700;
}

.diagnosticsLogLine--warn .diagnosticsLogLevel {
  color: #f5c96b;
}

.diagnosticsLogLine--error .diagnosticsLogLevel {
  color: #f08c7e;
}

.diagnosticsLogText {
  white-space: pre-wrap;
  word-break: break-word;
}

.diagnosticsEmpty,
.diagnosticsLoading,
.diagnosticsError {
  color: #9eb4d8;
  padding: 12px 0;
}

.diagnosticsError {
  color: #f08c7e;
}

.diagnosticsGapLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: #9eb4d8;
  margin-bottom: 8px;
}

.diagnosticsGapLegendItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diagnosticsGapLegendSwatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.diagnosticsGapLegendSwatch--present {
  background: #5cb87a;
  box-shadow: 0 0 0 1px rgba(92, 184, 122, 0.35);
}

.diagnosticsGapLegendSwatch--missing {
  background: #2a3348;
  box-shadow: 0 0 0 1px rgba(240, 140, 126, 0.55);
}

.diagnosticsGapAxis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #8fa6c9;
  margin: 0 0 12px 148px;
}

.diagnosticsGapRows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diagnosticsGapRow {
  display: grid;
  grid-template-columns: minmax(120px, 140px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.diagnosticsGapRowLabel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.diagnosticsGapRowName {
  font-size: 13px;
  font-weight: 650;
  color: #e8eef8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnosticsGapRowMeta {
  font-size: 11px;
  color: #8fa6c9;
  line-height: 1.35;
}

.diagnosticsGapRowTrackWrap {
  min-width: 0;
}

.diagnosticsGapTrack {
  position: relative;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.diagnosticsGapTrack--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #8fa6c9;
}

.diagnosticsGapDot {
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  margin-left: -2.5px;
  border-radius: 50%;
  pointer-events: none;
}

.diagnosticsGapDot--present {
  background: #5cb87a;
  box-shadow: 0 0 4px rgba(92, 184, 122, 0.45);
}

.diagnosticsGapDot--missing {
  background: #1a2233;
  border: 1px solid rgba(240, 140, 126, 0.75);
}

.diagnosticsPageIntro {
  margin: 0 0 10px;
  color: #9eb0cc;
  font-size: 0.85rem;
  line-height: 1.45;
}

.diagnosticsTable--video .diagnosticsVideoTs {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.diagnosticsVideoKind {
  font-weight: 600;
  font-size: 0.82rem;
}

.diagnosticsVideoRow--error .diagnosticsVideoKind {
  color: #f08c7e;
}

.diagnosticsVideoRow--warn .diagnosticsVideoKind {
  color: #e8c468;
}

@media (max-width: 640px) {
  .diagnosticsGapRow {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .diagnosticsGapAxis {
    margin-left: 0;
  }
}

.page.diagnostics-open {
  overflow: hidden;
}

.page.diagnostics-open .main {
  visibility: hidden;
}

/* Hide the main menu chrome while diagnostics owns the screen — avoids overlapping tab rows. */
.page.diagnostics-open .topbar {
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  margin: 0;
  overflow: hidden;
}
