:root {
    /* Refined Blue Gradient Theme */
    --bg-dark: #0f172a;        /* Deep Slate Blue */
    --bg-deep: #020617;        /* Near Black Blue */
    --primary: #3b82f6;        /* Bright Blue */
    --primary-mid: #1e40af;     /* Mid Blue */
    --primary-dark: #1e3a8a;    /* Deep Blue */
    --primary-glow: rgba(59, 130, 246, 0.4);
    --secondary: #60a5fa;      /* Light Blue Accent */
    
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    
    /* Enhanced Glassmorphism */
    --glass: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(59, 130, 246, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Status Colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at top right, rgba(30, 64, 175, 0.15), transparent 50%),
                radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.1), transparent 50%);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 10;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    transition: width 0.3s;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
}

.brand-mascot {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    box-shadow: 0 0 15px var(--primary-glow);
    border: 1px solid var(--glass-border);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-suffix {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--secondary);
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-top: -2px;
}
.brand-name span { color: var(--primary); }

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 12px 16px;
}

/* Unified Cockpit Grid */
#unified-cockpit {
    animation: fadeIn 0.4s ease-out;
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Progress Bar Tweaks */
#progress-bar {
    box-shadow: 0 0 10px var(--primary);
}

.nav-item {
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item .icon svg {
    opacity: 0.6;
    transition: 0.2s;
}

.nav-item:hover { 
    background: var(--glass-hover); 
    color: #fff; 
    border-color: rgba(59, 130, 246, 0.1);
}

.nav-item.active { 
    background: linear-gradient(90deg, var(--glass-hover), transparent);
    border-left: 3px solid var(--primary);
    color: var(--secondary); 
}

.nav-item.active .icon svg { 
    opacity: 1; 
    filter: drop-shadow(0 0 6px var(--primary-glow)); 
}

.connection-status {
    margin-top: auto;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pGlow 2s infinite;
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
}

/* Content Area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.top-bar {
    height: 72px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--glass-border);
}

.breadcrumb {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--primary);
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.7rem; color: var(--secondary); text-transform: uppercase; font-weight: 700;}

.view-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

/* Common Components */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.3);
}

.view-header { margin-bottom: 32px; }
.view-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #fff;
    letter-spacing: -0.5px;
}
.view-header p { color: var(--text-dim); font-size: 0.95rem; }

/* Buttons & Inputs */
.action-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.action-btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.action-btn.danger { background: var(--danger); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }
.action-btn.danger:hover { background: #f87171; box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4); }

.field {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: 8px;
    color: #fff;
    outline: none;
    transition: 0.2s;
    font-size: 0.9rem;
}

.field:focus { border-color: var(--secondary); box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2); }

/* Animations */
@keyframes pGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.5; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59, 130, 246, 0.5); }

/* Tables */
.table-container {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 24px;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { 
    text-align: left; 
    padding: 16px; 
    font-size: 0.75rem; 
    color: var(--secondary); 
    text-transform: uppercase; 
    background: rgba(30, 64, 175, 0.1);
    border-bottom: 2px solid rgba(59, 130, 246, 0.2); 
}
.data-table td { 
    padding: 16px; 
    font-size: 0.85rem; 
    border-bottom: 1px solid rgba(255,255,255,0.02); 
}
.data-table tr:hover { background: rgba(59, 130, 246, 0.05); }

/* Remote Desktop */
.remote-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-deep);
    padding: 16px 24px;
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.stream-stats {
    display: flex;
    gap: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.stream-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qual-controls { display: flex; gap: 8px; }

.qual-btn {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.qual-btn:hover { border-color: var(--secondary); color: #fff; }
.qual-btn.active { 
    background: var(--primary); 
    color: #fff; 
    border-color: var(--primary); 
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.remote-screen {
    width: 100%;
    height: calc(100vh - 350px);
    background: #000;
    border: 1px solid var(--glass-border);
    border-radius: 0 0 12px 12px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

.rd-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(0,0,0,0.4), #000);
}

.scanner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--secondary);
    box-shadow: 0 0 20px var(--secondary);
    animation: scan 4s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes scan { 0%, 100% { top: 0; } 50% { top: 100%; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Terminal */
.terminal-window {
    background: #020617;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
}

.term-header {
    background: rgba(30, 64, 175, 0.1);
    padding: 12px 20px;
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.term-tab {
    font-size: 0.8rem;
    color: #fff;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.2);
    cursor: pointer;
}

.term-tab.inactive {
    background: transparent;
    color: var(--text-dim);
}
.term-tab.inactive:hover { color: #fff; }

.term-body {
    height: 400px;
    padding: 24px;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    color: #e2e8f0;
    overflow-y: auto;
}

.term-line { margin-bottom: 6px; }
.term-line.prompt { color: var(--secondary); font-weight: 700; }
.term-line.error { color: var(--danger); }
.term-line.ps { color: #818cf8; }

/* Dashboard Cards */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

/* Modals/Dialogs */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    transform: translateY(20px);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}
/* Notifications */
#notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--secondary); }

.toast-icon {
    width: 24px;
    height: 24px;
    background: var(--bg-deep);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-main);
}

.toast-content {
    font-size: 0.9rem;
    color: var(--text-main);
}
/* Node Card Styling - Redesigned */
.node-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    border-radius: 12px;
    display: flex;
    gap: 20px;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.node-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.05);
}

.node-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.node-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.node-user {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.node-version {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.node-signal {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--success);
    border: 1px solid var(--success);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.1);
    align-self: flex-start;
    margin-top: 4px;
}

.arrow-hint {
    color: var(--primary);
    transform: translateX(-10px);
    opacity: 0;
    transition: all 0.3s;
}

.node-card:hover .arrow-hint {
    transform: translateX(0);
    opacity: 1;
}

/* Remote Screen Polish */
.remote-screen {
    background-color: #000;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    transition: background-image 0.2s ease-in-out;
}

/* Cockpit Sidebar & Telemetry */
.progress-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.sys-info-item {
    display: flex;
    flex-direction: column;
}
.sys-info-item label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 700;
}
.sys-info-item span {
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
    align-self: flex-end;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.stat-row span:first-child { color: var(--text-dim); }
.stat-row span:last-child { color: #fff; font-weight: 600; font-family: 'JetBrains Mono', monospace; }

#cockpit-sidebar .action-btn {
    padding: 10px;
    font-size: 0.75rem;
    background: rgba(30, 64, 175, 0.2);
    border: 1px solid var(--primary);
    box-shadow: none;
}
#cockpit-sidebar .action-btn:hover { background: var(--primary); }
