.simulator-canvas-container {
  display: flex;
  height: 100%;
  position: relative;
}

.simulator-canvas {
  flex: 1;
  background-color: #1a1a1a;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
}

/* ── Canvas header ───────────────────────────────── */
.canvas-header {
  height: 46px;
  padding: 0 10px;
  background: #252526;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.canvas-header-left,
.canvas-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Status LED dot ──────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.running {
  background: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.7);
  animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.stopped {
  background: #555;
  box-shadow: none;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(76, 175, 80, 0.5); }
  50%       { box-shadow: 0 0 10px rgba(76, 175, 80, 0.9); }
}

/* ── Board Selector ──────────────────────────────── */
.board-selector {
  padding: 4px 8px;
  background: #1e2a38;
  color: #c9d1d9;
  border: 1px solid #3a4a5a;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
  height: 32px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}

.board-selector:hover:not(:disabled) {
  border-color: #007acc;
}

.board-selector:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Serial Monitor button ───────────────────────── */
.canvas-serial-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  background: transparent;
  border: 1px solid #3a4a5a;
  border-radius: 5px;
  color: #9d9d9d;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.canvas-serial-btn:hover {
  border-color: #007acc;
  color: #ccc;
}

.canvas-serial-btn-active {
  background: #0e3a5a;
  border-color: #007acc;
  color: #4fc3f7;
}

/* ── Component count ─────────────────────────────── */
.component-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
}

/* ── Add Component button ────────────────────────── */
.add-component-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  background: #007acc;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.add-component-btn:hover:not(:disabled) {
  background: #1a8bd4;
}

.add-component-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Canvas content (viewport) ───────────────────── */
.canvas-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #1a1a1a;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255,255,255,0.025) 19px, rgba(255,255,255,0.025) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(255,255,255,0.025) 19px, rgba(255,255,255,0.025) 20px);
  user-select: none;
  touch-action: none; /* Disable browser scroll/zoom so JS handlers take full control */
}

/* ── Infinite canvas world ───────────────────────── */
.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  width: 4000px;
  height: 3000px;
}

/* ── Components area ─────────────────────────────── */
.components-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* ── Zoom controls ───────────────────────────────── */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  padding: 0 2px;
  height: 28px;
}

.zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: #9d9d9d;
  cursor: pointer;
  flex-shrink: 0;
}

.zoom-btn:hover {
  background: #3a3a3a;
  color: #ccc;
}

.zoom-level {
  min-width: 42px;
  text-align: center;
  background: transparent;
  border: none;
  color: #9d9d9d;
  font-size: 11px;
  font-family: monospace;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
}

.zoom-level:hover {
  background: #3a3a3a;
  color: #ccc;
}

.component-label {
  font-size: 11px;
  background-color: #252526;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 5px;
  text-align: center;
  color: #aaa;
}
