:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  --sidebar-width: 250px;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* Layout */
#sidebar-container {
  width: var(--sidebar-width);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 100;
}

#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  max-width: 800px;
  width: 100%;
}

/* Header / Hamburger */
#mobile-header {
  display: none;
  padding: 1rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.hamburger {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Sidebar Styles */
.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.25rem;
  color: var(--primary);
}

.sidebar-nav {
  padding: 1rem 0;
}

.chapter-title {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem 0.5rem 2rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
}

.nav-link:hover {
  background: #e2e8f0;
}

.nav-link.active {
  background: #e0f2fe;
  color: var(--primary);
  font-weight: 500;
  border-right: 3px solid var(--primary);
}

.nav-link.disabled {
  color: var(--text-light);
  cursor: not-allowed;
  pointer-events: none;
}

.status-icon {
  margin-left: auto;
  font-size: 0.875rem;
}

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

/* Content Styles */
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin: 1.5rem 0 1rem; }
p { margin-bottom: 1rem; }
pre {
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 1rem;
}
code {
  font-family: ui-monospace, monospace;
  font-size: 0.875em;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #e2e8f0; }

/* Exercises */
.exercise-container {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}
.exercise-title {
  font-weight: 600;
  margin-bottom: 1rem;
}
.exercise-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.exercise-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.exercise-input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  min-height: 200px;
  margin-bottom: 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.875em;
  resize: vertical;
}
.exercise-feedback {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  display: none;
}
.exercise-feedback.success {
  display: block;
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #bbf7d0;
}
.exercise-feedback.error {
  display: block;
  background: #fee2e2;
  color: var(--error);
  border: 1px solid #fecaca;
}

.command-ordering-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.command-ordering-item {
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
}
.command-ordering-item:hover {
  background: #e2e8f0;
}
.command-ordering-item.selected {
  background: #e0f2fe;
  border-color: var(--primary);
  color: var(--primary);
}
.command-ordering-item.misplaced {
  background: #fee2e2;
  border-color: var(--error);
  color: var(--error);
}
.command-ordering-sequence {
  margin-bottom: 1rem;
  font-family: ui-monospace, monospace;
}

/* Progress Controls */
.progress-controls {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar-container {
    transform: translateX(-100%);
  }
  #sidebar-container.open {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0;
    padding: 1rem;
  }
  #mobile-header {
    display: flex;
  }
  body {
    flex-direction: column;
  }
}