@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&family=Rajdhani:wght@400;600;700&display=swap');

:root {
    --bg-dark: #020408;
    --bg-darker: #010203;
    --neon-green: #00ff41;
    --neon-blue: #00d4ff;
    --neon-purple: #bf00ff;
    --neon-red: #ff003c;
    --neon-orange: #ff6b00;
    --glass-bg: rgba(0, 20, 10, 0.75);
    --glass-border: rgba(0, 255, 65, 0.25);
    --glass-border-hover: rgba(0, 255, 65, 0.6);
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
    --scanline-color: rgba(0, 255, 65, 0.03);
}

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

body {
    background-color: var(--bg-dark);
    color: #c8ffc8;
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   MATRIX RAIN CANVAS BACKGROUND
   ============================================ */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.15;
}

/* Scan lines overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        var(--scanline-color) 2px,
        var(--scanline-color) 4px
    );
    pointer-events: none;
    animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

/* Vignette */
.vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
}

/* ============================================
   HERO / HEADER
   ============================================ */
.hero {
    text-align: center;
    padding: 25px 20px 20px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.3);
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(0, 255, 65, 0.05) 0%, transparent 100%);
}

.hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon-green), var(--neon-blue), var(--neon-green), transparent);
    animation: borderPulse 3s linear infinite;
}

@keyframes borderPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.hero-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--neon-red);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 8px;
    animation: blink 2s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: glitch 5s infinite;
    position: relative;
}

.hero h1 .neon-red {
    color: var(--neon-red);
    text-shadow: 0 0 10px var(--neon-red), 0 0 30px rgba(255, 0, 60, 0.5);
}

.hero h1 .neon-green {
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green), 0 0 30px rgba(0, 255, 65, 0.4);
}

/* Glitch effect for title */
@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); filter: none; }
    92% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
    94% { transform: translate(2px, -1px); filter: hue-rotate(-90deg); }
    96% { transform: translate(-1px, 2px); }
    98% { transform: translate(1px, -2px); filter: none; }
}

.hero-subtitle {
    font-family: var(--font-mono);
    color: rgba(0, 212, 255, 0.7);
    font-size: 0.85rem;
    letter-spacing: 3px;
    margin-top: 8px;
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-red);
    box-shadow: 0 0 8px var(--neon-red);
    animation: pulse-red 1s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 20px;
    height: calc(100vh - 115px);
}

/* ============================================
   GLASS PANELS
   ============================================ */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 20px;
    box-shadow:
        0 0 20px rgba(0, 255, 65, 0.08),
        inset 0 0 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

/* Corner accents */
.glass-panel::before, .glass-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--neon-green);
    border-style: solid;
}
.glass-panel::before {
    top: 4px; left: 4px;
    border-width: 1px 0 0 1px;
}
.glass-panel::after {
    bottom: 4px; right: 4px;
    border-width: 0 1px 1px 0;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
}

.sidebar-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--neon-blue);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--neon-blue);
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    margin-bottom: 5px;
}

#protocol-nav {
    display: flex;
    flex-direction: column;
    gap: 27px;
}

/* ============================================
   CYBER BUTTONS
   ============================================ */
.cyber-btn {
    background: transparent;
    color: rgba(0, 255, 65, 0.7);
    border: 1px solid rgba(0, 255, 65, 0.3);
    padding: 11px 14px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    text-align: left;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.cyber-btn::before {
    content: '//';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neon-green);
    font-size: 0.75rem;
    transition: left 0.2s ease;
}

.cyber-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    color: var(--neon-green);
    border-color: var(--neon-green);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2), inset 0 0 15px rgba(0, 255, 65, 0.05);
    text-shadow: 0 0 8px var(--neon-green);
    padding-left: 22px;
}

.cyber-btn:hover::before {
    left: 8px;
}

.cyber-btn.active {
    background: rgba(0, 255, 65, 0.15);
    color: var(--neon-green);
    border-color: var(--neon-green);
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.3), inset 0 0 20px rgba(0, 255, 65, 0.08);
    text-shadow: 0 0 10px var(--neon-green);
    padding-left: 22px;
}

.cyber-btn.active::before {
    left: 8px;
}

/* ============================================
   SIMULATION AREA
   ============================================ */
.simulation-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Info Panel */
.info-panel {
    padding: 16px 20px;
    border-left: 3px solid var(--neon-blue);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.panel-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 2px 8px;
    letter-spacing: 2px;
}

#info-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    letter-spacing: 1px;
}

#info-desc {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: rgba(200, 255, 200, 0.6);
    line-height: 1.6;
}

