/**
 * Grist E-Learning Widget
 * Copyright 2026 Said Hamadou (isaytoo)
 * Licensed under the Apache License, Version 2.0
 * https://github.com/isaytoo/grist-elearning-widget
 */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #64748b;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-width: 320px;
  --topbar-height: 64px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: calc(100vh - 28px);
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.course-thumbnail {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.course-icon {
  font-size: 36px;
}

.course-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.course-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Progress Section */
.progress-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius: 100px;
  transition: width 0.5s ease;
  width: 0%;
}

/* Chapters Navigation */
.chapters-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chapter {
  margin-bottom: 8px;
}

.chapter-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.chapter-header:hover {
  background: var(--bg-tertiary);
}

.chapter-header.expanded {
  background: var(--primary);
  color: white;
}

.chapter-icon {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.chapter-header.expanded .chapter-icon {
  transform: rotate(90deg);
}

.chapter-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.chapter-progress {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 100px;
}

.chapter-header:not(.expanded) .chapter-progress {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.lessons-list {
  padding: 8px 0 8px 20px;
  display: none;
}

.lessons-list.visible {
  display: block;
}

.lesson-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.lesson-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.lesson-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
}

.lesson-item.completed {
  color: var(--success);
}

.lesson-item.completed::before {
  content: '✓';
  font-weight: bold;
}

.lesson-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.lesson-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
}

.btn-certificate {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.btn-certificate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-certificate:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Bar */
.top-bar {
  height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.btn-toggle-sidebar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-toggle-sidebar:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item::after {
  content: '/';
  color: var(--text-muted);
}

.breadcrumb-item:last-child::after {
  display: none;
}

.breadcrumb-item:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  position: relative;
  background: var(--bg-tertiary);
  border-radius: 20px;
  padding: 4px;
  gap: 0;
}

.lang-option {
  padding: 6px 14px;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 1;
  transition: color 0.3s ease;
  user-select: none;
}

.lang-option.active {
  color: var(--bg-primary);
}

.lang-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--primary);
  border-radius: 16px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.lang-toggle[data-lang="en"] .lang-slider {
  transform: translateX(100%);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 100px;
  max-width: 180px;
}

.user-avatar {
  font-size: 1.2rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Lesson Container */
.lesson-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  padding-bottom: 100px;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-screen h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-screen p {
  font-size: 1rem;
  max-width: 400px;
}

/* Name Input Modal */
.name-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.name-modal.visible {
  opacity: 1;
  visibility: visible;
}

.name-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 48px;
  max-width: 450px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.name-modal.visible .name-modal-content {
  transform: scale(1) translateY(0);
}

.name-modal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: wave 1s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}

.name-modal-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.name-modal-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.name-input-group {
  display: flex;
  gap: 12px;
}

.name-input-group input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.name-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.name-input-group input::placeholder {
  color: var(--text-muted);
}

.name-input-group .btn {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Video Section */
.video-section {
  margin-bottom: 32px;
}

.video-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #000;
}

.video-player {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-controls {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.btn-video-action {
  padding: 10px 20px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-video-action:hover {
  background: #059669;
}

/* Lesson Content */
.lesson-content {
  max-width: 800px;
  margin: 0 auto;
}

.lesson-header {
  margin-bottom: 32px;
}

.lesson-type-badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.lesson-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.2;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.lesson-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.lesson-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.lesson-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.lesson-body p {
  margin-bottom: 16px;
}

.lesson-body ul, .lesson-body ol {
  margin: 16px 0;
  padding-left: 24px;
}

.lesson-body li {
  margin-bottom: 8px;
}

.lesson-body code {
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
}

.lesson-body pre {
  background: var(--text-primary);
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
}

.lesson-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  background: var(--bg-secondary);
  margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.lesson-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 20px 0;
  box-shadow: var(--shadow);
}

/* Quiz Section */
.quiz-section {
  max-width: 700px;
  margin: 0 auto;
}

.quiz-header {
  text-align: center;
  margin-bottom: 32px;
}

.quiz-badge {
  display: inline-block;
  padding: 8px 16px;
  background: var(--warning-light);
  color: #92400e;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.quiz-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.quiz-progress {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.quiz-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.quiz-question {
  margin-bottom: 32px;
}

.quiz-question:last-child {
  margin-bottom: 0;
}

.question-number {
  display: inline-block;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.option-item:hover {
  border-color: var(--primary-light);
  background: var(--bg-tertiary);
}

.option-item.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

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

.option-item.incorrect {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.option-item.selected .option-radio {
  border-color: var(--primary);
  background: var(--primary);
}

.option-item.selected .option-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.option-text {
  flex: 1;
  font-size: 0.95rem;
}

.quiz-actions {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* Quiz Results */
.quiz-results {
  text-align: center;
  padding: 48px 32px;
}

.results-icon {
  font-size: 64px;
  margin-bottom: 24px;
}

.results-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.results-score {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* Rating Section */
.rating-section {
  display: flex;
  justify-content: center;
  padding: 20px;
  margin-bottom: 10px;
}

.rating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 32px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.rating-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.star-rating {
  display: flex;
  gap: 8px;
}

.star-rating .star {
  font-size: 2rem;
  color: var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  transform-origin: center;
}

.star-rating .star:hover {
  transform: scale(1.2);
}

.star-rating .star.hover,
.star-rating .star.active {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.star-rating .star.active {
  animation: starPop 0.3s ease;
}

@keyframes starPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.rating-feedback {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 500;
  min-height: 20px;
}

/* Lesson Navigation */
.lesson-navigation {
  position: fixed;
  bottom: 28px;
  left: var(--sidebar-width);
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  transition: var(--transition);
}

.sidebar.collapsed ~ .main-content .lesson-navigation {
  left: 0;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

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

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

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

.btn-nav {
  background: transparent;
  color: var(--text-secondary);
  padding: 12px 20px;
}

.btn-nav:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-complete {
  padding: 14px 28px;
  font-size: 1rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.visible {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Certificate */
.certificate-content {
  width: 800px;
  padding: 24px;
}

.certificate {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: var(--radius-lg);
  padding: 8px;
}

.certificate-border {
  border: 3px solid #d97706;
  border-radius: var(--radius);
  padding: 8px;
}

.certificate-inner {
  background: white;
  border-radius: var(--radius-sm);
  padding: 48px;
  text-align: center;
}

.certificate-logo {
  font-size: 48px;
  margin-bottom: 16px;
}

.certificate h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 24px;
}

.certificate-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.certificate-name {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-style: italic;
}

.certificate-course {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
}

.certificate-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.certificate-signature {
  margin-top: 32px;
}

.signature-line {
  width: 200px;
  height: 1px;
  background: var(--text-muted);
  margin: 0 auto 8px;
}

.certificate-signature p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.certificate-actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-overlay p {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s ease;
  min-width: 300px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 28px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: 0;
  }
  
  .lesson-navigation {
    left: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }
  
  .lesson-container {
    padding: 20px;
  }
  
  .lesson-title {
    font-size: 1.5rem;
  }
  
  .quiz-container {
    padding: 20px;
  }
  
  .certificate-content {
    width: 100%;
  }
  
  .certificate-inner {
    padding: 24px;
  }
  
  .results-actions {
    flex-direction: column;
  }
  
  .lesson-navigation {
    padding: 12px 16px;
  }
  
  .btn-complete {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
}
