:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Dark Theme */
    --bg-dark: #0f172a;
    --card-bg-dark: rgba(30, 41, 59, 0.7);
    --text-dark: #f8fafc;
    --text-muted-dark: #94a3b8;
    --border-dark: rgba(255, 255, 255, 0.1);
    
    /* Light Theme */
    --bg-light: #f1f5f9;
    --card-bg-light: rgba(255, 255, 255, 0.7);
    --text-light: #0f172a;
    --text-muted-light: #64748b;
    --border-light: rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text-dark);
    background-color: var(--bg-dark);
    transition: background-color 0.5s ease;
}

body.light-theme {
    color: var(--text-light);
    background-color: var(--bg-light);
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blob-float 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    top: 50%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.list-type-toggle {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 12px;
    display: flex;
    gap: 0.25rem;
}

.light-theme .list-type-toggle {
    background: rgba(0, 0, 0, 0.05);
}

.type-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.type-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Glassmorphism */
.glass {
    background: var(--card-bg-dark);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-dark);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.light-theme .glass {
    background: var(--card-bg-light);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

/* Visualizer Section */
.visualizer-section {
    position: relative;
}

#canvas-container {
    width: 100%;
    height: 400px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    cursor: grab;
}

#canvas-container:active {
    cursor: grabbing;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    border: none;
    transition: var(--transition);
}

.primary-btn { background: var(--primary); color: white; }
.primary-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

.secondary-btn { background: var(--secondary); color: white; }
.secondary-btn:hover { opacity: 0.9; transform: translateY(-2px); }

.accent-btn { background: var(--accent); color: white; }
.accent-btn:hover { opacity: 0.9; transform: translateY(-2px); }

.danger-btn { background: var(--danger); color: white; }
.danger-btn:hover { opacity: 0.9; transform: translateY(-2px); }

.info-btn { background: var(--info); color: white; }
.info-btn:hover { opacity: 0.9; transform: translateY(-2px); }

.danger-outline-btn {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
}
.danger-outline-btn:hover {
    background: var(--danger);
    color: white;
}

.icon-btn {
    padding: 0.75rem;
    background: var(--border-dark);
    color: inherit;
    border-radius: 50%;
}

.light-theme .icon-btn {
    background: var(--border-light);
}

/* Controls */
.visualizer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.control-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 16px;
}

.light-theme .control-group {
    background: rgba(0, 0, 0, 0.05);
}

input {
    width: 100px;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-dark);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    font-family: inherit;
    outline: none;
}

.light-theme input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

input:focus {
    border-color: var(--primary);
}

/* Info Section */
.info-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-dark);
}

.panel-header span {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #a5b4fc;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-item label {
    font-size: 0.8rem;
    color: var(--text-muted-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-item span {
    font-size: 1.25rem;
    font-weight: 700;
}

/* SVG Styles */
#visualizer-svg {
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.2));
}

.node-group {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.node-circle {
    fill: url(#nodeGradient);
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.node-text {
    fill: white;
    font-weight: 700;
    pointer-events: none;
}

.node-pointer {
    stroke: var(--text-muted-dark);
    stroke-width: 2;
}

.node-pointer-arrow {
    fill: var(--text-muted-dark);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.node-group.new {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Responsive */
@media (max-width: 900px) {
    .info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .app-container { padding: 1rem; }
    .visualizer-controls { flex-direction: column; }
    .control-group { width: 100%; justify-content: center; }
    input { width: 100%; }
}
