:root {
    --bg-base: #0a0f1d;
    --bg-card: rgba(18, 26, 44, 0.75);
    --bg-card-hover: rgba(26, 38, 64, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(59, 130, 246, 0.4);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);
    
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.25);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Glassmorphism helpers */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.25s ease;
}

.glass-nav {
    background: rgba(11, 17, 31, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 29, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.input-group {
    text-align: left;
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.error-text {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 16px;
}

.btn-primary {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px var(--primary-glow);
}

.login-footer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-dim);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.node-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

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

.pulse-green {
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.telemetry-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
}

.pill-label {
    color: var(--text-dim);
}

.pill-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent);
}

.btn-outline-sm {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-sm:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Status Cards Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.status-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.radio-icon { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }
.gw-icon { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); }
.shield-icon { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }

.card-head h3 {
    font-size: 15px;
    font-weight: 700;
}

.ip-mono {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
}

.card-metrics {
    display: flex;
    gap: 16px;
}

.m-item {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.m-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.m-val {
    font-size: 16px;
    font-weight: 700;
}

.mono { font-family: var(--font-mono); }
.text-green { color: var(--success); }
.text-cyan { color: var(--accent); }
.text-yellow { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

.isolation-card {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.shield-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Test Dashboard */
.test-dashboard {
    padding: 30px;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-header h2 {
    font-size: 20px;
    font-weight: 800;
}

.test-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Test Config Row */
.test-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 28px;
}

.config-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.btn-group-segmented {
    display: flex;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.btn-seg {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-seg small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    opacity: 0.8;
}

.btn-seg.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-seg-accent.active {
    background: linear-gradient(135deg, var(--accent), #0284c7);
    color: #fff;
}

.btn-seg-warn.active {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
}

.btn-action-primary {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 24px var(--success-glow);
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px var(--success-glow);
}

.btn-action-danger {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--danger), #dc2626);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Live Telemetry Panel */
.live-telemetry-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.live-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.live-stat-box {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.speed-box {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.05);
}

.stat-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-number {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 8px 0;
}

.num-large { font-size: 38px; font-weight: 800; color: #fff; }
.num-medium { font-size: 28px; font-weight: 700; color: #fff; }
.unit { font-size: 14px; color: var(--text-dim); font-weight: 600; }

.stat-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.stat-sub b {
    color: var(--text-main);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.3s ease;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-container {
    padding: 20px;
}

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

.chart-header h4 {
    font-size: 14px;
    font-weight: 700;
}

.badge-live {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.chart-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
}

/* Verdict Banner */
.verdict-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 14px;
    margin-top: 8px;
}

.verdict-icon {
    font-size: 32px;
}

.verdict-content h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 4px;
}

.verdict-content p {
    font-size: 13px;
    color: var(--text-muted);
}

/* History Section */
.history-section {
    padding: 26px;
}

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

.history-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table th {
    text-align: left;
    padding: 12px 14px;
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Helpers */
.hidden { display: none !important; }

@media (max-width: 900px) {
    .test-config-row {
        grid-template-columns: 1fr;
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
    .top-nav {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .nav-right {
        width: 100%;
        justify-content: space-between;
    }
}
