/* bcd.day -- Telemetry Console Dashboard */
/* Palette:
   Background (deepest): #14161a
   Panel surface: #1a1d23
   Grid lines / bezels: #2a2d35
   Chart grid: #323640
   Muted text: #5c6370
   Body text: #8b919e
   Primary text: #c8ccd4
   Bright text: #e8ecf2
   Teal accent: #5de4c7
   Amber accent: #e5a64e
   Red indicator: #e55a5a
*/

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #14161a;
    font-family: 'IBM Plex Mono', monospace;
    color: #8b919e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dashboard Grid */
#dashboard {
    height: 100vh;
    width: 100vw;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 48px repeat(4, 1fr) repeat(3, 0.7fr);
    gap: 2px;
    background: #2a2d35;
    overflow: hidden;
}

/* Panel Base */
.panel {
    background: #1a1d23;
    position: relative;
    overflow: hidden;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    z-index: 1;
}

.panel:hover {
    transform: scale(1.02);
    z-index: 10;
    box-shadow: 0 0 40px rgba(93, 228, 199, 0.08);
}

.panel-label {
    display: block;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5c6370;
    padding: 10px 14px 0;
    position: relative;
    z-index: 2;
}

/* Status Bar -- Row 1, Cols 1-12 */
.panel-status-bar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.panel-status-bar:hover {
    transform: scale(1);
    box-shadow: none;
}

.status-domain {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c8ccd4;
}

.status-clock {
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: #8b919e;
    font-variant-numeric: tabular-nums;
}

.status-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.indicator-green {
    background: #5de4c7;
    box-shadow: 0 0 6px rgba(93, 228, 199, 0.6);
}

.indicator-amber {
    background: #e5a64e;
    box-shadow: 0 0 6px rgba(229, 166, 78, 0.5);
}

.indicator-gray {
    background: #5c6370;
}

/* Primary Waveform -- Rows 2-5, Cols 1-7 */
.panel-waveform {
    grid-column: 1 / 8;
    grid-row: 2 / 6;
    display: flex;
    flex-direction: column;
}

#waveform-svg {
    flex: 1;
    width: 100%;
    min-height: 0;
}

.waveform-path {
    fill: none;
    stroke: #5de4c7;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.waveform-path-glow {
    fill: none;
    stroke: #5de4c7;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: blur(4px);
    opacity: 0.3;
}

.readout-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px 14px;
    border-top: 1px solid #2a2d35;
    flex-shrink: 0;
}

.readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.readout-label {
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5c6370;
}

.readout-value {
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.04em;
    color: #e8ecf2;
    font-variant-numeric: tabular-nums;
}

/* Radial Gauge -- Rows 2-3, Cols 8-12 */
.panel-gauge {
    grid-column: 8 / -1;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#gauge-svg {
    width: 80%;
    max-width: 200px;
    height: auto;
}

.gauge-track {
    fill: none;
    stroke: #2a2d35;
    stroke-width: 3;
}

.gauge-fill {
    fill: none;
    stroke: #5de4c7;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 502.65;
    stroke-dashoffset: 502.65;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-text {
    fill: #e8ecf2;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 28px;
    font-weight: 400;
    text-anchor: middle;
    dominant-baseline: middle;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

/* Bar Chart -- Row 4, Cols 8-12 */
.panel-bars {
    grid-column: 8 / -1;
    grid-row: 4;
    display: flex;
    flex-direction: column;
}

#bars-svg {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 8px 14px;
}

.bar-rect {
    fill: #5de4c7;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1), y 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-glow {
    fill: #5de4c7;
    opacity: 0.15;
    filter: blur(3px);
}

/* Log Feed -- Row 5, Cols 8-12 */
.panel-log {
    grid-column: 8 / -1;
    grid-row: 5;
    display: flex;
    flex-direction: column;
}

.log-feed {
    flex: 1;
    overflow: hidden;
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.log-entry {
    font-size: 12px;
    line-height: 1.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.log-entry.entering {
    opacity: 0;
    transform: translateY(8px);
}

.log-entry.exiting {
    opacity: 0;
    transform: translateY(-8px);
}

.log-timestamp {
    color: #6b7280;
}

.log-message {
    color: #9ca3af;
}

/* Sparklines -- Rows 6-8, Cols 1-12 */
.panel-sparklines {
    grid-column: 1 / -1;
    grid-row: 6 / 9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 20px;
}

.sparkline-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.sparkline-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sparkline-label {
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5c6370;
    margin-bottom: 4px;
}

.sparkline-svg {
    flex: 1;
    width: 100%;
    min-height: 0;
}

.sparkline-baseline {
    stroke: #2a2d35;
    stroke-width: 1;
}

.sparkline-path {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline-tick {
    stroke: #2a2d35;
    stroke-width: 1;
}

.bottom-status {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: #5c6370;
    text-align: center;
    padding-top: 10px;
    flex-shrink: 0;
}

/* Chart grid lines */
.chart-grid-line-v {
    stroke: #323640;
    stroke-width: 0.5;
}

.chart-grid-line-h {
    stroke: #323640;
    stroke-width: 0.5;
    stroke-dasharray: 4 8;
}

/* Responsive: below 768px */
@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    #dashboard {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 2px;
        overflow: visible;
    }

    .panel {
        min-height: 200px;
    }

    .panel-status-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        min-height: 48px;
    }

    .panel-waveform {
        min-height: 320px;
    }

    .panel-gauge {
        min-height: 260px;
    }

    .panel-bars {
        min-height: 180px;
    }

    .panel-log {
        min-height: 240px;
    }

    .panel-sparklines {
        min-height: 200px;
    }

    .sparkline-row {
        flex-wrap: wrap;
    }

    .sparkline-container {
        flex: 0 0 calc(50% - 6px);
        min-height: 60px;
    }

    .readout-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .readout {
        flex: 0 0 calc(33.33% - 8px);
    }

    .panel:hover {
        transform: none;
        box-shadow: none;
    }
}
