:root {
  /* Retro Pixel Palette */
  --bg-deep: #0a0a0a;
  --bg-dark: #1a1a1a;
  --bg-panel: #2d2d2d;
  --accent-primary: #39ff14; /* Neon Green */
  --accent-secondary: #ff00ff; /* Neon Magenta */
  --accent-tertiary: #00ffff; /* Neon Cyan */
  --accent-warning: #ffff00; /* Neon Yellow */
  --accent-danger: #ff3131; /* Neon Red */
  --text-main: #ffffff;
  --text-dim: #a0a0a0;
  
  /* Pixel Art Borders */
  --border-width: 4px;
  --pixel-shadow: 4px 4px 0px rgba(0, 0, 0, 0.5);
  
  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
}

@font-face {
  font-family: 'Pixel';
  src: url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
}

* {
  box-sizing: border-box;
  image-rendering: pixelated;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2V22L7 17H12L2 2Z' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E"), auto;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Press Start 2P', cursive, sans-serif;
  font-size: 10px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Scanline Effect */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 1000;
  background-size: 100% 4px, 3px 100%;
  pointer-events: none;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: var(--space-sm);
  gap: var(--space-sm);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr 300px;
  grid-template-rows: 1fr 300px;
  gap: var(--space-sm);
  flex-grow: 1;
}

/* Pixel Components */
.pixel-panel {
  background-color: var(--bg-panel);
  border: var(--border-width) solid var(--text-main);
  box-shadow: var(--pixel-shadow);
  padding: var(--space-sm);
  position: relative;
  overflow: hidden;
}

.pixel-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.panel-header {
  border-bottom: var(--border-width) solid var(--text-main);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--accent-tertiary);
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg-dark);
  border: var(--border-width) solid var(--accent-primary);
  margin-bottom: var(--space-sm);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-pixel {
  width: 48px;
  height: 48px;
  background: var(--accent-primary);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px;
}

.logo-pixel div { background: var(--bg-deep); }

.brand-name {
  font-size: 18px;
  color: var(--accent-primary);
  text-shadow: 4px 4px 0px var(--bg-deep);
}

.status-bar {
  display: flex;
  gap: var(--space-md);
  color: var(--accent-secondary);
}

/* Occupancy Grid */
.occupancy-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: var(--space-xs);
}

.grid-cell {
  aspect-ratio: 1;
  background: #1a1a1a;
  border: 1px solid #333;
}

.grid-cell.occupied { background: var(--accent-danger); box-shadow: inset -2px -2px 0 #800; }
.grid-cell.reserved { background: var(--accent-warning); box-shadow: inset -2px -2px 0 #880; }
.grid-cell.clear { background: var(--accent-primary); box-shadow: inset -2px -2px 0 #080; }

/* Alert System */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.alert-item {
  background: rgba(255, 49, 49, 0.1);
  border: 1px solid var(--accent-danger);
  padding: 10px;
  font-size: 11px;
  animation: blink 2s infinite;
}

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

/* Simulation View */
.sim-preview {
  position: relative;
  height: 100%;
  background: #111;
  border: 4px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rail-track {
  position: absolute;
  height: 8px;
  width: 100%;
  background: repeating-linear-gradient(90deg, #555 0px, #555 4px, transparent 4px, transparent 12px);
  top: 50%;
  transform: translateY(-50%);
}

.train-sprite {
  width: 60px;
  height: 20px;
  background: var(--accent-tertiary);
  position: absolute;
  top: calc(50% - 10px);
  left: 20%;
  border: 2px solid #fff;
  animation: move-train 10s linear infinite;
}

@keyframes move-train {
  from { left: -100px; }
  to { left: 110%; }
}

/* Buttons */
.pixel-btn {
  background: var(--accent-primary);
  color: #000;
  border: none;
  padding: 12px 24px;
  font-family: 'Press Start 2P', cursive;
  font-size: 11px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
  border-radius: 2px;
}

.pixel-btn:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 15px var(--accent-primary);
}

.pixel-btn:active {
  transform: translateY(1px);
}

.pixel-btn.secondary {
  background: transparent;
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
}

/* Charts */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 100px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text-dim);
}

.bar {
  flex: 1;
  background: var(--accent-tertiary);
  transition: height 0.3s;
}

/* Utilities */
.text-cyan { color: var(--accent-tertiary); }
.text-magenta { color: var(--accent-secondary); }
.text-green { color: var(--accent-primary); }
.text-red { color: var(--accent-danger); }
.text-warning { color: var(--accent-warning); }

.mt-md { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }

.w-full { width: 100%; }
.text-center { text-align: center; }
.font-xs { font-size: 8px; }
.font-sm { font-size: 10px; }
.font-lg { font-size: 14px; }

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

.bg-grad-dark {
  background: linear-gradient(45deg, #111, #222);
}

/* Responsive Grid */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .sim-preview-container { grid-column: span 2; }
}
