/* === ENGINEERING COURSES - UNIFIED STYLE.CSS === */
/* Mobile-first responsive design with CSS custom properties for theming */

:root {
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --success: #059669;
  --success-light: #d1fae5;
  --error: #dc2626;
  --error-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --slide-transition: 0.3s ease;
  --sidebar-width: 280px;
}

/* Theme classes */
.theme-semiconductor {
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
}

.theme-circuits {
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
}

.theme-mechanical {
  --primary: #d45500;
  --primary-light: #e8761a;
  --primary-dark: #a84300;
}

.theme-safety {
  --primary: #b91c1c;
  --primary-light: #dc2626;
  --primary-dark: #7f1d1d;
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-stack);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  color: var(--gray-900);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img, svg {
  max-width: 100%;
  height: auto;
}

/* === APP SHELL === */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
.app-header {
  background: var(--primary-dark);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-header .logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
}

.app-header .logo:hover {
  opacity: 0.9;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.level-selector {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  margin: 0 0.75rem;
  flex-shrink: 0;
}

.level-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-stack);
  white-space: nowrap;
}

.level-btn:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.level-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
}

.level-btn .level-short { display: none; }
.level-btn .level-full { display: inline; }

.header-progress {
  flex: 1;
  max-width: 200px;
  margin: 0 1rem;
}

.progress-bar {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  background: #34d399;
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 0;
}

.progress-text {
  font-size: 0.7rem;
  opacity: 0.8;
  text-align: center;
  margin-top: 2px;
}

/* Back to programs link */
.back-to-programs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  text-decoration: none;
  margin-right: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-to-programs:hover {
  color: white;
  text-decoration: none;
}

/* === SIDEBAR / NAV === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: white;
  box-shadow: 4px 0 16px rgba(0,0,0,0.15);
  z-index: 200;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

.sidebar-overlay.open {
  display: block;
}

.sidebar-header {
  padding: 1rem;
  background: var(--primary-dark);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

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

.sidebar-nav .course-item {
  border-bottom: 1px solid var(--gray-100);
}

.sidebar-nav .course-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-nav .course-link:hover {
  background: var(--gray-50);
  text-decoration: none;
}

.sidebar-nav .course-link.active {
  color: var(--primary);
  background: #eff6ff;
}

.sidebar-nav .course-progress-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.sidebar-nav .course-progress-badge.done {
  background: var(--success-light);
  color: var(--success);
}

.sidebar-nav .week-list {
  list-style: none;
  padding: 0;
  display: none;
}

.sidebar-nav .course-item.expanded .week-list {
  display: block;
}

.sidebar-nav .week-entry {
  border-top: 1px solid var(--gray-50);
}

.sidebar-nav .week-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.25rem 1.5rem;
  color: var(--gray-700);
  font-size: 0.8rem;
  font-weight: 600;
}

.sidebar-nav .week-title-row .week-check {
  color: var(--success);
  font-size: 0.75rem;
}

.sidebar-nav .week-sub-links {
  display: flex;
  gap: 0;
  padding: 0 1rem 0.5rem 1.5rem;
}

.sidebar-nav .week-sub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  color: var(--gray-500);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.sidebar-nav .week-sub-link:hover {
  background: var(--gray-100);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-nav .week-sub-link.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav .week-sub-link .sub-badge {
  font-size: 0.65rem;
  color: var(--gray-400);
  margin-left: 0.15rem;
}

.sidebar-nav .week-sub-link .sub-badge.scored {
  color: var(--success);
  font-weight: 700;
}

/* Sidebar context - slide list */
.sidebar-context {
  display: none;
  border-top: 2px solid var(--gray-200);
  padding: 0.5rem 0;
}

.sidebar-context.active {
  display: block;
}

.sidebar-context-header {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-slide-list {
  list-style: none;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.sidebar-slide-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.78rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-slide-item:hover {
  background: var(--gray-50);
}

.sidebar-slide-item.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

.sidebar-slide-item.visited {
  color: var(--gray-700);
}

.sidebar-slide-item .slide-num {
  font-size: 0.65rem;
  color: var(--gray-400);
  min-width: 1.5rem;
}

.sidebar-slide-item.visited .slide-visit-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary-light);
  flex-shrink: 0;
}

/* === BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.breadcrumb a {
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb .bc-sep {
  color: var(--gray-300);
  margin: 0 0.15rem;
}

.breadcrumb .bc-current {
  color: var(--gray-700);
  font-weight: 600;
}

/* === MAIN CONTENT AREA === */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* === COURSE GRID (HOME) === */
.view { display: none; }
.view.active { display: flex; flex-direction: column; flex: 1; }

