/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Monmouth Hawks Blue Theme */
  --mu-blue-dark: #002D72;
  --mu-blue: #003DA5;
  --mu-blue-light: #1a5cb8;
  --mu-blue-lighter: #e8f0fe;
  --mu-gray-50: #f8f9fa;
  --mu-gray-100: #f1f3f5;
  --mu-gray-200: #e9ecef;
  --mu-gray-300: #dee2e6;
  --mu-gray-400: #ced4da;
  --mu-gray-500: #adb5bd;
  --mu-gray-700: #495057;
  --mu-gray-900: #212529;

  --bg-primary: #ffffff;
  --bg-secondary: var(--mu-gray-50);
  --bg-tertiary: var(--mu-gray-100);
  --bg-hover: var(--mu-gray-200);
  --border-color: var(--mu-gray-300);
  --text-primary: var(--mu-gray-900);
  --text-secondary: var(--mu-gray-700);
  --text-bright: var(--mu-blue-dark);
  --accent-blue: var(--mu-blue);
  --accent-green: #198754;
  --accent-red: #dc3545;
  --accent-yellow: #856404;
  --accent-orange: #b45309;
  --pass-green: #198754;
  --fail-red: #dc3545;
  --tab-active: #ffffff;
  --tab-inactive: var(--mu-gray-100);
  --header-height: 56px;
  --output-height: 250px;
  --sidebar-left: 240px;
  --sidebar-right: 445px;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

/* Header */
#header {
  height: var(--header-height);
  background: var(--mu-blue-dark);
  border-bottom: 2px solid var(--mu-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 40px;
  width: auto;
}

#header h1 {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

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

/* Buttons */
.btn {
  padding: 6px 16px;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-run {
  background: var(--mu-blue);
  color: white;
}
.btn-run:hover { background: var(--mu-blue-light); }
.btn-run:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-check {
  background: var(--accent-green);
  color: white;
}
.btn-check:hover { background: #157347; }
.btn-check:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small {
  padding: 4px 10px;
  font-size: 11px;
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-small:hover { background: var(--mu-gray-200); }

.btn-danger {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* Main Layout */
#main {
  display: grid;
  grid-template-columns: var(--sidebar-left) 1fr var(--sidebar-right);
  height: calc(100vh - var(--header-height) - var(--output-height));
  overflow: hidden;
}

/* Guide Panel (Left Sidebar) */
#guide-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 12px;
}

#guide-panel h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mu-blue);
  font-weight: 700;
  margin-bottom: 12px;
}

.guide-step {
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: background 0.15s;
}
.guide-step:hover { background: var(--bg-hover); }
.guide-step.active { background: var(--mu-blue-lighter); border-left: 3px solid var(--mu-blue); }

.guide-step .step-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  margin-top: 1px;
}
.guide-step.completed .step-icon {
  background: var(--pass-green);
  border-color: var(--pass-green);
  color: white;
}
.guide-step.current .step-icon {
  border-color: var(--mu-blue);
  color: var(--mu-blue);
}

.step-content { flex: 1; }
.step-title { font-weight: 600; font-size: 12px; color: var(--text-primary); }
.step-desc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.step-file { font-size: 10px; color: var(--accent-blue); margin-top: 3px; font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace; }

.hint-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 11px;
  background: var(--mu-blue-lighter);
  color: var(--mu-blue);
  border: 1px solid var(--mu-blue);
  border-radius: 3px;
  cursor: pointer;
}
.hint-btn:hover { background: var(--mu-gray-200); }

.hint-content {
  margin-top: 6px;
  padding: 8px;
  background: var(--mu-gray-100);
  border-left: 3px solid var(--mu-blue);
  border-radius: 0 4px 4px 0;
  font-size: 11px;
  color: var(--mu-gray-900);
  white-space: pre-wrap;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  display: none;
}
.hint-content.visible { display: block; }

/* Editor Panel (Center) */
#editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#file-tabs {
  display: flex;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.file-tab {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--tab-inactive);
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.file-tab:hover { color: var(--text-primary); }
.file-tab.active {
  background: var(--tab-active);
  color: var(--mu-blue-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--mu-blue);
}

#monaco-editor {
  flex: 1;
  overflow: hidden;
}

/* UML Panel (Right Sidebar) */
#uml-panel {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

#uml-panel h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mu-blue);
  font-weight: 700;
  margin-bottom: 12px;
}

#uml-diagram {
  flex: 1;
}

/* Survey QR Box */
.survey-box {
  text-align: center;
  padding: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
}

.survey-box h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mu-blue);
  font-weight: 700;
  margin-bottom: 8px;
}

.survey-qr {
  width: 140px;
  height: 140px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.survey-link {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--mu-blue);
  text-decoration: none;
}
.survey-link:hover { text-decoration: underline; }

