/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --secondary-color: #7c3aed;
  --accent-color: #f59e0b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-accent: #eff6ff;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* Navigation Bar */
nav {
  background: var(--primary-color);
  color: white;
  padding: 1rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

nav h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

nav .nav-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

nav a:hover, nav a.active {
  background: var(--primary-dark);
}

nav .role-toggle {
  background: white;
  color: var(--primary-color);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s;
}

nav .role-toggle:hover {
  transform: scale(1.05);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.card h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.card h3 {
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.card p, .card li {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.card ul, .card ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

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

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

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: white;
}

table th, table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

table th {
  background: var(--bg-accent);
  color: var(--primary-color);
  font-weight: 600;
}

table tr:hover {
  background: var(--bg-secondary);
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.badge-primary {
  background: var(--bg-accent);
  color: var(--primary-color);
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* Collapsible Sections */
.collapsible {
  background: var(--bg-accent);
  padding: 1rem;
  border-radius: 0.375rem;
  margin: 1rem 0;
  cursor: pointer;
  border: 1px solid var(--primary-color);
}

.collapsible h4 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--primary-color);
  font-weight: 600;
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible.active .collapsible-content {
  max-height: 2000px;
  padding-top: 1rem;
}

/* Quiz Styles */
.quiz-question {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  border: 2px solid var(--border-color);
}

.quiz-options {
  margin: 1rem 0;
}

.quiz-option {
  padding: 0.75rem;
  margin: 0.5rem 0;
  border: 2px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-option:hover {
  background: var(--bg-accent);
  border-color: var(--primary-color);
}

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

.quiz-option.incorrect {
  background: #fee2e2;
  border-color: var(--danger-color);
}

.feedback {
  padding: 1rem;
  border-radius: 0.375rem;
  margin: 1rem 0;
}

.feedback.success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success-color);
}

.feedback.error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--danger-color);
}

/* Progress Bar */
.progress-bar {
  background: var(--bg-secondary);
  height: 8px;
  border-radius: 9999px;
  overflow: hidden;
  margin: 1rem 0;
}

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

/* Slides */
.slide {
  min-height: 500px;
  display: none;
  padding: 3rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
}

.slide.active {
  display: block;
}

.slide-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
}

/* Teacher/Student View Differentiation */
.teacher-only {
  display: none;
}

body.teacher-view .teacher-only {
  display: block;
}

body.teacher-view .student-only {
  display: none;
}

.role-indicator {
  background: var(--accent-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  nav .nav-container {
    flex-direction: column;
  }

  nav .nav-links {
    width: 100%;
    justify-content: center;
  }

  .container {
    padding: 0 0.5rem;
  }

  .card {
    padding: 1rem;
  }

  table {
    font-size: 0.875rem;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Print Styles */
@media print {
  nav, .btn, .role-toggle {
    display: none;
  }

  .card {
    page-break-inside: avoid;
  }
}
