:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.4);
    --accent-red: #f43f5e;
    --accent-red-glow: rgba(244, 63, 94, 0.4);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.4);
    --accent-purple: #a855f7;
    --accent-purple-glow: rgba(168, 85, 247, 0.4);
    --accent-amber: #f59e0b;

    --font-sans: 'Outfit', 'Inter', system-ui, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header h1 .logo-icon {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism card styles */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.control-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-cyan);
    padding-left: 0.5rem;
}

/* Option Buttons */
.scenario-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-option.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.btn-option-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.btn-option.active .btn-option-icon {
    background: rgba(6, 182, 212, 0.25);
    color: var(--accent-cyan);
}

.btn-option-text h4 {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.btn-option-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Simulation Controls */
.sim-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vpn-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

input:checked + .slider {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan-glow);
}

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

.btn-row {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-action:active {
    transform: scale(0.98);
}

/* Simulator Canvas Workspace */
.sim-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#network-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Legend Overlay */
.legend-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    display: flex;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Inspection & Console Area */
.inspect-console-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .inspect-console-grid {
        grid-template-columns: 1fr;
    }
}

/* Inspector Panel */
.packet-inspector {
    display: flex;
    flex-direction: column;
}

.packet-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.packet-info-empty {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.packet-header-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.packet-field {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.3rem;
    font-size: 0.85rem;
}

.packet-field span:first-child {
    color: var(--text-secondary);
}

.packet-field span:last-child {
    font-family: monospace;
    font-weight: bold;
}

.encrypted-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.encrypted-badge.yes {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}

.encrypted-badge.no {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

/* Console Panel */
.live-console {
    display: flex;
    flex-direction: column;
}

.console-output {
    background: #090d16;
    border-radius: 12px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    height: 160px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.console-line {
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.console-line.system {
    color: var(--text-secondary);
}

.console-line.vpn {
    color: var(--accent-cyan);
}

.console-line.unsecure {
    color: var(--accent-amber);
}

/* Educational Info Tabs */
.educational-tabs {
    margin-top: 2rem;
}

.tab-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.tab-pane p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.info-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.info-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
}

.info-card h4 {
    margin-bottom: 0.5rem;
    color: var(--accent-cyan);
}

.info-card ul {
    list-style-type: none;
    padding-left: 0;
}

.info-card li {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.info-card li::before {
    content: "•";
    color: var(--accent-cyan);
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tooltip style */
.canvas-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-cyan);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    pointer-events: none;
    display: none;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
