/* Modern Visual Synthesizer UI */
:root {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --bg-tertiary: #363636;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #404040;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Toolbar */
#toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  z-index: 100;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.logo img {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
}

.logo .material-icons {
  color: var(--accent-primary);
  font-size: 24px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toolbar-select {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  cursor: pointer;
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Fallback notification animation */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.update-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  cursor: help;
}

.update-status .material-icons {
  font-size: 16px;
  color: var(--accent-primary);
  animation: pulse 2s ease-in-out infinite;
}

.update-status.checking .material-icons {
  animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

.update-status.available {
  background: rgba(255, 193, 7, 0.2);
  border-color: #ffc107;
}

.update-status.available .material-icons {
  color: #ffc107;
  animation: bounce 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  60% { transform: translateY(-1px); }
}

/* Main Content */
#main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebars */
#left-sidebar, #right-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#right-sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Node Properties Section Styling */
.sidebar-header.node-section {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.sidebar-header.node-section .material-icons {
  color: white;
}

/* View Controls Section Styling */
.sidebar-header.view-section {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  margin-top: 20px;
}

.sidebar-header.view-section .material-icons {
  color: white;
}

.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

/* View Control Styling */
.sidebar-section.view-control {
  background: rgba(5, 150, 105, 0.05);
  border-left: 3px solid #059669;
}

.view-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.view-label .material-icons {
  font-size: 18px;
  color: #059669;
}

.help-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

.current-value-display {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--accent-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
}

.sidebar-section h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Node Categories */
.node-category {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.node-category h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-icon {
  font-size: 16px;
}

.category-description {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-style: italic;
}

/* Control Inputs Category - Special Styling */
.control-inputs-category {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--border-radius);
  margin: 8px;
  padding: 16px;
}

.control-inputs-category h4 {
  color: var(--accent-primary);
  font-weight: 600;
}

.control-inputs-category .category-description {
  color: rgba(99, 102, 241, 0.8);
}

.control-input-node {
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
}

.control-input-node:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

.node-palette {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-width: 0;
}

.palette-node:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.palette-node .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

.palette-node:hover .material-icons {
  color: var(--text-primary);
}

.palette-node span:last-child {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Center Area */
#center-area {
  flex: 1;
  position: relative;
  background: var(--bg-primary);
  overflow: hidden;
}

#glcanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

/* Node Graph */
#node-graph {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#node-graph.visible {
  opacity: 1;
  pointer-events: all;
}

#connections-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Graph Nodes */
.graph-node {
  position: absolute;
  min-width: 140px;
  max-width: 180px;
  background: #2a2a2a !important;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  cursor: move;
  user-select: none;
  /* Enhanced transitions for smooth auto-layout animations */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease,
              opacity 0.2s ease;
}

/* Ensure all node children have solid backgrounds */
.graph-node * {
  background-color: inherit !important;
}

/* Node Type Specific Styling */
.graph-node.source {
  border-color: #10b981; /* Green for sources */
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.graph-node.source .node-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(16, 185, 129, 0.2) 100%);
  border-bottom-color: rgba(16, 185, 129, 0.3);
}

.graph-node.effect {
  border-color: #f59e0b; /* Orange for effects */
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.graph-node.effect .node-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(245, 158, 11, 0.2) 100%);
  border-bottom-color: rgba(245, 158, 11, 0.3);
}

.graph-node.composite {
  border-color: #8b5cf6; /* Purple for compositing */
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.graph-node.composite .node-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(139, 92, 246, 0.2) 100%);
  border-bottom-color: rgba(139, 92, 246, 0.3);
}

.graph-node.video {
  border-color: #ec4899; /* Pink for video */
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(236, 72, 153, 0.1) 100%);
}

.graph-node.video .node-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(236, 72, 153, 0.2) 100%);
  border-bottom-color: rgba(236, 72, 153, 0.3);
}

.graph-node.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4), var(--shadow);
}

.graph-node.disabled {
  opacity: 0.5;
}

.graph-node.main-output {
  border-color: #10b981;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3), var(--shadow);
}

.graph-node.main-output .node-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(16, 185, 129, 0.2) 100%);
  border-bottom-color: rgba(16, 185, 129, 0.4);
}

.graph-node.main-output .node-header::after {
  content: '🎬';
  font-size: 14px;
  margin-left: auto;
}

.node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #333333 !important;
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Node & palette icons – constrain width so fallback text
   like "motion_blur" can't push titles off-screen */
.node-icon,
.palette-node .material-icons {   /* covers both graph & sidebar */
  font-size: 16px;
  color: var(--accent-primary);

  /* NEW – the actual fix */
  width: 20px;            /* hard cap the box */
  min-width: 20px;
  display: inline-flex;   /* keep icon centered */
  justify-content: center;
  overflow: hidden;       /* hide any stray text */
  flex-shrink: 0;         /* don't let it collapse either */
}

