/* ── PhET Scaling Base ───────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* PhET Stage — scalable container */
#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    overflow-y: auto;
    background: #020617;
    display: flex;
    flex-direction: column;
}

:root {
    --accent-cyan: #22d3ee;
    --accent-pink: #f472b6;
    --accent-indigo: #818cf8;
    --dark-bg: #020617;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-color: #f8fafc;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --grid-color: rgba(6, 182, 212, 0.1);
}

/* Premium Simulation Background */
.network-lab-theme {
    background-color: var(--dark-bg);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 80%),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 100% 100%, 50px 50px, 50px 50px;
    position: relative;
    overflow-x: hidden;
    background-attachment: fixed;
    color: var(--text-main);
}

.network-lab-theme::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 250px 250px;
    z-index: -1;
    opacity: 1;
}

/* Scanning Beam Animation */
.network-lab-theme .bg-scan-beam {
    position: fixed;
    top: -10%;
    left: 0;
    width: 100%;
    height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(6, 182, 212, 0.03), transparent);
    z-index: -1;
    animation: techScan 12s linear infinite;
    pointer-events: none;
}

@keyframes techScan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(1000%); }
}

#bgCanvas {
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%) !important;
}

/* UI Elements */
.ui-glitch-text {
    position: relative;
    display: inline-block;
}

.hud-label {
    position: absolute;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.5;
    pointer-events: none;
}

.hud-top-left { top: 35px; left: 60px; }
.hud-bottom-right { bottom: 35px; right: 60px; }

/* Navigation Overrides for Dark Mode */
nav {
    background: rgba(2, 6, 23, 0.7) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px) !important;
}

.nav-links a {
    color: var(--text-muted) !important;
}

.nav-links a:hover {
    color: var(--accent-cyan) !important;
}

.logo span {
    color: var(--text-main);
}

#sim-app {
    position: relative;
    z-index: 10;
    padding-top: 100px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* Mission Control Header */
.sim-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.sim-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.sim-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.ip-badge {
    display: inline-flex;
    padding: 6px 16px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.1);
}

.header-tech-line {
    width: 200px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-indigo), transparent);
    margin: 25px auto 0;
    border-radius: 2px;
    opacity: 0.6;
}

/* Dashboard Indicators */
.sim-indicators {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.indicator {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.indicator:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
    background: rgba(30, 41, 59, 0.9);
}

.indicator i {
    font-size: 1.1rem;
    margin-right: 12px;
}

.indicator span {
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
}

.indicator b {
    color: var(--text-main);
    margin-left: 5px;
}

/* Professional Guided Environment */
.guided-viz-container {
    height: 600px;
    background: rgba(15, 23, 42, 0.02);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 40px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    margin-top: 20px;
    box-shadow: 
        0 40px 100px -20px rgba(0, 0, 0, 0.1),
        inset 0 0 80px rgba(6, 182, 212, 0.05);
    transition: all 0.5s ease;
}

/* Background HUD Grid */
.guided-viz-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* Corner HUD Brackets */
.guided-viz-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(to right, var(--accent-cyan) 3px, transparent 3px) 0 0,
        linear-gradient(to bottom, var(--accent-cyan) 3px, transparent 3px) 0 0,
        linear-gradient(to left, var(--accent-cyan) 3px, transparent 3px) 100% 0,
        linear-gradient(to bottom, var(--accent-cyan) 3px, transparent 3px) 100% 0,
        linear-gradient(to right, var(--accent-cyan) 3px, transparent 3px) 0 100%,
        linear-gradient(to top, var(--accent-cyan) 3px, transparent 3px) 0 100%,
        linear-gradient(to left, var(--accent-cyan) 3px, transparent 3px) 100% 100%,
        linear-gradient(to top, var(--accent-cyan) 3px, transparent 3px) 100% 100%;
    background-repeat: no-repeat;
    background-size: 40px 40px;
    margin: 25px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 5;
    transition: all 0.5s ease;
}

.guided-viz-container:hover::after {
    opacity: 0.6;
    margin: 15px;
}

/* Inner Glow Scan */
.viz-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, rgba(6, 182, 212, 0.1), transparent);
    z-index: 2;
    pointer-events: none;
    animation: scanVertical 8s linear infinite;
}

@keyframes scanVertical {
    from { transform: translateY(-100px); }
    to { transform: translateY(600px); }
}

/* Advanced Node Styling */
.node-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.node {
    width: 70px;
    height: 70px;
    background: #1e293b;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    color: var(--text-main);
    transition: all 0.4s ease;
}

.node::before {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px solid transparent;
    border-radius: 50%;
    transition: all 0.4s ease;
}

.node-container.active .node {
    transform: scale(1.1);
    background: var(--accent-cyan);
    color: white;
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.6);
    border-color: var(--accent-cyan);
}