.course-grid {
  padding: 1.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.course-grid h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.course-grid .subtitle {
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.course-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.course-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.course-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(26,86,219,0.1);
  transform: translateY(-2px);
}

.course-card .course-number {
  display: inline-block;
  background: var(--primary);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  text-align: center;
  line-height: 2rem;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.course-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.course-card .course-meta {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.course-card .course-progress {
  margin-top: 0.5rem;
}

.course-card .progress-bar {
  background: var(--gray-100);
  height: 4px;
}

.course-card .progress-label {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* === WEEK SELECTION VIEW === */
.week-grid {
  padding: 1.5rem 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.week-grid .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-500);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  background: none;
  border: none;
  font-family: var(--font-stack);
}

.week-grid .back-btn:hover {
  color: var(--primary);
}

.week-grid h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.week-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.week-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.week-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(26,86,219,0.08);
}

.week-card .week-number {
  background: var(--gray-100);
  color: var(--gray-700);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.week-card .week-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.week-card .week-info .week-meta {
  color: var(--gray-500);
  font-size: 0.8rem;
}

.week-card .week-status {
  margin-left: auto;
  flex-shrink: 0;
}

.week-card .week-status .check-circle {
  color: var(--success);
  font-size: 1.25rem;
}

.week-card.completed {
  border-color: var(--success);
  background: #f0fdf4;
}

.week-card.completed .week-number {
  background: var(--success);
  color: white;
}

/* === SLIDE VIEW === */
.slide-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.slide-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.slide-top-bar .back-btn {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-stack);
}

.slide-top-bar .back-btn:hover {
  color: var(--primary);
}

.slide-top-bar .slide-title {
  font-size: 0.85rem;
  color: var(--gray-600);
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
}

.slide-top-bar .slide-counter {
  font-size: 0.8rem;
  color: var(--gray-400);
  white-space: nowrap;
}

/* Slide progress bar */
.slide-progress {
  height: 3px;
  background: var(--gray-100);
  flex-shrink: 0;
}

.slide-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

/* Slide container */
.slide-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.slide-wrapper {
  display: flex;
  transition: transform var(--slide-transition);
  height: 100%;
}

.slide {
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slide-inner {
  max-width: 800px;
  width: 100%;
}

.slide-inner h2 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.slide-inner h3 {
  font-size: 1.2rem;
  color: var(--gray-800);
  margin: 1rem 0 0.5rem;
}

.slide-inner p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.slide-inner ul, .slide-inner ol {
  margin: 0.5rem 0 1rem 1.5rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

.slide-inner li {
  margin-bottom: 0.35rem;
}

.slide-inner strong {
  color: var(--gray-900);
}

.slide-inner code {
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--primary-dark);
}

.slide-inner .highlight-box {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
}

.slide-inner .key-concept {
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
}

.slide-inner .formula {
  background: var(--gray-100);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-size: 1.15rem;
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
}

/* KaTeX overrides */
.formula:has(.katex) {
  font-family: var(--font-stack);
}

.formula .katex-display {
  margin: 0;
}

.formula .katex {
  font-size: 1.1em;
}

/* SVG diagram container */
.diagram-container {
  margin: 1rem 0;
  text-align: center;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem;
  overflow: hidden;
}

.diagram-container svg {
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Slide notes */
.slide-notes {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font-size: 0.9rem;
  color: var(--gray-600);
  cursor: pointer;
}

.slide-notes summary {
  font-weight: 600;
  color: var(--gray-700);
}

/* Bottom navigation */
.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.slide-nav button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-stack);
  min-height: 44px;
  min-width: 44px;
  transition: all 0.15s;
}

.btn-prev {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-prev:hover {
  background: var(--gray-200);
}

.btn-next {
  background: var(--primary);
  color: white;
}

.btn-next:hover {
  background: var(--primary-dark);
}

.btn-next:disabled, .btn-prev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-quiz {
  background: var(--success);
  color: white;
}

.btn-quiz:hover {
  background: #047857;
}

.slide-nav .nav-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.slide-nav .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: all 0.2s;
}

.slide-nav .nav-dot.active {
  background: var(--primary);
  width: 18px;
  border-radius: 3px;
}

.slide-nav .nav-dot.visited {
  background: var(--primary-light);
}

/* === QUIZ VIEW === */
.quiz-view {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.quiz-container {
  max-width: 700px;
  margin: 0 auto;
}

.quiz-header {
  text-align: center;
  margin-bottom: 2rem;
}

.quiz-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.quiz-header .quiz-subtitle {
  color: var(--gray-500);
  font-size: 0.95rem;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.quiz-progress .progress-bar {
  flex: 1;
  background: var(--gray-100);
  height: 8px;
}

.quiz-progress .progress-bar-fill {
  background: var(--primary);
}

.quiz-progress .progress-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  white-space: nowrap;
}

/* Question card */
.question-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
}

.question-number {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* Multiple choice options */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1rem;
  min-height: 44px;
  background: white;
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: #f0f7ff;
}

.quiz-option .option-marker {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--gray-500);
  margin-top: 0.1rem;
}

.quiz-option.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.quiz-option.selected .option-marker {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.quiz-option.correct .option-marker {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: var(--error-light);
}

.quiz-option.incorrect .option-marker {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.quiz-option.disabled {
  cursor: default;
  pointer-events: none;
}

/* True/False specific */
.tf-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tf-option {
  padding: 1rem;
  text-align: center;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  transition: all 0.15s;
  min-height: 44px;
}

.tf-option:hover {
  border-color: var(--primary-light);
}

.tf-option.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.tf-option.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.tf-option.incorrect {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--error);
}

/* Matching questions */
.matching-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.matching-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.matching-term {
  flex: 1;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.matching-arrow {
  color: var(--gray-400);
  flex-shrink: 0;
}

.matching-select {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font-stack);
  background: white;
  cursor: pointer;
  min-height: 44px;
}

.matching-select:focus {
  border-color: var(--primary);
  outline: none;
}

.matching-select.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.matching-select.incorrect {
  border-color: var(--error);
  background: var(--error-light);
}

/* Explanation */
.explanation {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  display: none;
}

.explanation.show {
  display: block;
}

.explanation.correct {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: #065f46;
}

.explanation.incorrect {
  background: var(--error-light);
  border: 1px solid var(--error);
  color: #991b1b;
}

/* Quiz navigation */
.quiz-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.quiz-nav button {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  font-family: var(--font-stack);
  transition: all 0.15s;
}

.quiz-submit {
  background: var(--primary);
  color: white;
}

.quiz-submit:hover {
  background: var(--primary-dark);
}

.quiz-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Quiz results */
.quiz-results {
  text-align: center;
  padding: 2rem;
}

.quiz-score {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.quiz-score.pass {
  color: var(--success);
}

.quiz-score.fail {
  color: var(--error);
}

.quiz-results .score-text {
  font-size: 1.15rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.quiz-results .results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.results-actions button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  font-family: var(--font-stack);
  transition: all 0.15s;
}

.btn-retry {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-retry:hover {
  background: var(--gray-200);
}

.btn-continue {
  background: var(--primary);
  color: white;
}

.btn-continue:hover {
  background: var(--primary-dark);
}

/* === RESPONSIVE === */
@media (min-width: 640px) {
  .course-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .week-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .slide-inner h2 {
    font-size: 1.75rem;
  }

  .slide {
    padding: 2rem;
  }
}

@media (min-width: 768px) {
  .app-header .logo {
    font-size: 1.2rem;
  }

  .header-progress {
    max-width: 300px;
  }

  .slide-inner p,
  .slide-inner ul,
  .slide-inner ol {
    font-size: 1.1rem;
  }
}

/* Desktop: persistent sidebar */
@media (min-width: 1024px) {
  .hamburger {
    display: none !important;
  }

  .sidebar {
    transform: translateX(0);
    top: 52px;
    height: calc(100vh - 52px);
    z-index: 50;
    box-shadow: 1px 0 4px rgba(0,0,0,0.08);
  }

  .sidebar-header,
  .sidebar-close {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: var(--sidebar-width);
  }

  .course-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .course-grid h1 {
    font-size: 2.25rem;
  }

  .slide-inner h2 {
    font-size: 2rem;
  }

  .slide {
    padding: 2.5rem;
  }

  .sidebar-slide-list {
    max-height: none;
  }
}

/* Mobile & Tablet: hamburger + overlay sidebar */
@media (max-width: 1023px) {
  .hamburger {
    display: block;
  }

  .header-progress {
    max-width: 120px;
  }

  .slide-nav button span.btn-text {
    display: none;
  }
}

@media (max-width: 639px) {
  .level-btn .level-full { display: none; }
  .level-btn .level-short { display: inline; }
  .level-btn { padding: 0.25rem 0.45rem; font-size: 0.7rem; }
  .level-selector { margin: 0 0.4rem; }
  .header-progress { max-width: 80px; margin: 0 0.4rem; }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.slide-in-right {
  animation: slideInRight 0.3s ease forwards;
}

/* === LOADING STATE === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--gray-400);
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === PRINT === */
@media print {
  .app-header, .slide-nav, .slide-top-bar, .sidebar, .sidebar-overlay {
    display: none !important;
  }

  .slide-view {
    height: auto;
  }

  .slide {
    page-break-after: always;
    padding: 1cm;
  }

  .slide-container {
    overflow: visible;
  }
}

/* Table styles inside slides */
.slide-inner table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.slide-inner th,
.slide-inner td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-200);
  text-align: left;
}

.slide-inner th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-800);
}

.slide-inner tr:nth-child(even) {
  background: var(--gray-50);
}

/* Two-column layout for slides */
.slide-columns {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
}

.slide-columns .col {
  flex: 1;
}

@media (max-width: 639px) {
  .slide-columns {
    flex-direction: column;
  }
}

/* === GLOSSARY TOOLTIPS === */
.glossary-term {
  border-bottom: 1.5px dotted var(--primary-light);
  cursor: help;
  transition: background 0.15s;
}

.glossary-term:hover {
  background: rgba(59, 130, 246, 0.08);
}

.glossary-tooltip {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 0.75rem 1rem;
  max-width: 320px;
  line-height: 1.5;
  pointer-events: auto;
}

.glossary-tooltip-term {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.glossary-tooltip-def {
  color: var(--gray-700);
  font-size: 0.85rem;
}

.glossary-tooltip-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: 0.4rem;
  font-weight: 600;
}

/* === SIDE-BY-SIDE DIAGRAM LAYOUT === */
.slide-body {
  display: flex;
  flex-direction: column;
}

.slide-body .slide-content {
  flex: 1;
  min-width: 0;
}

.slide-body .diagram-container {
  margin: 1rem 0;
}

@media (min-width: 1024px) {
  .slide-inner.has-diagram {
    max-width: 1200px;
  }

  .slide-body {
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
  }

  .slide-body .diagram-container {
    flex: 0 0 520px;
    position: sticky;
    top: 1rem;
    margin: 0;
  }

  .slide-body .diagram-container svg {
    max-height: none;
  }
}

/* === PROGRESSIVE HIGHLIGHTING === */
.diagram-highlight.dimmed {
  opacity: 0.25;
  transition: opacity 0.3s ease;
}

.diagram-highlight.active {
  opacity: 1;
  transition: opacity 0.3s ease;
  filter: drop-shadow(0 0 3px rgba(26, 86, 219, 0.3));
}

/* === LANDING PAGE === */
.landing-page {
  min-height: 100vh;
  background: var(--gray-50);
  font-family: var(--font-stack);
}

.landing-header {
  background: #1e293b;
  color: white;
  padding: 1rem 1.5rem;
  text-align: center;
}

.landing-header h1 {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.landing-header p {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.landing-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.landing-content h2 {
  text-align: center;
  font-size: 1.5rem;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.landing-content .landing-subtitle {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.program-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .program-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .program-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .landing-header h1 {
    font-size: 2rem;
  }

  .landing-content h2 {
    font-size: 1.75rem;
  }
}

.program-card {
  background: white;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  border: 2px solid var(--gray-200);
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  text-decoration: none;
  display: block;
  color: inherit;
}

.program-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  text-decoration: none;
}

.program-card .program-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.program-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.program-card .program-meta {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.program-card .program-desc {
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.5;
}

.program-card.semiconductor {
  border-color: #dbeafe;
}
.program-card.semiconductor:hover {
  border-color: #3b82f6;
}
.program-card.semiconductor .program-icon {
  background: #dbeafe;
  color: #1a56db;
}

.program-card.circuits {
  border-color: #dbeafe;
}
.program-card.circuits:hover {
  border-color: #3b82f6;
}
.program-card.circuits .program-icon {
  background: #dbeafe;
  color: #1a56db;
}

.program-card.mechanical {
  border-color: #ffedd5;
}
.program-card.mechanical:hover {
  border-color: #d45500;
}
.program-card.mechanical .program-icon {
  background: #ffedd5;
  color: #d45500;
}

.program-card.safety {
  border-color: #fecaca;
}
.program-card.safety:hover {
  border-color: #b91c1c;
}
.program-card.safety .program-icon {
  background: #fecaca;
  color: #b91c1c;
}