#uml-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* Output Panel (Bottom) */
#output-panel {
  height: var(--output-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

#output-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.output-tab {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.output-tab:hover { color: var(--text-primary); }
.output-tab.active {
  color: var(--mu-blue-dark);
  font-weight: 600;
  border-bottom-color: var(--mu-blue);
}

#exec-status {
  margin-left: auto;
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-secondary);
}
#exec-status.running { color: var(--accent-yellow); }
#exec-status.success { color: var(--pass-green); }
#exec-status.error { color: var(--fail-red); }

#output-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}

.output-area {
  display: none;
  white-space: pre-wrap;
  word-break: break-all;
}
.output-area.active { display: block; }

/* Test Results */
.test-result {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}
.test-result:last-child { border-bottom: none; }

.test-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.test-icon { font-size: 14px; }
.test-pass .test-icon { color: var(--pass-green); }
.test-fail .test-icon { color: var(--fail-red); }

.test-name { font-weight: 600; }
.test-detail {
  margin-top: 4px;
  padding-left: 22px;
  font-size: 11px;
  color: var(--text-secondary);
}
.test-hint {
  margin-top: 4px;
  padding-left: 22px;
  font-size: 11px;
  color: var(--accent-yellow);
}

/* Group headings in test results */
.test-group-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-top: 12px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}
.test-group-heading:first-child { margin-top: 0; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--mu-gray-100); }
::-webkit-scrollbar-thumb { background: var(--mu-gray-400); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--mu-gray-500); }

/* Progress Tracker */
#progress-tracker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

.progress-sep {
  color: rgba(255,255,255,0.4);
}

#progress-bar {
  width: 80px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Read-only file tab indicator */
.file-tab .lock-icon {
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.5;
}

.file-tab .todo-count {
  font-size: 10px;
  margin-left: 4px;
  background: var(--accent-yellow);
  color: #1e1e1e;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: bold;
}

.file-tab .todo-done {
  font-size: 10px;
  margin-left: 4px;
  color: var(--pass-green);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 45, 114, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-result {
  width: 600px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-prompt {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Prediction code block */
.predict-code-block {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 12px 16px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 12px;
  color: var(--mu-gray-900);
  margin-bottom: 16px;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Prediction input */
.predict-input {
  width: 100%;
  background: white;
  border: 2px solid var(--mu-blue);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 13px;
  color: var(--mu-gray-900);
  resize: vertical;
}

.predict-input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15);
}

/* Prediction comparison */
.predict-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.predict-col {}

.predict-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.predict-answer {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 12px;
  color: var(--text-primary);
  white-space: pre-wrap;
  min-height: 40px;
}

/* Prediction lesson */
.predict-lesson {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 4px 4px 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

.predict-lesson b {
  color: var(--mu-blue-dark);
}

.predict-lesson code {
  background: var(--mu-gray-100);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--mu-blue);
}

/* Prediction result title colors */
.predict-correct { color: var(--pass-green); }
.predict-wrong { color: var(--accent-red); }

/* ========== Tutorial Modal ========== */
.tutorial-modal {
  width: 560px;
  max-width: 90vw;
}

.tutorial-header {
  text-align: center;
  padding: 28px 24px 20px;
  background: var(--mu-blue-dark);
  border-radius: 8px 8px 0 0;
  color: white;
}

.tutorial-logo {
  height: 50px;
  margin-bottom: 12px;
}

.tutorial-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.tutorial-subtitle {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

.tutorial-page {
  display: none;
}
.tutorial-page.active {
  display: block;
}

.tutorial-page h3 {
  font-size: 16px;
  color: var(--mu-blue-dark);
  margin-bottom: 16px;
  font-weight: 700;
}

.tutorial-page p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--mu-gray-700);
  margin-bottom: 8px;
}

.tutorial-page code {
  background: var(--mu-gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--mu-blue);
}

/* Concept cards on page 1 */
.tutorial-concepts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.tutorial-concept {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--mu-blue-lighter);
  border-radius: 6px;
  border-left: 3px solid var(--mu-blue);
}

.tutorial-concept-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tutorial-concept strong {
  display: block;
  font-size: 13px;
  color: var(--mu-blue-dark);
  margin-bottom: 2px;
}

.tutorial-concept p {
  font-size: 12px;
  margin: 0;
  color: var(--mu-gray-700);
}

/* Step list on pages 2-3 */
.tutorial-steps-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tutorial-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tutorial-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mu-blue);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.tutorial-step-item strong {
  display: block;
  font-size: 13px;
  color: var(--mu-gray-900);
  margin-bottom: 2px;
}

.tutorial-step-item p {
  font-size: 12px;
  margin: 0;
  color: var(--mu-gray-700);
  line-height: 1.5;
}

/* Footer with dots and buttons */
.tutorial-footer {
  justify-content: space-between;
  align-items: center;
}

.tutorial-dots {
  display: flex;
  gap: 8px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mu-gray-300);
  cursor: pointer;
  transition: background 0.2s;
}

.tutorial-dot.active {
  background: var(--mu-blue);
}

.tutorial-buttons {
  display: flex;
  gap: 8px;
}
