/* ─── Firmware Exam Platform - Global Styles ─── */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #222639;
  --bg-input: #2a2e42;
  --bg-hover: #2e3350;
  --text-primary: #e4e6f0;
  --text-secondary: #9ca3b8;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #333852;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ─── Header / Navbar ─── */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand span {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.85rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ─── Timer ─── */
.timer {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'Consolas', 'Courier New', monospace;
  letter-spacing: 2px;
}

.timer.warning { border-color: var(--warning); color: var(--warning); }
.timer.danger { border-color: var(--danger); color: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Password Toggle ─── */
.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .form-input {
  padding-right: 44px;
}

.eye-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.2s;
}

.eye-toggle:hover {
  color: var(--text-primary);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.1rem;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ─── Login Page ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
}

.login-card {
  width: 100%;
  max-width: 440px;
}

.tab-bar {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.tab-bar button {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-bar button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

/* ─── Exam Layout ─── */
.exam-container {
  display: flex;
  height: calc(100vh - 57px);
}

.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.question-list {
  list-style: none;
}

.question-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-item:hover { background: var(--bg-hover); }
.question-item.active { background: var(--accent); color: white; }

.question-item .q-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.question-item .q-meta {
  font-size: 0.75rem;
  opacity: 0.7;
}

.question-item .q-score {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
}

.question-item .q-score.scored {
  background: var(--success);
  color: white;
}

.question-item .q-score.zero {
  background: var(--danger);
  color: white;
}

/* ─── Main Exam Panel ─── */
.exam-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#codingPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#mcqPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exam-split {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.problem-panel {
  width: 40%;
  min-width: 200px;
  overflow-y: auto;
  padding: 24px;
}

.code-panel {
  width: 60%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}

.problem-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.problem-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: rgba(59, 130, 246, 0.2); color: #93bbfd; }
.badge-green { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.badge-yellow { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge-purple { background: rgba(168, 85, 247, 0.2); color: #c4b5fd; }

.problem-description {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.problem-description code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 0.85em;
  color: #93bbfd;
}

.problem-description pre {
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 8px 0;
}

.problem-description pre code {
  padding: 0;
  background: none;
}

.problem-description strong { color: var(--text-primary); }

.problem-description table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.problem-description th,
.problem-description td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-align: left;
  font-size: 0.85rem;
}

.problem-description th {
  background: var(--bg-input);
}

/* ─── Code Editor Area ─── */
#codeSection {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100px;
  overflow: hidden;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-header span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.editor-wrapper {
  flex: 1;
  overflow: hidden;
}

.editor-wrapper textarea {
  width: 100%;
  height: 100%;
  background: #1e1e2e;
  color: #cdd6f4;
  border: none;
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  tab-size: 4;
}

.editor-wrapper textarea:focus {
  outline: none;
}

/* ─── Output Panel ─── */
.output-panel {
  height: 150px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.output-header span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.output-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  background: #11111b;
  color: #a6adc8;
}

.output-body .pass { color: var(--success); }
.output-body .fail { color: var(--danger); }
.output-body .error { color: var(--danger); }
.output-body .warning { color: var(--warning); }

/* ─── Admin Dashboard ─── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 1.5rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Table ─── */
.table-wrapper {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

table.data-table th,
table.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

table.data-table th {
  background: var(--bg-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

table.data-table tr:hover {
  background: var(--bg-hover);
}

.score-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.status-pass { color: var(--success); font-weight: 700; }
.status-fail { color: var(--danger); font-weight: 700; }

/* ─── Results Page ─── */
.results-container {
  max-width: 700px;
  margin: 40px auto;
  padding: 20px;
}

.results-header {
  text-align: center;
  margin-bottom: 32px;
}

.score-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 6px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 24px auto;
}

.score-circle.passed { border-color: var(--success); }
.score-circle.failed { border-color: var(--danger); }

.score-circle .score-value {
  font-size: 2.5rem;
  font-weight: 700;
}

.score-circle .score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.category-card {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 16px;
}

.category-card .cat-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.category-card .cat-score {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ─── Candidate Dashboard ─── */
.cand-container {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 20px 40px;
}

.cand-welcome { margin-bottom: 24px; }
.cand-welcome h1 { font-size: 1.5rem; }
.cand-welcome p { color: var(--text-secondary); }

.cand-section-title {
  font-size: 1rem;
  margin: 28px 0 12px;
}

.stats-row.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats-row.compact .stat-card { padding: 16px 12px; }
.stats-row.compact .stat-value { font-size: 1.75rem; white-space: nowrap; }
.stat-card .stat-value.neutral { color: var(--text-primary); }
.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 4px 14px;
  border-radius: 999px;
  margin: 6px 0 4px;
  white-space: nowrap;
}
.result-badge.pass { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.result-badge.fail { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(120px, 230px) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.hbar-row:hover { background: var(--bg-hover); }

.hbar-name { font-size: 0.9rem; }

.hbar-track {
  height: 10px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.hbar-value {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 120px;
  text-align: right;
}

.highlight-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.highlight {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.highlight .hl-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.highlight .hl-value { font-weight: 600; }

.cand-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
}

.cand-note {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 12px;
}

@media (max-width: 600px) {
  .nav-user, .navbar-brand .nav-sub, .hide-narrow { display: none; }
  .result-badge { font-size: 0.95rem; padding: 4px 10px; }
  .hbar-row { grid-template-columns: 1fr auto; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ─── Student Detail Modal (Admin) ─── */

/* ─── Admin Detail Modal ─── */
.detail-modal {
  max-width: 900px;
  width: 95%;
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-stats-grid .stat-card {
  min-width: 0;
}

.detail-stats-grid .stat-value {
  font-size: 1.4rem;
  word-break: break-word;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .exam-split {
    flex-direction: column;
  }
  .problem-panel, .code-panel {
    width: 100% !important;
  }
  .problem-panel {
    height: 40%;
    border-bottom: 1px solid var(--border);
  }
  .code-panel {
    height: 60%;
  }
  .sidebar { width: 220px; }
  .splitter-h { display: none; }

  .detail-modal {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
  }

  .detail-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .detail-stats-grid .stat-card {
    padding: 12px 8px;
  }

  .detail-stats-grid .stat-value {
    font-size: 1.1rem;
  }

  .detail-stats-grid .stat-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 600px) {
  .detail-modal {
    width: 98%;
    padding: 16px;
    border-radius: 6px;
  }

  .detail-modal h2 {
    font-size: 1.1rem;
  }

  .detail-modal p {
    font-size: 0.8rem;
  }

  .detail-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .detail-stats-grid .stat-value {
    font-size: 1rem;
  }

  .detail-modal .data-table th,
  .detail-modal .data-table td {
    padding: 8px 6px;
    font-size: 0.75rem;
  }

  .modal-actions {
    flex-wrap: wrap;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4a5068; }

/* ─── Loading Spinner ─── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Exam Start Overlay ─── */
.exam-start {
  min-height: calc(100vh - 57px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.start-card {
  max-width: 600px;
  text-align: center;
}

.start-card h2 {
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.start-card ul {
  text-align: left;
  margin: 16px 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.start-card ul li {
  margin-bottom: 8px;
}

.finish-bar {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── Markdown-like rendering ─── */
.problem-description h1,
.problem-description h2,
.problem-description h3 {
  color: var(--text-primary);
  margin: 12px 0 8px;
}

.problem-description ul,
.problem-description ol {
  padding-left: 20px;
  margin: 8px 0;
}

.problem-description li {
  margin-bottom: 4px;
}

.problem-description hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── MCQ Options ─── */

.mcq-option {
  display: flex;
  align-items: center;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.mcq-option:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.mcq-option.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.mcq-option input[type="radio"] {
  margin-right: 12px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mcq-option-label {
  font-weight: 700;
  margin-right: 10px;
  color: var(--accent);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.mcq-option-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

.mcq-option.locked {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.mcq-option.locked.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  opacity: 1;
}

/* ─── Section Tabs (Coding / MCQ toggle in sidebar) ─── */
.section-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
}

.section-tab {
  flex: 1;
  padding: 14px 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.section-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section-tab-count {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-left: 4px;
}

.section-tab.active .section-tab-count {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent);
}

/* ─── MCQ Panel (full page scrollable MCQ list) ─── */
.mcq-panel-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mcq-panel-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.mcq-panel-header h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.mcq-panel-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.mcq-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.mcq-panel-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mcq-progress {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── MCQ Cards (individual question cards in the MCQ panel) ─── */
.mcq-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

.mcq-card-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.mcq-card-locked {
  opacity: 0.85;
}

.mcq-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mcq-card-number {
  background: var(--warning);
  color: #000;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.mcq-card-title {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.mcq-card-meta {
  display: flex;
  gap: 8px;
}

.mcq-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

.mcq-card-desc code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 0.85em;
  color: #93bbfd;
}

.mcq-card-desc pre {
  background: var(--bg-input);
  padding: 10px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 8px 0;
}

.mcq-card-desc pre code {
  padding: 0;
  background: none;
}

.mcq-card-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── MCQ sidebar items ─── */
.mcq-sidebar-item .q-score {
  font-size: 0.7rem;
  white-space: nowrap;
}

/* ─── Draggable Splitters ─── */
.splitter {
  flex-shrink: 0;
  background: var(--border);
  transition: background 0.2s;
  position: relative;
  z-index: 10;
}

.splitter:hover,
.splitter:active {
  background: var(--accent);
}

/* Horizontal splitter (between problem and code panels) */
.splitter-h {
  width: 5px;
  cursor: col-resize;
}

.splitter-h::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 40px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
}

.splitter-h:hover::after {
  opacity: 0.5;
}

/* Vertical splitter (between editor and output) */
.splitter-v {
  height: 5px;
  cursor: row-resize;
}

.splitter-v::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
}

.splitter-v:hover::after {
  opacity: 0.5;
}

/* ─── Exam: several-answer and typed-answer questions ─── */
.mcq-option input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.mcq-hint { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; }
.mcq-text { max-width: 460px; }
