/* ═══════════════════════════════════════════════════════════════════════════
   Network Diagnostic Tool — Design System & Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Custom Properties ───────────────────────────────────────────────────── */
:root {
    --bg-primary: #06090f;
    --bg-secondary: #0c1220;
    --bg-card: rgba(12, 18, 32, 0.85);
    --bg-card-hover: rgba(18, 26, 48, 0.95);
    --bg-input: rgba(15, 23, 42, 0.9);

    --border-color: rgba(99, 102, 241, 0.12);
    --border-hover: rgba(99, 102, 241, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --cyan: #06b6d4;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --green: #10b981;
    --yellow: #f59e0b;
    --orange: #f97316;
    --red: #ef4444;

    --gradient-primary: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-accent: linear-gradient(135deg, #8b5cf6, #06b6d4);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #f97316);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f97316);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow-cyan: 0 0 30px rgba(6, 182, 212, 0.15);
    --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ── Background Grid ─────────────────────────────────────────────────────── */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.bg-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

/* ── App Container ───────────────────────────────────────────────────────── */
#app {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 24px 48px;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
#main-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
}

.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.version {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 2px;
}

.header-center { flex: 1; min-width: 280px; }

.server-input-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: block;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    transition: border-color var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 10px 0;
}

.input-wrapper input::placeholder { color: var(--text-muted); }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
    transition: background var(--transition);
    flex-shrink: 0;
}

.status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 16px rgba(16, 185, 129, 0.8); }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon-only:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    transition: all var(--transition);
}

.btn-sm:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 6px;
    color: var(--cyan);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.btn-icon:hover {
    background: rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════════════════════ */
#progress-container {
    position: relative;
    height: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

#progress-container.hidden { display: none; }

#progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
    opacity: 0.3;
    width: 0%;
}

#progress-text {
    position: relative;
    z-index: 1;
    padding: 0 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONNECTION INFO BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.info-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow-x: auto;
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 20px;
    min-width: fit-content;
}

.info-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.info-divider {
    width: 1px;
    height: 32px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN METRICS GRID (Gauges + Quality)
   ═══════════════════════════════════════════════════════════════════════════ */
#metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
    backdrop-filter: blur(12px);
}

.metric-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow-cyan);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* ── Gauges ───────────────────────────────────────────────────────────────── */
.gauge-wrapper {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.gauge-svg {
    width: 160px;
    height: 160px;
}

.gauge-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.08);
    stroke-width: 12;
    stroke-dasharray: 534;
    transform: rotate(-90deg);
    transform-origin: center;
}

.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-value {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    fill: var(--text-primary);
}

.gauge-unit {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    fill: var(--text-muted);
}

.gauge-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Quality Card ─────────────────────────────────────────────────────────── */
.quality-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 12px;
}

.quality-grade {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.5s ease;
}

.quality-grade.grade-a { background: var(--gradient-success); -webkit-background-clip: text; background-clip: text; }
.quality-grade.grade-b { background: var(--gradient-primary); -webkit-background-clip: text; background-clip: text; }
.quality-grade.grade-c { background: var(--gradient-warning); -webkit-background-clip: text; background-clip: text; }
.quality-grade.grade-d, .quality-grade.grade-f { background: var(--gradient-danger); -webkit-background-clip: text; background-clip: text; }

.quality-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
}

.quality-score {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 2px;
}

.quality-breakdown {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qb-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qb-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    width: 64px;
    flex-shrink: 0;
}

.qb-bar {
    flex: 1;
    height: 6px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.qb-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: var(--gradient-primary);
    transition: width 1s ease, background 0.5s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECONDARY METRICS
   ═══════════════════════════════════════════════════════════════════════════ */
#secondary-metrics {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.metric-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.metric-mini:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mini-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.jitter-icon { background: rgba(249, 115, 22, 0.12); color: var(--orange); }
.loss-icon   { background: rgba(239, 68, 68, 0.12);  color: var(--red); }
.dns-icon    { background: rgba(6, 182, 212, 0.12);  color: var(--cyan); }
.tcp-icon    { background: rgba(59, 130, 246, 0.12); color: var(--blue); }
.tls-icon    { background: rgba(139, 92, 246, 0.12); color: var(--purple); }
.ttfb-icon   { background: rgba(16, 185, 129, 0.12); color: var(--green); }

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

.mini-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mini-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.mini-value small {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.mini-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--text-muted);
    transition: background var(--transition);
}

