/* ----- Reset & base ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #2d3b45;
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }

/* ----- Header (Canvas-style) ----- */
.canvas-header {
  background: #2d3b45;
  color: #fff;
  border-bottom: 1px solid #1f2a30;
  position: sticky;
  top: 0;
  z-index: 10;
}
.canvas-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: #c7102e;
  color: #fff;
  font-weight: 700;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.course-code { font-weight: 700; font-size: 15px; }
.course-title { font-size: 12px; opacity: 0.75; }
.user-pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ----- Layout ----- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 65px);
}

/* ----- Sidebar ----- */
.sidebar {
  background: #fff;
  border-right: 1px solid #e0e3e6;
  padding: 20px 0;
}
.sidebar-title {
  padding: 0 20px;
  font-size: 18px;
  font-weight: 700;
  color: #2d3b45;
}
.sidebar-subtitle {
  padding: 4px 20px 16px 20px;
  font-size: 12px;
  color: #6b7780;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.question-list li {
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.question-list li:hover {
  background: #f0f3f5;
}
.question-list li.active {
  background: #eef4f9;
  border-left-color: #008ee2;
}
.question-list .ql-topic {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #008ee2;
  font-weight: 600;
  margin-bottom: 2px;
}
.question-list .ql-title {
  font-size: 13px;
  font-weight: 600;
  color: #2d3b45;
}
.question-list .ql-difficulty {
  font-size: 11px;
  color: #6b7780;
  margin-top: 2px;
}

/* ----- Content area ----- */
.content {
  padding: 28px 36px 60px 36px;
  background: #f5f5f5;
}
.empty-state {
  text-align: center;
  margin-top: 80px;
  color: #6b7780;
}
.empty-state h2 { color: #2d3b45; }

/* ----- Question header ----- */
.question-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e0e3e6;
}
.breadcrumb {
  font-size: 12px;
  color: #6b7780;
  margin-bottom: 6px;
}
.breadcrumb .sep { margin: 0 6px; }
.difficulty {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef4f9;
  color: #008ee2;
  font-weight: 600;
}
.difficulty.medium { background: #fef5e6; color: #b45309; }
.difficulty.hard   { background: #fde8e8; color: #c81e1e; }
.difficulty.easy   { background: #e8f5e9; color: #1b873b; }
#q-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #2d3b45;
}

/* ----- Cards ----- */
.prompt-card, .editor-card, .feedback-card {
  background: #fff;
  border: 1px solid #e0e3e6;
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: #6b7780;
  margin-bottom: 10px;
}
.card-label .hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #6b7780;
  font-size: 11px;
}

/* ----- Prompt text ----- */
.prompt-text {
  white-space: pre-wrap;
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 13px;
  background: #f7f9fa;
  border: 1px solid #e0e3e6;
  border-radius: 4px;
  padding: 14px;
  margin: 0;
  line-height: 1.55;
  color: #2d3b45;
  max-height: 420px;
  overflow-y: auto;
}

/* ----- Editor ----- */
.CodeMirror {
  border: 1px solid #3a4a55;
  border-radius: 4px;
  height: 320px;
  font-size: 13px;
  font-family: "Consolas", "Menlo", "Courier New", monospace;
}
.editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* ----- Buttons ----- */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: #008ee2;
  color: #fff;
  border-color: #008ee2;
}
.btn-primary:hover:not(:disabled) { background: #0077c0; border-color: #0077c0; }
.btn-ghost {
  background: #fff;
  color: #6b7780;
  border-color: #c7cdd1;
}
.btn-ghost:hover:not(:disabled) { background: #f0f3f5; }

/* ----- Feedback ----- */
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.score-badge {
  text-align: right;
}
.score-num {
  font-size: 32px;
  font-weight: 700;
  color: #2d3b45;
  line-height: 1;
}
.score-denom {
  font-size: 16px;
  font-weight: 400;
  color: #6b7780;
}
.score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7780;
  margin-top: 2px;
}

/* score color tint */
.score-num.tier-high   { color: #1b873b; }
.score-num.tier-mid    { color: #b45309; }
.score-num.tier-low    { color: #c81e1e; }

.breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.breakdown-item {
  background: #f7f9fa;
  border: 1px solid #e0e3e6;
  border-radius: 4px;
  padding: 10px 12px;
}
.breakdown-item .b-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7780;
  font-weight: 600;
}
.breakdown-item .b-value {
  font-size: 18px;
  font-weight: 700;
  color: #2d3b45;
  margin-top: 2px;
}
.breakdown-item .b-max {
  font-size: 12px;
  color: #6b7780;
  font-weight: 400;
}

.feedback-section {
  margin-top: 16px;
}
.feedback-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: #6b7780;
  margin: 0 0 8px 0;
}
.feedback-section p { margin: 0; color: #2d3b45; }

.bullets {
  margin: 0;
  padding-left: 22px;
  color: #2d3b45;
}
.bullets li { margin-bottom: 6px; }
.bullets-good li::marker { color: #1b873b; }
.bullets-errors li::marker { color: #c81e1e; }
.bullets-suggestions li::marker { color: #008ee2; }

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  color: #6b7780;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e0e3e6;
  border-top-color: #008ee2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  background: #fde8e8;
  color: #c81e1e;
  border: 1px solid #f5b5b5;
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 12px;
}

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid #e0e3e6;
  }
  .breakdown { grid-template-columns: repeat(2, 1fr); }
}