.node-container.active .node::before {
    border-color: var(--accent-cyan);
    animation: pulseCircle 2s infinite;
}

@keyframes pulseCircle {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

.node-container span {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(15, 23, 42, 0.8);
    padding: 3px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* Professional Connection Lines */
.connection-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.conn-line {
    stroke: rgba(6, 182, 212, 0.1);
    stroke-width: 4;
    stroke-linecap: round;
    transition: all 0.5s ease;
}

.conn-line.active {
    stroke: var(--accent-cyan);
    stroke-width: 6;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

/* Sleek Packet Visualization */
.packet-wrapper {
    position: absolute;
    z-index: 20;
    display: none;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.packet-dot {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    border-radius: 50%;
    box-shadow: 0 0 20px var(--accent-cyan);
    position: relative;
    border: 4px solid white;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.packet-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 0 30px var(--accent-cyan);
}

.packet-label {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: floatLabel 2s ease-in-out infinite;
}

@keyframes floatLabel {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-6px); }
}

/* Step Navigation Panel */
/* Step Navigation Panel (Floating Command Deck) */
.step-info-card {
    position: relative;
    margin: -40px auto 0; /* Pull up to float over the bottom edge */
    width: 90%;
    max-width: 800px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(15px);
    border-radius: 28px;
    padding: 25px 45px;
    z-index: 150;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        0 30px 60px -12px rgba(0,0,0,0.3),
        0 18px 36px -18px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.step-content { flex: 1; }
.step-content h2 { margin: 0 0 5px; color: var(--accent-cyan); font-size: 1.4rem; }
.step-content p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

.step-nav-btns { display: flex; gap: 12px; }

.btn-nav {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-nav:hover {
    background: var(--accent-cyan);
    color: white;
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

/* Initialization Screen (Intro) */
.guided-intro-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    text-align: center;
    transition: all 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.guided-intro-overlay h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-main);
}

.btn-start {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    color: white;
    padding: 18px 45px;
    border-radius: 20px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(6, 182, 212, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.btn-start i {
    font-size: 1.2rem;
}

.btn-start:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 20px 50px rgba(6, 182, 212, 0.4);
}

/* Feature Modules Section */
.extra-modules-container {
    margin-top: 60px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.module-card {
    background: rgba(30, 41, 59, 0.5);
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.module-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
    border-color: var(--accent-cyan);
}

.module-icon-box {
    width: 60px;
    height: 60px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.module-card h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

/* Modal Overlay & Animations */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

@keyframes modalZoom {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Module Modal & Packet Inspector Pro */
.packet-inspector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 550px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 32px;
    padding: 0; 
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 40px 100px rgba(0,0,0,0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    color: var(--text-main);
}

.packet-inspector.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.pi-header {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(99, 102, 241, 0.1));
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pi-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pi-header h3 i {
    color: var(--accent-cyan);
}

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

.pi-body {
    padding: 40px;
    max-height: 70%;
    overflow-y: auto;
}

.pi-row {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pi-label { 
    font-weight: 700; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    font-size: 0.7rem; 
    letter-spacing: 0.5px;
}

.pi-value { 
    font-family: 'Space Grotesk', monospace; 
    font-weight: 700; 
    color: var(--accent-cyan); 
    background: rgba(6, 182, 212, 0.08);
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.15);
    font-size: 0.9rem;
}

.gradient-text-cyan {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Module Chips & Additional Info */
.module-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.module-chip {
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.module-chip i {
    color: var(--accent-cyan);
}

.module-chip:hover {
    background: var(--accent-cyan);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(6, 182, 212, 0.2);
}

.module-chip:hover i {
    color: white;
}

/* Modal Content Styles */
.module-content-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.module-content-table th, .module-content-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.module-content-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.module-visual-box {
    background: rgba(6, 182, 212, 0.05);
    border-left: 4px solid var(--accent-cyan);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    margin: 20px 0;
}

.module-visual-box h4 {
    margin: 0 0 10px;
    color: var(--text-main);
}

/* Results & Summary */
.result-summary {
    padding: 40px;
    text-align: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    border: 2px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.summary-item {
    background: rgba(16, 185, 129, 0.1);
    padding: 20px;
    border-radius: 16px;
    color: #10b981;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.summary-item i {
    color: #10b981;
}

/* Node Icon Specifics */
.computer-node { color: #3b82f6; }
.laptop-node { color: #6366f1; }
.router-node { color: #f59e0b; }
.dns-node { color: #8b5cf6; }
.isp-node { color: #ec4899; }
.webserver-node { color: #10b981; }

.node-ip {
    font-size: 0.7rem;
    font-family: 'Space Grotesk', monospace;
    color: var(--text-muted);
    opacity: 0.8;
}