/* ============================================
   NETWORK CANVAS
   ============================================ */
.network-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-color: rgba(0, 255, 65, 0.15);
}

/* Hex grid background for canvas */
.network-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}

/* NODE STYLES */
.node {
    position: absolute;
    width: 90px;
    height: 90px;
    background: rgba(0, 10, 5, 0.85);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: bold;
    color: rgba(0, 212, 255, 0.7);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.15),
        inset 0 0 15px rgba(0, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
    z-index: 5;
    clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
    cursor: default;
}

.node::before {
    content: '◈';
    position: absolute;
    top: -2px;
    right: 4px;
    font-size: 0.6rem;
    color: var(--neon-blue);
    opacity: 0.5;
}

.node.active {
    background: rgba(0, 30, 15, 0.95);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow:
        0 0 30px rgba(0, 255, 65, 0.4),
        0 0 60px rgba(0, 255, 65, 0.15),
        inset 0 0 20px rgba(0, 255, 65, 0.1);
    text-shadow: 0 0 10px var(--neon-green);
    animation: nodeActivePulse 1s ease-in-out infinite alternate;
}

@keyframes nodeActivePulse {
    from { box-shadow: 0 0 25px rgba(0, 255, 65, 0.3), inset 0 0 15px rgba(0, 255, 65, 0.05); }
    to   { box-shadow: 0 0 45px rgba(0, 255, 65, 0.5), inset 0 0 25px rgba(0, 255, 65, 0.12); }
}

/* PACKET STYLES */
.packet {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--neon-purple);
    border-radius: 50%;
    box-shadow:
        0 0 10px var(--neon-purple),
        0 0 25px rgba(191, 0, 255, 0.5);
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: top 1.5s ease-in-out, left 1.5s ease-in-out;
}

.packet::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 200%;
    height: 200%;
    border: 1px solid rgba(191, 0, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: packetRing 1s ease-out infinite;
}

@keyframes packetRing {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.packet.secure {
    background: var(--neon-green);
    box-shadow: 0 0 12px var(--neon-green), 0 0 30px rgba(0, 255, 65, 0.5);
    border-radius: 2px;
    width: 14px;
    height: 14px;
}

.packet.secure::after {
    border-color: rgba(0, 255, 65, 0.3);
}

/* ============================================
   TERMINAL
   ============================================ */
.terminal {
    height: 210px;
    background: rgba(0, 5, 2, 0.97);
    border-color: rgba(0, 255, 65, 0.2);
    display: flex;
    flex-direction: column;
    padding: 0;
    font-size: 0.82rem;
}

.terminal-header {
    background: rgba(0, 15, 8, 0.95);
    padding: 8px 15px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}
.dot.red    { background: #ff5f56; box-shadow: 0 0 4px #ff5f56; }
.dot.yellow { background: #ffbd2e; box-shadow: 0 0 4px #ffbd2e; }
.dot.green  { background: #27c93f; box-shadow: 0 0 4px #27c93f; }

.term-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-green);
    margin-left: 8px;
    text-shadow: 0 0 6px var(--neon-green);
    letter-spacing: 1px;
}

.term-right {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(0, 255, 65, 0.4);
    letter-spacing: 2px;
}

.terminal-body {
    padding: 12px 16px;
    font-family: var(--font-mono);
    color: var(--neon-green);
    overflow-y: auto;
    flex: 1;
    line-height: 1.5;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}
.terminal-body::-webkit-scrollbar-track {
    background: rgba(0, 255, 65, 0.05);
}
.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 65, 0.3);
    border-radius: 2px;
}

.log-line {
    margin-bottom: 3px;
    font-size: 0.78rem;
    opacity: 0;
    animation: fadeInLine 0.2s forwards;
}

@keyframes fadeInLine {
    from { opacity: 0; transform: translateX(-5px); }
    to   { opacity: 1; transform: translateX(0); }
}

.log-line::before {
    content: '❯ ';
    color: var(--neon-blue);
    font-size: 0.7rem;
}

.log-line.sys-line::before {
    content: '⚡ ';
    color: var(--neon-red);
}

/* ============================================
   NEON COLORS
   ============================================ */
.neon-purple { color: var(--neon-purple); text-shadow: 0 0 12px var(--neon-purple); }
.neon-green  { color: var(--neon-green);  text-shadow: 0 0 12px var(--neon-green); }
.neon-blue   { color: var(--neon-blue);   text-shadow: 0 0 12px var(--neon-blue); }
.neon-red    { color: var(--neon-red);    text-shadow: 0 0 12px var(--neon-red); }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-darker); }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 65, 0.25); border-radius: 2px; }