:root {
    --bg-color: #002623;
    --panel-bg: rgba(5, 66, 57, 0.65);
    --border-color: rgba(185, 167, 121, 0.28);
    --text-primary: #edebe0;
    --text-secondary: #b9a779;
    
    --primary: #988561; 
    --success: #10b981; 
    --warning: #f59e0b; 
    --danger: #ef4444;  
    
    --glow-success: rgba(16, 185, 129, 0.5);
    --glow-warning: rgba(245, 158, 11, 0.4);
    --glow-danger:  rgba(239, 68, 68, 0.6);
}

@font-face {
  font-family: 'ITF Qomra Arabic Bold';
  src: url('fonts/itfQomraArabic-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'ITF Qomra Arabic Bold', 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

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

/* Glassmorphism utilities */
.glass-panel, .glass-box {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dashboard Sidebar */
.dashboard {
    width: 350px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-right: 1px solid var(--border-color);
}

.header {
    margin-bottom: 30px;
    position: relative;
    padding-top: 10px;
}

.header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #e0e7ff;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.author-badge {
    position: absolute;
    top: -10px;
    left: 0;
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: auto; /* pushes controls to bottom */
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
}

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

.stat-info .label {
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-info .value {
    font-size: 14px;
    font-weight: 600;
}

.status-active { color: var(--success); }
.status-standby { color: var(--warning); }
.status-offline { color: var(--danger); }

#stat-r1 .stat-icon { color: var(--success); }
#stat-r2 .stat-icon { color: var(--warning); }

.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 12px 15px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

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

.danger-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.danger-btn:hover {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.secondary-btn {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Network View */
.network-view {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
        url('pattern.png'),
        linear-gradient(rgba(185, 167, 121, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(185, 167, 121, 0.04) 1px, transparent 1px);
    background-size: 380px, 40px 40px, 40px 40px;
    background-position: center, 0 0, 0 0;
    background-repeat: repeat;
    opacity: 0.6;
    z-index: 1;
}

#lines-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.line {
    stroke: rgba(255,255,255,0.15);
    stroke-width: 2;
    transition: stroke 0.3s ease;
}
.line.active-link {
    stroke: var(--success);
    stroke-width: 2.5;
    opacity: 0.6;
    animation: flowPulse 2s infinite alternate;
}

@keyframes flowPulse {
    from { opacity: 0.3; }
    to { opacity: 0.8; }
}

.topology {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px;
    justify-content: space-around; /* Distribute nodes evenly */
}

.tier {
    display: flex;
    justify-content: center;
    gap: 50px;
    width: 100%;
}

/* Core Tier */
.core-tier {
    margin-top: 10px;
}

.datacenter-box {
    padding: 25px 50px;
    border-radius: 20px;
    text-align: center;
    min-width: 600px;
    background: rgba(5, 66, 57, 0.4);
    border: 2px solid var(--border-color);
}

.dc-title {
    font-size: 20px;
    margin-bottom: 25px;
    color: #e0e7ff;
}

.routers-layer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Nodes */
.node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 38, 35, 0.85);
    border: 2px solid var(--border-color);
    padding: 15px;
    border-radius: 16px;
    min-width: 120px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.node i {
    font-size: 28px;
}

.node span {
    font-size: 13px;
    font-weight: 700;
}

/* Node states */
.active-node {
    border-color: var(--success);
    box-shadow: 0 0 20px var(--glow-success);
}
.active-node i { color: var(--success); }

.standby-node {
    border-color: var(--warning);
    border-style: dashed;
}
.standby-node i { color: var(--warning); }

.offline-node {
    border-color: var(--danger);
    box-shadow: 0 0 20px var(--glow-danger);
    opacity: 0.8;
}
.offline-node i { color: var(--danger); }

/* specific nodes */
.server {
    border-color: var(--primary);
    min-width: 150px;
}
.server i { color: var(--primary); }

.regional-tier {
    gap: 100px;
}

.regional {
    border-radius: 50%;
    width: 120px;
    height: 120px;
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.08);
}
.regional i { color: #60a5fa; }

.branch-tier {
    margin-bottom: 20px;
}

.branches-group {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 380px;
}

.branch {
    padding: 8px 12px;
    min-width: 75px;
    border-radius: 12px;
    border-color: rgba(255, 255, 255, 0.15);
    font-size: 11px;
}
.branch i { font-size: 18px; color: #cbd5e1; }

/* Packets container */
#packets-container {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.packet {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px var(--success);
    z-index: 5;
}
