/* ==========================================================================
   THEORY & CALCULATIONS (PEN & PAPER MODE) STYLES
   ========================================================================== */
.theory-layout {
  display: grid;
  /* minmax(0, …) stops a wide formula in the solution from stretching the whole column */
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}

.theory-main {
  min-width: 0;
}

@media (max-width: 992px) {
  .theory-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.theory-card {
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.theory-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: none;
}

.theory-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.badge-course {
  background: var(--primary-100);
  color: var(--primary-700);
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.badge-marks {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid #fde68a;
}

.theory-paper-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-secondary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
}

.theory-paper-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.theory-paper-text strong {
  display: block;
  font-size: 0.925rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.theory-paper-text p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.theory-question-text {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.5rem 0;
}

.theory-action-area {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.btn-reveal-theory {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.95rem 2rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  transition: all 0.2s ease-in-out;
}

.btn-reveal-theory:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.theory-solution-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.final-answer-card {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
}

.dark .final-answer-card {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.35);
}

.final-answer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #166534;
  margin-bottom: 0.5rem;
}

.dark .final-answer-header {
  color: #4ade80;
}

.final-answer-body {
  font-size: 1.25rem;
  font-weight: 700;
  color: #14532d;
  line-height: 1.6;
}

.dark .final-answer-body {
  color: #86efac;
}

.marking-scheme-card {
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.marking-scheme-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.marking-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.marking-step-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  line-height: 1.5;
  font-size: 0.925rem;
}

.step-text {
  flex: 1;
  color: var(--text-primary);
}

.step-marks {
  background: var(--primary-100);
  color: var(--primary-800);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.lecturer-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.dark .lecturer-tip-card {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.tip-icon {
  font-size: 1.4rem;
}

.tip-content strong {
  display: block;
  font-size: 0.85rem;
  color: #92400e;
  margin-bottom: 0.25rem;
}

.dark .tip-content strong {
  color: #fcd34d;
}

.tip-content p {
  margin: 0;
  font-size: 0.875rem;
  color: #78350f;
  line-height: 1.45;
}

.dark .tip-content p {
  color: #fde68a;
}

.self-eval-card {
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.self-eval-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.self-eval-btns {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-self-eval {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-self-eval:hover {
  transform: translateY(-1px);
}

.btn-self-eval.selected-eval {
  border-color: var(--primary-600);
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.self-eval-feedback {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-600);
}

.theory-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.theory-progress-pill {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.theory-sidebar-card {
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}

.theory-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: none;
}

.theory-sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.theory-palette-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.theory-palette-btn {
  height: 42px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.theory-palette-btn:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.theory-palette-btn.current {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-700);
}

.theory-palette-btn.evaluated-full {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.theory-palette-btn.evaluated-partial {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.theory-palette-btn.evaluated-missed {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
