/* sensorium · SDR debug page — live MQTT firehose with stats. */

.sdr-page
{
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sdr-stats
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.sdr-stat
{
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
}
.sdr-stat-label
{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-dim);
}
.sdr-stat-value
{
    font-size: 26px;
    font-weight: 700;
    margin: 4px 0 0;
    font-variant-numeric: tabular-nums;
}
.sdr-stat-sub
{
    font-size: 12px;
    color: var(--fg-dim);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.sdr-controls
{
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
}
.sdr-filter-group
{
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--fg-dim);
}
.sdr-filter-group select
{
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 13px;
}
.sdr-checkbox
{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.sdr-actions
{
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 16px;
}
.sdr-actions details summary
{
    cursor: pointer;
    padding: 8px 0;
    color: var(--fg-dim);
    font-size: 13px;
}
.sdr-actions-note { font-size: 13px; color: var(--fg-dim); }
.sdr-actions pre
{
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    overflow-x: auto;
    margin: 8px 0 12px;
}

.sdr-stream-title
{
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-dim);
    margin: 4px 0;
}
.sdr-table-wrapper
{
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.sdr-table
{
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.sdr-table thead th
{
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-dim);
    font-weight: 600;
    padding: 8px 10px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}
.sdr-table tbody td
{
    padding: 6px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.sdr-table tbody tr.unknown td { color: var(--fg-dim); opacity: 0.7; }
.sdr-table tbody tr.fresh { animation: sdrFlash 600ms ease-out; }
.sdr-table .col-uid { font-family: ui-monospace, monospace; font-size: 12px; }
.sdr-table .col-raw
{
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--fg-dim);
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sdr-table .col-raw:hover
{
    white-space: pre-wrap;
    overflow: visible;
    max-width: none;
}

.sdr-table .empty-state
{
    text-align: center;
    color: var(--fg-dim);
    padding: 24px;
}

@keyframes sdrFlash
{
    0%   { background: color-mix(in srgb, var(--accent, #4493f8) 35%, transparent); }
    100% { background: transparent; }
}

/* Mobile: the raw event table is dense and the canonical readings
   table sits below it. On a phone the side-scroll on every table
   plus the SVG sparkline made the page un-navigable. Below 720 px we:
   - Hide the high-information columns (rssi, snr, raw) that the user
     can still see by tapping a row on desktop.
   - Stack the controls vertically so the dropdowns get full width.
   - Let the stat grid collapse to two columns instead of forcing
     one card per row when the viewport is narrow. */
@media (max-width: 720px)
{
    .sdr-page { padding: 8px 12px 24px; gap: 12px; }
    .sdr-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .sdr-stat { padding: 10px 12px; }
    .sdr-stat-value { font-size: 22px; }
    .sdr-controls { flex-direction: column; align-items: stretch; gap: 10px; }
    .sdr-filter-group { justify-content: space-between; }
    .sdr-filter-group select { flex: 1; min-height: 36px; }
    .sdr-table .col-raw,
    .sdr-table .col-rssi,
    .sdr-table .col-snr,
    .sdr-table thead .col-raw,
    .sdr-table thead .col-rssi,
    .sdr-table thead .col-snr { display: none; }
}