.node-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-enabled {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.node-enabled.checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.node-enabled .material-icons {
  font-size: 12px;
  color: white;
  line-height: 1;
}

.node-delete {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s ease;
  opacity: 0;
}

.graph-node:hover .node-delete {
  opacity: 1;
}

.node-delete:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.node-body {
  padding: 10px 8px;
  background: #2a2a2a !important;
}

/* Node Ports */
.node-ports {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.node-port {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 0;
  font-weight: 500;
}

.port {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.port.input {
  background: var(--bg-primary);
}

.port.output {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.port:hover {
  transform: scale(1.15);
  border-color: var(--accent-primary);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.port.connected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
}

/* Connections */
.connection {
  stroke: var(--accent-primary);
  stroke-width: 2;
  fill: none;
  opacity: 0.8;
  cursor: grab;
  transition: all 0.2s ease;
}

.connection:hover {
  stroke-width: 3;
  opacity: 1;
}

.connection.selected {
  stroke: var(--accent-secondary);
  stroke-width: 3;
  opacity: 1;
}

.control-connection {
  stroke: #8b5cf6;
  stroke-dasharray: 4 4;
  stroke-width: 2;
  opacity: 0.8;
}

/* Graph Controls */
#graph-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

/* Mini-map */
#mini-map {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  z-index: 50;
  backdrop-filter: blur(10px);
}

.mini-map-header {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

#mini-map-content {
  position: relative;
  width: 100%;
  height: calc(100% - 32px);
  overflow: hidden;
}

#mini-map-viewport {
  position: absolute;
  border: 2px solid var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  pointer-events: auto;
  cursor: grab;
  min-width: 10px;
  min-height: 10px;
}

.graph-btn {
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.graph-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.graph-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Properties Panel */
#properties-panel {
  flex: 1;
  padding: 20px;
}

.properties-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 40px;
}

.property-group {
  margin-bottom: 24px;
}

.property-group h5 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.property-group h6 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.property-group h6 .material-icons {
  font-size: 14px;
}

/* Node Properties Panel Redesign */
#properties-panel .node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

#properties-panel .node-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.node-type-badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-icon {
  margin-right: 6px;
  font-size: 14px;
}

/* Connection Fields */
.connection-field {
  margin-bottom: 12px;
}

.connection-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: capitalize;
}

.connection-select,
.control-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.connection-select:hover,
.control-select:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.connection-select:focus,
.control-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Output Connections */
.output-connections-list {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 8px;
}

.output-connection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.15s ease;
}

.output-connection-item:hover {
  background: var(--bg-tertiary);
}

.connection-arrow {
  color: var(--accent-primary);
  font-weight: 600;
}

.connection-target {
  color: var(--text-primary);
  font-weight: 500;
}

.connection-input {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Visual Preview Section */
.preview-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 12px;
}

.preview-inputs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-output {
  display: flex;
  justify-content: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.preview-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.preview-canvas {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  display: block;
}

.preview-canvas.empty {
  opacity: 0.5;
}

/* I/O Preview Section */
.io-preview-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px;
  margin-bottom: 16px;
}

.io-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.io-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}

.io-preview-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.io-preview-canvas {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #000;
  display: block;
  cursor: pointer;
}

.io-preview-canvas:hover {
  border-color: var(--accent-primary);
}

.io-connection-status {
  font-size: 9px;
  font-weight: 500;
  text-align: center;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
}

.io-connection-status.connected {
  color: var(--success-color);
  background: rgba(34, 197, 94, 0.1);
}

.io-connection-status.disconnected {
  color: var(--text-muted);
  background: var(--bg-tertiary);
}

.output-preview .io-connection-status {
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.property-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.property-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.property-input {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
}

.property-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.property-slider {
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

.property-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

.property-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Dual input container for slider + number input */
.dual-input-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dual-input-container .property-slider {
  flex: 1;
}

.dual-input-container .property-number {
  width: 60px;
  padding: 4px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  text-align: center;
}

.dual-input-container .property-number:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Groups */
.group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-bottom: 8px;
}

.group-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.group-copy-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
}

