@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --consensus-color: #4a90e2;
  --data-color: #7b68ee;
  --execution-color: #50c878;
  --headliner-color: #1a1a1a;
  --warning-color: #ff6b35;
  --success-color: #28a745;
  --critical-path-color: #dc3545;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --backdrop-blur: blur(8px);
}

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

body {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: auto;
}

.header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  padding: 1rem 0;
}

.header-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-controls {
  display: flex;
  gap: 0.75rem;
}

.toolbar {
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toolbar-section label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.status-message {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

.status-message.warning {
  color: var(--warning-color);
}

.status-message.success {
  color: var(--success-color);
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: #f8f9fa;
  border-color: var(--text-secondary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: #1a1a1a;
}

.btn-secondary {
  background: var(--consensus-color);
  color: white;
  border-color: var(--consensus-color);
}

.btn-secondary:hover {
  background: #357abd;
}

.btn-outline {
  background: transparent;
  border-color: var(--text-primary);
}

.btn-small {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.main-content {
  padding: 2rem;
  min-height: calc(100vh - 200px);
}

.roadmap-container {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--shadow-light);
}

.layer-labels {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 100%;
  background: #f8f9fa;
  border-right: 2px solid var(--border-color);
  z-index: 10;
}

.layer-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  writing-mode: horizontal-tb;
}

.layer-label:last-child {
  border-bottom: none;
}

.consensus-layer {
  background: linear-gradient(135deg, var(--consensus-color), #6ba3f0);
  color: white;
}

.data-layer {
  background: linear-gradient(135deg, var(--data-color), #9b88f2);
  color: white;
}

.execution-layer {
  background: linear-gradient(135deg, var(--execution-color), #6dd68a);
  color: white;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: 140px repeat(auto-fit, minmax(200px, 1fr));
  min-height: 600px;
  margin-left: 0;
}

.fork-column {
  border-right: 1px solid var(--border-color);
  display: grid;
  grid-template-rows: auto repeat(3, 1fr);
}

.fork-column:last-child {
  border-right: none;
}

.fork-header {
  background: #f8f9fa;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.fork-complexity {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--text-secondary);
  color: white;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 12px;
  display: none;
}

.fork-complexity.show {
  display: block;
}

.layer-section {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
  min-height: 150px;
  position: relative;
  transition: background-color 0.3s ease;
}

.layer-section:last-child {
  border-bottom: none;
}

.layer-section.consensus {
  background: rgba(74, 144, 226, 0.05);
}

.layer-section.data {
  background: rgba(123, 104, 238, 0.05);
}

.layer-section.execution {
  background: rgba(80, 200, 120, 0.05);
}

.layer-section.drop-target {
  background: rgba(74, 144, 226, 0.1);
  border: 2px dashed var(--consensus-color);
}

.roadmap-item {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  cursor: grab;
  transition: all 0.3s ease;
  position: relative;
  font-size: 0.85rem;
  line-height: 1.4;
}

.roadmap-item:active {
  cursor: grabbing;
}

.roadmap-item.dragging {
  opacity: 0.7;
  transform: rotate(2deg);
  z-index: 1000;
}

.roadmap-item.headliner {
  background: var(--headliner-color);
  color: white;
  font-weight: 600;
  border-color: var(--headliner-color);
}

.roadmap-item.consensus {
  border-left: 4px solid var(--consensus-color);
}

.roadmap-item.data {
  border-left: 4px solid var(--data-color);
}

.roadmap-item.execution {
  border-left: 4px solid var(--execution-color);
}

.roadmap-item.critical-path {
  border: 2px solid var(--critical-path-color);
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.roadmap-item.has-conflicts {
  border-color: var(--warning-color);
  background: rgba(255, 107, 53, 0.1);
}

.roadmap-item.dependency-highlight {
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.item-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.roadmap-item.headliner .item-description {
  color: rgba(255, 255, 255, 0.8);
}

.dependency-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.dependency-arrow {
  stroke: var(--text-secondary);
  stroke-width: 2;
  fill: none;
  marker-end: url(#arrowhead);
  transition: all 0.3s ease;
}

.dependency-arrow.critical-path {
  stroke: var(--critical-path-color);
  stroke-width: 3;
}

.dependency-arrow.conflict {
  stroke: var(--warning-color);
  stroke-width: 3;
  stroke-dasharray: 5,5;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

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

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.help-content h4 {
  margin: 1rem 0 0.5rem 0;
  color: var(--text-primary);
}

.help-content p {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.help-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.help-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.modal-close {
  margin-left: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-section {
    justify-content: center;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .roadmap-grid {
    grid-template-columns: 100px repeat(auto-fit, minmax(180px, 1fr));
  }
  
  .layer-labels {
    width: 100px;
  }
  
  .layer-label {
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
  }
  
  .roadmap-item {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  .modal-content {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .roadmap-grid {
    grid-template-columns: 80px repeat(auto-fit, minmax(150px, 1fr));
  }
  
  .layer-labels {
    width: 80px;
  }
  
  .layer-label {
    font-size: 0.7rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
}

/* Animation keyframes */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(74, 144, 226, 0);
  }
}

.roadmap-item.highlight {
  animation: pulse 1.5s infinite;
}

.fade-in {
  animation: slideIn 0.3s ease-out;
}