:root {
    --bg-main: #020617;
    --bg-secondary: rgba(0, 0, 0, 0.7);
    --glass-border: rgba(57, 255, 20, 0.3);
    --glass-highlight: rgba(57, 255, 20, 0.1);
    
    --text-primary: #39ff14;
    --text-secondary: #00ff00;
    --text-muted: #16a34a;
    
    --accent-blue: #0ea5e9;
    --accent-purple: #39ff14;
    --accent-green: #39ff14;
    --accent-orange: #eab308;
    --accent-red: #ff003c;
    
    --status-online: #39ff14;
    --status-offline: #ff003c;
    --status-checking: #eab308;
    
    --font-family: 'Fira Code', 'Share Tech Mono', 'Courier New', monospace;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}

.glass-panel {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    margin: 16px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
}

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

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.brand h2 {
    font-weight: 600;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
}

.system-status {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-top: auto;
}

.system-status p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-checking);
}

.pulse.active {
    background: var(--status-online);
    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); }
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 16px 24px 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    height: 100vh;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.last-updated {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-close {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.btn-close:hover {
    background: var(--accent-red);
    color: white;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.summary-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.15);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.card-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }
.card-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.card-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); }

.card-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
}

/* Device Section */
.devices-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    background: var(--glass-highlight);
    color: var(--text-secondary);
    transition: var(--transition);
}

.badge:hover {
    background: rgba(255,255,255,0.1);
}

.badge.active {
    background: var(--accent-blue);
    color: white;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Device Card */
.device-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.device-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.2);
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--status-checking);
    transition: var(--transition);
}

.device-card.online::before { background: var(--status-online); }
.device-card.offline::before { background: var(--status-offline); }

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.device-icon {
    width: 48px;
    height: 48px;
    background: var(--glass-highlight);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-primary);
}

.device-card.type-server .device-icon { color: var(--accent-blue); }
.device-card.type-modem .device-icon, .device-card.type-ap .device-icon { color: var(--accent-purple); }
.device-card.type-internet .device-icon { color: var(--accent-orange); }

.device-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-checking);
}

.device-card.online .status-dot { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.device-card.offline .status-dot { background: var(--status-offline); box-shadow: 0 0 8px var(--status-offline); }
.device-card.online .device-status { color: var(--status-online); }
.device-card.offline .device-status { color: var(--status-offline); }

.device-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-ip {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.device-metrics {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 14px;
    font-weight: 500;
}

.device-footer {
    margin-top: auto;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--glass-highlight);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--status-checking);
    transition: width 1s ease;
}

.device-card.online .progress-fill { background: var(--status-online); }
.device-card.offline .progress-fill { background: var(--status-offline); }

.uptime-label {
    font-size: 11px;
    color: var(--text-muted);
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ARP Table */
.arp-section {
    padding: 24px;
}

.table-responsive {
    overflow-x: auto;
    margin-top: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.table td {
    font-size: 14px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--glass-highlight);
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: auto;
        height: auto;
        position: relative;
        margin-bottom: 0;
    }
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
    }
    .system-status {
        display: none;
    }
}

/* Fullscreen Topology */
.topology-section.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: var(--bg-dark) !important;
}

.topology-section.fullscreen .section-header {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 0;
    border: none;
    background: transparent;
    z-index: 100000;
}

.topology-section.fullscreen .section-header h2 {
    display: none;
}

.topology-section.fullscreen #topology-network {
    height: 100vh !important;
    width: 100vw !important;
}