.mini-indicator.good { background: var(--green); box-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }
.mini-indicator.fair { background: var(--yellow); box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
.mini-indicator.poor { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED CARD STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   TIMING WATERFALL
   ═══════════════════════════════════════════════════════════════════════════ */
#timing-waterfall {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timing-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.timing-label {
    width: 140px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.timing-bar-container {
    flex: 1;
    height: 24px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.timing-bar {
    height: 100%;
    min-width: 0;
    width: 0%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.timing-dns     { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.timing-tcp     { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.timing-tls     { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.timing-ttfb    { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.timing-content { background: linear-gradient(90deg, #10b981, #34d399); }

.timing-value {
    width: 80px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.timing-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.timing-total span:last-child {
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHARTS SECTION
   ═══════════════════════════════════════════════════════════════════════════ */
#charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card {
    margin-bottom: 0;
}

.chart-container {
    height: 220px;
    position: relative;
}

.chart-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    user-select: none;
}

.toggle-label input { display: none; }

.toggle-switch {
    width: 36px;
    height: 20px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    position: relative;
    transition: background var(--transition);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all var(--transition);
}

.toggle-label input:checked + .toggle-switch {
    background: rgba(6, 182, 212, 0.3);
}

.toggle-label input:checked + .toggle-switch::after {
    left: 18px;
    background: var(--cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

.chart-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-cyan   { background: var(--cyan); }
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }

.ws-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESULTS TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.result-actions {
    display: flex;
    gap: 8px;
}

.results-table-wrapper {
    overflow-x: auto;
}

#results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#results-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

#results-table td {
    padding: 10px 16px;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    color: var(--text-secondary);
}

#results-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

#results-table td:nth-child(2) {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state {
    text-align: center;
    padding: 32px 16px !important;
    color: var(--text-muted) !important;
    font-style: italic;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-good { background: rgba(16, 185, 129, 0.12); color: var(--green); }
.status-fair { background: rgba(245, 158, 11, 0.12); color: var(--yellow); }
.status-poor { background: rgba(239, 68, 68, 0.12); color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVITY LOG
   ═══════════════════════════════════════════════════════════════════════════ */
#log-container {
    max-height: 260px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.7;
}

#log-content {
    padding: 4px 0;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    animation: fadeIn 0.3s ease;
}

.log-entry:hover { background: rgba(99, 102, 241, 0.04); }

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 70px;
}

.log-type {
    flex-shrink: 0;
    min-width: 48px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    padding-top: 1px;
}

.log-type.info    { color: var(--cyan); }
.log-type.success { color: var(--green); }
.log-type.warn    { color: var(--yellow); }
.log-type.error   { color: var(--red); }
.log-type.test    { color: var(--purple); }

.log-msg { color: var(--text-secondary); word-break: break-word; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.testing .card-header h3::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top: 2px solid var(--cyan);
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    #metrics-grid { grid-template-columns: repeat(2, 1fr); }
    #secondary-metrics { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    #main-header { flex-direction: column; align-items: stretch; }
    .header-right { justify-content: center; }
    #charts-section { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    #app { padding: 8px 12px 32px; }
    #metrics-grid { grid-template-columns: 1fr; }
    #secondary-metrics { grid-template-columns: repeat(2, 1fr); }
    .gauge-stats { grid-template-columns: repeat(2, 1fr); }
    .info-bar { flex-direction: column; gap: 8px; }
    .info-divider { display: none; }
    .info-item { padding: 4px 0; }
}