.group-copy-btn:hover {
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.group-copy-btn .material-icons {
  font-size: 16px;
}

.group-toggle {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-radius: 2px;
  cursor: pointer;
}

.group-toggle.enabled {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Control Ports */
.control-ports-section {
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 8px;
}

.control-ports-header {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.control-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 8px;
  line-height: 1;
  padding: 1px 3px;
  min-width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.control-toggle:hover {
  background: var(--accent-primary);
  color: var(--text-primary);
}

.control-ports-list.collapsible.collapsed {
  display: none;
}

.control-ports-list.collapsible {
  transition: all 0.2s ease;
}

.control-port {
  margin: 2px 0;
}

.control-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 70px;
  font-weight: 500;
}

.port.control-input {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.port.control-input.connected {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

/* Input nodes styling */
.graph-node.input {
  border-color: #8b5cf6;
}

.graph-node.input .node-header {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* System nodes styling */
.graph-node.system {
  border-color: #ef4444;
  border-width: 2px;
}

.graph-node.system .node-header {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.graph-node.system .node-title {
  font-weight: 600;
}

/* MIDI Info */
.midi-info {
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 13px;
}

#midi-cc {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Control Input Mapping */
.control-inputs-container {
  margin-top: 8px;
}

.control-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
}

.control-toggle:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.control-icon {
  font-size: 12px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

.control-inputs {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: center;
  padding-left: 4px;
  border-left: 2px solid var(--border-color);
  margin-left: 12px;
}

.map-midi-btn {
  padding: 4px 8px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-midi-btn:hover {
  background: var(--accent-secondary);
}

.map-audio-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
}

.map-audio-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.map-color-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
}

.map-color-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.map-cursor-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
}

.map-cursor-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.map-camera-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
}

.map-camera-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Consolidated mapping dropdown */
.consolidated-mapping-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  min-width: 160px;
  flex: 1;
}

.consolidated-mapping-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Color Palette Preview */
.color-palette-preview {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  padding: 4px;
  background: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.mapping-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-bottom: 4px;
  font-size: 12px;
}

.mapping-item span {
  color: var(--text-secondary);
}

.remove-mapping {
  background: #ef4444;
  border: none;
  border-radius: 50%;
  color: white;
  width: 18px;
  height: 18px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-mapping:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.mapping-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

.remove-all-mappings {
  background: #ef4444;
  border: none;
  border-radius: var(--border-radius-sm);
  color: white;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.remove-all-mappings:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Audio Visual Meters */
.audio-meters {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.meter-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
}

.meter-group:last-child {
  margin-bottom: 0;
}

.meter-group label {
  color: var(--text-secondary);
  min-width: 50px;
}

.level-meter {
  flex: 1;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  margin-left: 8px;
  overflow: hidden;
}

.level-bar {
  height: 100%;
  width: 0%;
  background: #10b981;
  transition: width 0.1s ease-out;
  border-radius: 4px;
}

.lufs-display {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
  color: var(--text-primary);
}

/* Project Management Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.small {
  max-width: 400px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.modal-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Projects List */
#projects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-item:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.project-info {
  flex: 1;
}

.project-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.project-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

.project-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.project-item:hover .project-actions {
  opacity: 1;
}

.project-action-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.project-action-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.project-action-btn.delete:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.projects-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 40px 20px;
}

/* Project status indicators */
.project-item.current {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.project-item.current .project-name::after {
  content: ' (Current)';
  color: var(--accent-primary);
  font-weight: 400;
  font-size: 14px;
}

/* Auto-Update System */
.update-notification {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.update-content {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3), var(--shadow-lg);
  padding: 24px;
  max-width: 400px;
  text-align: center;
  animation: slideIn 0.4s ease;
}

.update-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.update-header .material-icons {
  font-size: 32px;
  color: var(--accent-primary);
}

.update-header .material-icons.updating {
  animation: spin 1s linear infinite;
}

.update-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
}

.update-content p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.update-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.update-actions .create-btn {
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.update-actions .create-btn:hover {
  background: var(--accent-secondary);
}

.update-actions .toolbar-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.update-actions .toolbar-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.update-actions .default-action {
  background: var(--accent-primary) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), var(--shadow) !important;
  animation: pulse-save 2s infinite;
}

.update-note {
  margin-top: 12px;
  text-align: center;
  color: var(--text-secondary);
}

.update-note small {
  color: #4ade80;
  font-weight: 500;
}

@keyframes pulse-save {
  0% { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3), var(--shadow-lg); }
  100% { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), var(--shadow); }
}

/* Temporary Notifications */
.temp-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--border-radius);
  padding: 12px 20px;
  color: var(--text-primary);
  font-weight: 500;
  z-index: 1500;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
}

.temp-notification.visible {
  opacity: 1;
  transform: translateX(0);
}

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

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Canvas info styling */
.canvas-display-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.current-display {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: monospace;
}

#current-display-node {
  color: var(--accent-primary);
  font-weight: 500;
}

/* Control Input Manager styling */
.control-input-manager {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-input-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-input-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-input-status {
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

#control-input-status.success {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#control-input-status.error {
  color: #ef4444;
  border-color: #ef4444;
}

/* Responsive */
@media (max-width: 1200px) {
  #left-sidebar, #right-sidebar {
    width: 240px;
  }
}

@media (max-width: 900px) {
  #left-sidebar, #right-sidebar {
    width: 200px;
  }
  
  .palette-node span:last-child {
    display: none;
  }
}