/* ===================================
   SUBJECT PAGE STYLES
   =================================== */

/* Subject Header */
.subject-header {
  background: linear-gradient(
    135deg,
    var(--primary-light) 0%,
    var(--secondary-light) 100%
  );
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.subject-header-content {
  animation: fadeInUp 0.8s ease;
}

.subject-icon-large {
  font-size: 5rem;
  margin-bottom: var(--spacing-md);
}

.subject-header h1 {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
}

.subject-header p {
  font-size: var(--font-size-lg);
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* ===================================
   SUBJECT LAYOUT
   =================================== */
.subject-layout {
  padding: 0 0;
  min-height: 70vh;
  background: var(--background-dark);
}

.layout-grid {
  display: grid;
  grid-template-columns: 410px 1fr;
  gap: var(--spacing-xl);
  position: relative;
}

.graph-container {
  /* background: #ffffff; */
  background: transparent;
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.graph-container canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* ===================================
   SIDEBAR NAVIGATION
   =================================== */
.sidebar {
  position: sticky;
  top: 0px;
  /* height: fit-content; */
  max-height: calc(100vh);
  overflow-y: auto;
  background: var(--background);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.sidebar-header h3 {
  font-size: var(--font-size-xl);
  color: var(--text-dark);
  font-weight: 500;
}

.sidebar-toggle {
  display: none;
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-lg);
}

.topic-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin-left: 1rem;
  overflow: hidden;
  min-width: 0;
}

.topic-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  background: var(--background);
  border: 20px solid transparent;
}

.topic-link:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  transform: translateX(5000px);
}

.topic-link.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
}

.topic-icon {
  font-size: var(--font-size-lg);
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--background-dark);
  border-radius: 100px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ===================================
   CONTENT CANVAS
   =================================== */
.content-canvas {
  background: var(--background-alt);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  min-height: 600px;
  width: 100%; /* Changed from 98% */
  min-width: unset; /* Removed the 600px min-width constraint */
  max-width: 100%; /* Prevent overflow */
  display: flex;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.topic-content {
  background: none;
  width: 100%; /* Make it fluid */
  max-width: 100%; /* Prevent overflow */
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.spacer {
  border-right: 2px solid var(--primary-color);
  margin: 0rem 1.5rem;
}

/* Welcome Screen */

.welcome-screen {
  padding: 3rem 2rem;
  align-items: center;
  align-self: center;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.welcome-header-layout {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: 100%;
}

.welcome-text {
  flex: 1;
  /* box-shadow: 0 10px 300px rgba(220, 38, 38, 0.1); */
  padding: 2rem;
  border-radius: 1rem;
}

.welcome-image {
  flex: 0 0 350px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-image img {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.welcome-image img:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.welcome-text h2 {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.welcome-text p {
  font-size: 1.125rem;
  color: var(--text-light);
  line-height: 1.8;
}

.features-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.feature-item {
  padding: 1.5rem;
  background: var(--background);
  border-radius: 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.feature-item:hover {
  transform: translateX(10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  background: var(--background-alt);
}

.feature-Icon {
  flex-shrink: 0;
  color: var(--text-dark);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--primary-color);
}

.feature-Icon i {
  font-size: 1.5rem;
  color: var(--background);
}

.feature-content {
  flex: 1;
}

.feature-item h3 {
  font-size: 1.25rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.feature-item p {
  font-size: 0.9375rem;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

/* ===================================
   TOPIC CONTENT
   =================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-sm);
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--primary-color);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--primary-dark);
}

.separator {
  color: var(--text-muted);
}

.topic-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: var(--spacing-lg);
}

/* ===================================
   TABS
   =================================== */
.tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  background: inherit;
  padding-bottom: 0.5rem;
}

.tab-button {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-light);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-button i {
  font-size: 1rem;
}

.tab-button:hover {
  color: var(--primary-color);
  background: var(--primary-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================
   NOTES TAB
   =================================== */
.notes-content {
  line-height: 1.8;
  color: var(--text-dark);
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word; /* Break long words */
  word-wrap: break-word; /* Legacy support */
}

.notes-content h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-dark);
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--primary-color);
}

.notes-content h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-dark);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

.notes-content p {
  margin-bottom: var(--spacing-md);
  font-size: var(--font-size-base);
  color: var(--text-dark);
}

.notes-content ul,
.notes-content ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.notes-content li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-dark);
  list-style: disc;
}

.notes-content ol li {
  list-style: decimal;
}

.notes-content strong {
  color: var(--text-dark);
  font-weight: 600;
}

.notes-content code {
  background: var(--background-alt);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: "Courier New", monospace;
  color: var(--primary-color);
}

.notes-content img,
.topic-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--spacing-md) 0;
}

/* UPDATE: Tables - Make scrollable on mobile */
.notes-content table,
.topic-content table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* UPDATE: Code blocks - Prevent overflow */
.notes-content pre,
.topic-content pre,
.notes-content code,
.topic-content code {
  max-width: 100%;
  overflow-x: auto;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.info-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary-color);
  padding: var(--spacing-md);
  border-radius: 0px;
  margin: var(--spacing-lg) 0;
}

.info-box.note {
  display: none;
}

.info-box.interactive {
  display: none;
}

.info-box.warning {
  background: var(--warning-light);
  border-left-color: var(--accent-orange);
}

.info-box.tip {
  background-color: var(--background-alt);
  /* border-left-color: var(--secondary-color); */
}

.idea-light {
  /* Standard bright amber, great for visual emphasis */
  color: #ffbf00;

  /* Optional: Make it slightly larger than surrounding text */
  font-size: 1.2em;

  /* Optional: Add a subtle text shadow for a 'glow' effect */
  text-shadow: 0 0 5px rgba(255, 191, 0, 0.6);
}

.warning-icon {
  color: #ffc107; /* A bright, standard amber/yellow color */
  font-size: 1.2em; /* Adjust size as needed */
  margin-right: 5px; /* Add some space if preceding text */
}

/* ===================================
   VIDEO TAB
   =================================== */
.video-container {
  position: relative;
  height: auto;
  overflow: visible;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
}

/* For direct iframe embeds (legacy single video) */
.video-container > iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
}

.video-description {
  padding: var(--spacing-md);
  background: var(--background-alt);
  border-radius: var(--radius-md);
}

.video-description h3 {
  font-size: var(--font-size-xl);
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
}

.video-description p {
  color: var(--text-light);
  line-height: 1.7;
}

/* ===================================
   VIDEO TAB - Multi-Video Layout
   =================================== */

/* Loading State */
.video-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  gap: var(--spacing-md);
}

.video-loading-state i {
  font-size: 2.5rem;
}

/* Coming Soon State */
.video-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 400px;
}

.video-coming-soon-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.video-coming-soon-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.video-coming-soon-text {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 500px;
  line-height: 1.6;
}

/* Video Section - 2x2 Grid */
.video-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

@media (max-width: 600px) {
  .video-section {
    grid-template-columns: 1fr;
  }
}

/* Unified Video Card */
.video-card {
  display: flex;
  flex-direction: column;
  background: var(--background);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-base);
}

.video-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

.video-card .video-thumbnail {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--background-dark);
  overflow: hidden;
}

.video-card .video-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.video-card:hover .video-thumbnail img {
  transform: scale(1.05);
}

.video-card .video-info {
  padding: var(--spacing-sm);
}

.video-card .video-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 4px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card .video-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Video Badges */
.video-badge {
  position: absolute;
  top: var(--spacing-xs);
  left: var(--spacing-xs);
  background: linear-gradient(135deg, var(--primary-color), #6366f1);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
}

.video-duration {
  position: absolute;
  bottom: var(--spacing-xs);
  right: var(--spacing-xs);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 2px var(--spacing-xs);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.video-play-overlay i {
  font-size: 1.25rem;
  color: white;
}

.video-card:hover .video-play-overlay {
  opacity: 1;
}

/* Video Modal */
.topic-video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.topic-video-modal.active {
  display: flex;
}

.topic-video-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
}

.topic-video-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--background);
  border-radius: var(--radius-lg);
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.topic-video-modal-close {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 2;
  transition: background var(--transition-fast);
}

.topic-video-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.topic-video-modal-body {
  overflow-y: auto;
}

.topic-video-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
}

.topic-video-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.topic-video-details {
  padding: var(--spacing-lg);
}

.topic-video-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 var(--spacing-sm) 0;
}

.topic-video-meta {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.topic-video-duration {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topic-video-difficulty {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
}

.topic-video-difficulty.difficulty-beginner {
  background: #dcfce7;
  color: #166534;
}

.topic-video-difficulty.difficulty-intermediate {
  background: #fef3c7;
  color: #92400e;
}

.topic-video-difficulty.difficulty-advanced {
  background: #fee2e2;
  color: #991b1b;
}

.topic-video-description {
  font-size: var(--font-size-base);
  color: var(--text-light);
  line-height: 1.6;
  margin: 0 0 var(--spacing-md) 0;
}

.topic-video-keypoints {
  background: var(--background-alt);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

.topic-video-keypoints h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 var(--spacing-sm) 0;
}

.topic-video-keypoints ul {
  margin: 0;
  padding-left: 1.25rem;
}

.topic-video-keypoints li {
  font-size: var(--font-size-sm);
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .focused-videos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
  }

  .video-featured-info {
    padding: var(--spacing-md);
  }

  .topic-video-modal-content {
    width: 95%;
    max-height: 95vh;
  }
}

@media (max-width: 480px) {
  .focused-videos-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   QUESTIONS TAB
   =================================== */
.questions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.questions-header h2 {
  font-size: var(--font-size-2xl);
  color: var(--text-dark);
}

.score-display {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--primary-color);
}

.question-card {
  background: var(--background-alt);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border: 2px solid var(--border-color);
  transition: all var(--transition-base);
  height: auto;
  min-height: fit-content;
  overflow: visible;
}

.question-card.correct {
  border-color: var(--secondary-color);
  background: var(--secondary-light);
}

.question-card.incorrect {
  border-color: var(--accent-red);
  background: #fee2e2;
}

.question-number {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  width: fit-content;
}

.question-text {
  font-size: var(--font-size-lg);
  color: var(--text-dark);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  background: transparent;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--background);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.answer-option:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.answer-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.answer-option label {
  flex: 1;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--text-dark);
  display: flex;
  align-items: center;
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 12px;
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
  border-radius: 50%;
  flex-shrink: 0;
}

.answer-option.selected .option-letter {
  background: var(--primary-dark, #1e40af);
}

.answer-option.correct-answer .option-letter {
  background: var(--secondary-color);
}

.answer-option.wrong-answer .option-letter {
  background: var(--accent-red);
}

.answer-option.selected {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.answer-option.correct-answer {
  border-color: var(--secondary-color);
  background: var(--secondary-light);
}

.answer-option.wrong-answer {
  border-color: var(--accent-red);
  background: #fee2e2;
}

.check-answer-btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  left: 10px;
}

.check-answer-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.check-answer-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.answer-feedback {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-weight: 500;
}

.answer-feedback.correct {
  background-color: var(--secondary-light); /* Light red/pink background */
  border: 1px solid var(--secondary-color); /* Red border */
  color: var(--secondary-color); /* Darker red text */
}

/* Styles the X icon for incorrect answers */
.answer-feedback.correct .fa-circle-xmark {
  color: var(--secondary-color); /* Ensures the icon is red */
  margin-right: 5px;
}

.answer-feedback.incorrect {
  background-color: #fcebeb; /* Light red/pink background */
  border: 1px solid #d99a9a; /* Red border */
  color: var(--primary-color); /* Darker red text */
}

/* Styles the X icon for incorrect answers */
.answer-feedback.incorrect .fa-circle-xmark {
  color: var(--primary-color); /* Ensures the icon is red */
  margin-right: 5px;
}

.answer-feedback p {
  margin-top: 5px;
  margin-bottom: 0;
  font-size: 0.95em;
}

.answer-feedback strong {
  display: block;
  margin-bottom: var(--spacing-xs);
}

.questions-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 2px solid var(--border-color);
}

/* ===================================
   QUIZ COMPLETION
   =================================== */

.practice-header h3 {
  font-size: var(--font-size-base);
  margin-bottom: 0.5rem;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
/* ===================================
   ENHANCED MOBILE MEDIA QUERIES
   =================================== */

/* Large tablets and small desktops */
@media (max-width: 968px) {
  .layout-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .sidebar {
    position: relative;
    top: 0;
    max-height: none;
  }

  .content-canvas {
    width: 100%;
    min-width: unset;
    padding: var(--spacing-lg);
  }

  .sidebar-toggle {
    display: none; /* Hidden - we use new toggle buttons now */
  }

  /* Removed old topic-nav hiding - now handled by sidebar overlay system */

  /* Make spacer horizontal on mobile */
  .spacer {
    border-right: none;
    border-bottom: 2px solid var(--primary-color);
    margin: 1rem 0;
    width: 100%;
  }

  .welcome-content {
    flex-direction: column;
    gap: 2rem;
  }

  .welcome-text {
    flex: 1;
  }
}

/* Tablets and larger phones */

/* Medium tablets and large phones (covers 512px-640px gap) */
@media (max-width: 640px) {
  /* Force single column layout */
  .main-container {
    display: block !important;
    grid-template-columns: 1fr !important;
    min-height: auto;
  }

  /* Ensure sidebars are in overlay mode */
  .left-sidebar,
  .right-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    width: 300px;
    height: calc(100vh - 60px);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .right-sidebar {
    right: 0;
    transform: translateX(100%);
  }

  /* Full width content area */
  .content-area {
    padding: 1.25rem;
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
  }

  .content-canvas {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
  }

  /* Show sidebar toggles */
  .sidebar-toggles {
    display: flex;
    gap: 0.625rem;
    padding: 0.625rem;
  }

  .sidebar-toggle-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
  }

  /* Tab adjustments */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }

  /* Support for WebKit browsers (Safari, older Chrome) */
  .tabs::-webkit-scrollbar {
    height: 6px;
  }

  .tabs::-webkit-scrollbar-track {
    background: transparent;
  }

  .tabs::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
  }

  .tab-button {
    flex-shrink: 0;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  /* Welcome content */
  .welcome-header-layout {
    flex-direction: column;
    gap: 1.5rem;
  }

  .welcome-content {
    gap: 1.5rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .subject-header {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .subject-icon-large {
    font-size: 3rem;
  }

  .subject-header h1 {
    font-size: var(--font-size-2xl);
  }

  .subject-header p {
    font-size: var(--font-size-base);
    padding: 0 var(--spacing-sm);
  }

  /* Main container and content area for mobile */
  .main-container {
    display: block !important;
    min-height: auto;
  }

  .content-area {
    padding: 0.75rem;
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
  }

  .content-canvas {
    padding: var(--spacing-sm);
    width: 100%;
    min-width: unset;
  }

  /* Sidebar toggles optimization */
  .sidebar-toggles {
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .sidebar-toggle-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  .sidebar-toggle-btn i {
    font-size: 0.875rem;
  }

  .topic-title {
    font-size: var(--font-size-xl);
  }

  /* Tabs optimization for small screens */
  .tabs {
    gap: 0.25rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    gap: 0.375rem;
    flex-shrink: 0;
    min-width: fit-content;
  }

  .tab-button i {
    font-size: 0.875rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .answer-option {
    padding: var(--spacing-sm);
  }

  .answer-option label {
    font-size: var(--font-size-sm);
  }

  .breadcrumb {
    font-size: var(--font-size-xs);
    flex-wrap: wrap;
  }

  /* Comparison tables - stack on very small screens */
  .comparison-table {
    font-size: var(--font-size-xs);
  }

  /* Navigation optimization for small phones */
  .content-title {
    font-size: 1.25rem;
  }

  .content-actions {
    gap: 0.5rem;
  }

  .content-nav-btn {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    gap: 0.375rem;
  }

  .sticky-header {
    padding-top: 1rem;
  }

  .comparison-table table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .comparison-table thead th,
  .comparison-table tbody td {
    padding: 0.5rem var(--spacing-xs);
    font-size: var(--font-size-xs);
  }

  /* Feature items */
  .feature-item {
    padding: 1rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .welcome-text h2 {
    font-size: 1.5rem;
  }

  .welcome-text p {
    font-size: 0.875rem;
  }

  /* Section headers in sidebar */
  .section-header {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .section-details h4 {
    font-size: var(--font-size-sm);
  }

  .section-meta {
    font-size: 0.625rem;
  }

  .topic-link {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
  }

  /* Reading content headings */
  .reading-content > h2,
  .notes-content > h2 {
    font-size: 1.25rem;
    padding: 0.875rem 1rem;
    margin: 1.5rem 0 0.875rem;
  }

  .reading-content h3,
  .notes-content h3 {
    font-size: 1rem;
    padding: 0.625rem 0.875rem;
  }

  .reading-content > h2::before {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }
}

/* Medium small phones */
@media (max-width: 425px) {
  .content-area {
    padding: 0.625rem !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .content-canvas {
    padding: 0.625rem;
    width: 100%;
  }

  .tab-button {
    padding: 0.4375rem 0.625rem;
    font-size: 0.78125rem;
  }

  .reading-content > h2,
  .notes-content > h2 {
    font-size: 1.1875rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .reading-content,
  .notes-content {
    padding: 0.5rem;
  }

  /* Tighter sidebar toggles */
  .sidebar-toggles {
    gap: 0.375rem;
    padding: 0.375rem;
  }

  .sidebar-toggle-btn {
    padding: 0.4375rem 0.625rem;
    font-size: 0.75rem;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .content-area {
    padding: 0.5rem !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .content-canvas {
    padding: 0.5rem;
    width: 100%;
  }

  .subject-header {
    padding: 1rem 0.5rem;
  }

  .subject-header h1 {
    font-size: var(--font-size-xl);
  }

  .topic-title {
    font-size: var(--font-size-lg);
  }

  .tabs {
    gap: 0.125rem;
  }

  .tab-button {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.25rem;
  }

  .tab-button i {
    font-size: 0.75rem;
  }

  .welcome-text h2 {
    font-size: 1.25rem;
  }

  /* Content headings on very small screens */
  .reading-content > h2,
  .notes-content > h2 {
    font-size: 1.125rem;
    padding: 0.75rem 0.875rem;
  }

  .reading-content h3,
  .notes-content h3 {
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
  }

  .reading-content,
  .notes-content {
    padding: 0.375rem;
  }

  .content-title {
    font-size: 1.125rem;
  }

  .breadcrumb {
    font-size: 0.75rem;
    gap: 0.25rem;
  }

  /* Very tight sidebar toggles */
  .sidebar-toggles {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .sidebar-toggle-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.6875rem;
  }

  .sidebar-toggle-btn i {
    font-size: 0.75rem;
  }
}

/* ===================================
   UTILITY CLASSES FOR RESPONSIVE CONTENT
   =================================== */

/* Add these classes to elements that need special mobile handling */
.mobile-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-stack {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

@media (min-width: 769px) {
  .mobile-stack {
    flex-direction: row;
  }
}

/* Responsive iframe/embed containers */
.responsive-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.responsive-embed iframe,
.responsive-embed object,
.responsive-embed embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.equation-box {
  background-color: #f1f5f9;
  padding: 1rem;
  border-left: 4px solid #64748b;
  font-family: "Courier New", Courier, monospace;
  font-weight: 600;
  margin: 1rem 0;
  text-align: center;
  color: #0f172a;
}

/* ===================================
   OLD COLLAPSIBLE SIDEBAR SECTIONS (DEPRECATED - KEPT FOR BACKWARDS COMPATIBILITY)
   =================================== */
.topic-section {
  display: none; /* Hidden - using new unit-section instead */
}

.section-header {
  display: none; /* Hidden - using new unit-title instead */
}

.section-topics {
  display: none; /* Hidden - using new structure */
}

.topic-link {
  display: none; /* Hidden - using new topic-item instead */
}

/* ============================
CUSTOM TABLE STYLES
============================ */

/* Comparison Table Styles */
.comparison-table {
  width: 100%;
  margin: var(--spacing-md) 0;
  overflow-x: auto;
  border-radius: 0rem;
  /* box-shadow: var(--shadow-md); */
}

.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--background);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
}

.comparison-table thead {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: var(--background);
  opacity: 0.9;
}

.comparison-table thead th {
  padding: var(--spacing-sm);
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-base);
  letter-spacing: 0.5px;
  border-bottom: 3px solid var(--primary-shade);
}

.comparison-table thead th:first-child {
  border-top-left-radius: var(--radius-lg);
  border-radius: 0rem;
}

.comparison-table thead th:last-child {
  border-top-right-radius: var(--radius-lg);
  border-radius: 0rem;
}

.comparison-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.comparison-table tbody tr:last-child {
  border-bottom: none;
}

.comparison-table tbody tr:hover {
  background-color: var(--background-alt);
}

.comparison-table tbody td {
  padding: 0.875rem var(--spacing-sm);
  color: var(--text-dark);
  line-height: 1.6;
}

.comparison-table tbody td:first-child {
  font-weight: 600;
  color: var(--text-dark);
  background-color: var(--background-dark);
  border-right: 2px solid var(--border-color);
}

/* Alternating row colors */
.comparison-table tbody tr:nth-child(even) {
  background-color: var(--background-alt);
}

.comparison-table tbody tr:nth-child(even):hover {
  background-color: var(--background-dark);
}

/* Mobile responsive */

/* Optional: Add highlight effect on cells */
.comparison-table tbody td:not(:first-child):hover {
  background-color: var(--primary-light);
  cursor: default;
}

/* Placeholder Image Styles */
.placeholder-image {
  background: linear-gradient(
    135deg,
    var(--background-alt) 0%,
    var(--background-dark) 100%
  );
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  margin: var(--spacing-sm) 0;
  transition: border-color var(--transition-base);
}

.placeholder-image:hover {
  border-color: var(--text-light);
}

.placeholder-image p {
  margin: 0;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
}

/* ===================================
   END OF SUBJECT PAGE STYLES
   =================================== */
/* Custom style for the list icons */
.info-box.warning ul li .fa-circle-xmark {
  /* Sets the icon color to the defined red variable */
  color: var(--primary-color);

  /* Adds a small space to the right of the icon for separation */
  margin-right: 0.5rem;
}

/* ===================================
    FILE MANAGER STYLES - PAST PAPERS
    =================================== */

.papers-layout {
  padding: var(--spacing-lg) 0;
}

.papers-main-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.papers-sidebar {
  position: sticky;
  top: var(--spacing-md);
  align-self: start;
}

.papers-content {
  min-height: 600px;
}

/* Mobile responsive */
@media (max-width: 968px) {
  .papers-main-layout {
    grid-template-columns: 1fr;
  }

  .papers-sidebar {
    position: relative;
    top: 0;
  }
}

/* ===================================
   NEW SUBJECT UI LAYOUT STYLES
   =================================== */

.section-dark2 {
  /* padding-top: 2.5rem; */
  background: var(--background-alt);
}

/* ===================================
   DUAL SIDEBAR LAYOUT (SaveMyExams Style)
   =================================== */

:root {
  --primary-sidebar-width: 250px;
  --secondary-sidebar-width: 340px;
  --navbar-height: 50px;
}

/* Three Column Layout - Primary + Secondary + Content */
.main-container {
  display: grid;
  grid-template-columns:
    var(--primary-sidebar-width) var(--secondary-sidebar-width)
    1fr;
  min-height: calc(100vh - var(--navbar-height));
  transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: grid-template-columns;
}

/* Collapsed States - sidebars reduce to icon-only width, never fully hidden */
.main-container.primary-collapsed {
  grid-template-columns: 64px var(--secondary-sidebar-width) 1fr;
}

.main-container.secondary-collapsed {
  grid-template-columns: var(--primary-sidebar-width) 48px 1fr;
}

.main-container.primary-collapsed.secondary-collapsed {
  grid-template-columns: 64px 48px 1fr;
}

/* ===================================
   PRIMARY SIDEBAR (Navigation Menu)
   =================================== */
.primary-sidebar {
  background: var(--background);
  /* background: var(--background-dark, #1a1a2e); */
  color: var(--text-light, #e5e7eb);
  height: calc(100vh - var(--navbar-height));
  position: sticky;
  top: var(--navbar-height);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
  contain: layout style;
  z-index: 100;
  border-right: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 6px 0 20px rgba(0, 0, 0, 0);
}

/* Primary Sidebar Collapsed - icons only mode */
.primary-sidebar.collapsed {
  width: 65px;
  overflow-x: hidden;
}

.primary-sidebar.collapsed .side-nav-item span,
.primary-sidebar.collapsed .nav-section-label,
.primary-sidebar.collapsed .menu-toggle-btn span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state - text fades in after width animation starts */
.primary-sidebar:not(.collapsed) .side-nav-item span,
.primary-sidebar:not(.collapsed) .nav-section-label,
.primary-sidebar:not(.collapsed) .menu-toggle-btn span {
  transition:
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-sidebar.collapsed .side-nav-item {
  justify-content: center;
  padding: 14px;
  border-left: none;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 1rem);
}

.primary-sidebar.collapsed .side-nav-item i {
  /* font-size: 1.125rem; */
  font-size: var(--font-size-base);
}

.primary-sidebar.collapsed .menu-toggle-btn {
  justify-content: center;
  padding: 16px;
}

.primary-sidebar.collapsed .menu-toggle-btn i {
  font-size: 1.25rem;
}

.primary-sidebar.collapsed .nav-section {
  padding: 4px 0;
}

/* Hide progress/help sections when collapsed */
.primary-sidebar.collapsed .primary-sidebar-section {
  display: none;
}

/* Primary sidebar section spacing */
.primary-sidebar-section {
  padding: 1rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

/* Primary Sidebar Scrollbar */
.primary-sidebar::-webkit-scrollbar {
  width: 6px;
}

.primary-sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.primary-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.primary-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Menu Toggle Button */
.menu-toggle-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-light, #e5e7eb);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.menu-toggle-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.menu-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.menu-toggle-btn i {
  font-size: 1rem;
}

/* Primary Navigation */
.primary-nav {
  padding: 0.5rem 0;
}

.nav-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.nav-section:last-child {
  border-bottom: none;
}

.nav-section-label {
  display: block;
  padding: 8px 20px;
  font-size: var(--font-size-base);
  /* text-transform: uppercase; */
  color: var(--text-muted, #9ca3af);
  letter-spacing: 0.05em;
  /* font-weight: 600; */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-light, #e5e7eb);
  text-decoration: none;
  font-size: var(--font-size-base);
  transition:
    background 0.2s ease,
    color 0.2s ease;
  border-left: 0px solid transparent;
  border-radius: 90rem;
  margin: 0rem 1rem;
  margin-bottom: 0.5rem;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
}

.side-nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.side-nav-item :hover {
  background: var(--background-dark);
  color: var(--text-dark);
}

.side-nav-item.active {
  background: var(--background-alt);
  color: var(--primary-color);
  border-left-color: white;
}

.side-nav-item i {
  width: 20px;
  text-align: center;
  font-size: var(--font-size-lg);
  align-self: center;
}

/* ===================================
   SECONDARY SIDEBAR (Topics)
   =================================== */
.secondary-sidebar {
  background: var(--background, #ffffff);
  color: var(--text-dark, #1f2937);
  height: calc(100vh - var(--navbar-height));
  position: sticky;
  top: var(--navbar-height);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
  contain: layout style;
  border-right: 1px solid var(--border-color, #e5e7eb);
  z-index: 99;
}

/* Secondary Sidebar Collapsed - narrow strip with expand button */
.secondary-sidebar.collapsed {
  width: 48px;
  min-width: 48px;
  overflow-x: hidden;
  background: var(--background, #f3f4f6);
}

.secondary-sidebar.collapsed::-webkit-scrollbar {
  display: none;
  width: 0px;
}

.secondary-sidebar.collapsed .sidebar-header span,
.secondary-sidebar.collapsed .view-all-topics,
.secondary-sidebar.collapsed .topic-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state - content fades in after width animation starts */
.secondary-sidebar:not(.collapsed) .sidebar-header span,
.secondary-sidebar:not(.collapsed) .view-all-topics,
.secondary-sidebar:not(.collapsed) .topic-nav {
  transition:
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

.secondary-sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 12px 8px;
  border-bottom: none;
  background: var(--background, #f3f4f6);
}

.secondary-sidebar.collapsed .collapse-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--background);
  border-radius: 50%;
  opacity: 1;
  visibility: visible;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Secondary Sidebar Scrollbar */
.secondary-sidebar::-webkit-scrollbar {
  width: 0px;
}

.secondary-sidebar::-webkit-scrollbar-track {
  background: var(--background-dark, #f3f4f6);
  border-radius: 10px;
}

.secondary-sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-color, #e81123);
  border-radius: 10px;
}

.secondary-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark, #c81020);
}

/* Secondary Sidebar Header */
.secondary-sidebar .sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: var(--background, #ffffff);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: hidden;
}

.secondary-sidebar .sidebar-header span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  background: var(--background, #f3f4f6);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.collapse-btn:hover {
  background: var(--background-dark, #f3f4f6);
  color: var(--primary-color, #1f2937);
}

.collapse-btn i {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.secondary-sidebar.collapsed .collapse-btn i {
  transform: rotate(180deg);
}

/* View All Topics Link */
.view-all-topics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  color: var(--text-dark, #1f2937);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--background-dark, #f3f4f6);
  transition: background 0.2s;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  white-space: nowrap;
  overflow: hidden;
}

.view-all-topics:hover {
  background: var(--background-alt, #e5e7eb);
}

.view-all-topics i {
  color: var(--primary-color, #e81123);
  transition: transform 0.2s;
}

.view-all-topics:hover i {
  transform: translateX(4px);
}

/* Legacy .left-sidebar support - redirect to secondary-sidebar */

/* Left Sidebar - Syllabus Navigation */
.left-sidebar {
  background: var(--background);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  /* box-shadow: 6px 0 15px rgba(0, 0, 0, 0.1); */
}

/* Custom Scrollbar for Left Sidebar */
.left-sidebar::-webkit-scrollbar {
  width: 8px;
  padding: auto;
}

.left-sidebar::-webkit-scrollbar-track {
  background: var(--background-dark);
  border-radius: 10px;
  padding: 1rem;
}

.left-sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
  margin: 1rem;
}

.left-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-shade);
}

.left-sidebar .sidebar-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  border: none;
  padding: 0;
}

/* Unit Section Styling */
.unit-section {
  margin-bottom: 1.5rem;
}

.unit-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: var(--background-dark);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.unit-title:hover {
  background: var(--background-alt);
}

.unit-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-dark);
  font-weight: bold;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.unit-title-text {
  flex: 1;
}

.unit-topics {
  max-height: 2000px;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
  opacity: 1;
}

.unit-topics.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Topic Item Styling (new simpler style) */
.topic-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-light);
  transition:
    background 0.2s,
    color 0.2s;
  white-space: wrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item:hover {
  background: var(--background-dark);
  color: var(--text-dark);
}

.topic-item.active {
  background: var(--primary-color);
  color: white;
  font-weight: 500;
}

.topic-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 3px;
  flex-shrink: 0;
}

.topic-item.completed .topic-checkbox {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  position: relative;
}

.topic-item.completed .topic-checkbox::after {
  content: "✓";
  position: absolute;
  color: white;
  font-size: 10px;
  top: -2px;
  left: 2px;
}

/* Subsection Styling (non-interactive labels) */
.subsection-container {
  margin-bottom: 0.5rem;
}

.subsection-header {
  padding: 0.5rem 0.75rem;
  padding-left: 1.5rem; /* Left padding for visual grouping */
  cursor: default; /* Not clickable */
  pointer-events: none; /* Disable all interactions */
}

.subsection-title {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 1; /* Dimmed appearance */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subsection-topics {
  padding-left: 1.5rem; /* Indent topics under subsection */
}

/* Center Content Area */
.content-area {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: var(--background-alt);
  padding: 3rem;
  position: relative;
}

.content-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Sticky wrapper for navigation + tabs */
.sticky-header {
  position: -webkit-sticky;
  position: sticky;
  top: 45px; /* Below navbar */
  z-index: 100;
  background: var(--background-alt);
  transition: box-shadow 0.3s ease;
  padding: 1rem 0.75rem;
}

/* Add shadow when stuck (controlled by JS) */
.sticky-header.is-stuck {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--border-color);
  display: block;
  margin-top: 2rem;
}

.content-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.content-meta a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.content-meta a:hover {
  color: var(--primary-color);
}

.content-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  background: inherit;
}

.content-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--background-dark);
  color: var(--text-dark);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
}

.content-nav-btn:hover {
  background: var(--background-alt);
  cursor: pointer;
  transform: translateY(-2px);
  border: 1px solid var(--border-color);
}

/* Bottom Navigation Buttons */
.bottom-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.content-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.reading-content {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.8;
  color: var(--text-dark);
  padding: var(--spacing-md);
}

/* Card-Based Structure for Content Sections */
.reading-content > h2 {
  font-family: var(--font-family);
  font-size: 2rem;
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  color: var(--text-dark);
  padding: 1.5rem 2rem;
  background: var(--background-dark);
  border-radius: var(--radius-lg);
  border-left: 5px solid var(--primary-color);
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* Number styling in headings - removed red dot */
.reading-content > h2::before {
  content: none;
}

/* Content cards - wrap sections after h2 */
.reading-content > h2 ~ * {
  position: relative;
}

/* Group content in cards between h2 sections */
.reading-content h3 {
  font-family: var(--font-family);
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--text-dark);
  /* padding: 0.875rem 1.25rem; */
  /* background: var(--background-dark); */
  /* border-radius: var(--radius-md); */
  border-left: 0px solid var(--secondary-color);
  text-decoration: underline;
  text-underline-offset: 10px;
}

/* Better paragraph spacing */
.reading-content p {
  margin-bottom: 1.5rem;
  line-height: 1.8;
  padding: 0.5rem 0;
  color: var(--text-dark);
}

/* Enhanced list styling with custom bullets */
.reading-content ul,
.reading-content ol {
  margin: 1.5rem 0 2rem 0;
  padding-left: 2rem;
  list-style: none;
}

.reading-content ul li,
.reading-content ol li {
  margin-bottom: 0.5rem;
  padding-left: 2rem;
  position: relative;
  line-height: 2;
}

/* Custom bullet points */
.reading-content ul li::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.6rem;
  width: 8px;
  height: 8px;
  background: var(--text-dark);
  border-radius: 50%;
}

/* Custom numbered list */
.reading-content ol {
  counter-reset: custom-counter;
}

.reading-content ol li {
  counter-increment: custom-counter;
}

.reading-content ol li::before {
  content: counter(custom-counter);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  color: var(--text-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Two-column layout for example lists */
.reading-content ul.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

/* Strong/Bold text enhancement */
.reading-content strong,
.reading-content b {
  font-weight: 600;
  color: var(--primary-color);
  padding: 0.1rem 0.2rem;
  background: rgba(232, 17, 35, 0);
  border-radius: 3px;
}

/* Callout Boxes - Key Takeaways */
.key-takeaway {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--secondary-color);
  padding: 2rem;
  margin: 2.5rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.key-takeaway::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(
    135deg,
    var(--secondary-color) 0%,
    transparent 100%
  );
  opacity: 0.05;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.key-takeaway-title {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--secondary-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.key-takeaway-title i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary-color);
  color: white;
  border-radius: 50%;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.key-takeaway ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.key-takeaway ul li {
  padding-left: 2rem;
  margin-bottom: 0.875rem;
  position: relative;
  line-height: 1.7;
}

.key-takeaway ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 1.125rem;
}

/* Callout Boxes - Exam Tips */
.exam-tip {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--accent-orange);
  padding: 2rem;
  margin: 2.5rem 0;
  border-radius: var(--radius-lg);
  font-family: var(--font-family);
  font-size: 0.9375rem;
  box-shadow: var(--shadow-md);
  position: relative;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.exam-tip::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(
    135deg,
    var(--accent-orange) 0%,
    transparent 100%
  );
  opacity: 0.05;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.exam-tip-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent-orange);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.exam-tip-title i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-orange);
  color: white;
  border-radius: 50%;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Additional callout box types */
.info-box {
  background: rgba(59, 130, 246, 0.08);
  border-left: 0px solid #3b82f6;
  padding: 2rem;
  margin: 2.5rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
}

.info-box-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: #3b82f6;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-box-title i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.warning-box {
  background: rgba(239, 68, 68, 0.08);
  border-left: 4px solid var(--accent-red);
  padding: 2rem;
  margin: 2.5rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
}

.warning-box-title {
  font-weight: 700;
  font-size: 1.125rem;
  /* color: var(--accent-red); */
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.warning-box-title i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-red);
  color: white;
  border-radius: 50%;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Tables styling */
.reading-content table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--background);
  display: table;
  table-layout: auto;
}

/* Ensure table container takes full width */
.reading-content > table,
.reading-content div > table {
  width: 100%;
}

.reading-content table thead {
  background: var(--primary-color);
  color: white;
}

.reading-content table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reading-content table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.reading-content table tbody tr {
  transition: background var(--transition-fast);
}

.reading-content table tbody tr:hover {
  background: var(--background-dark);
}

.reading-content table tbody tr:last-child td {
  border-bottom: none;
}

/* Code blocks and inline code */
.reading-content code {
  background: var(--background-dark);
  color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
}

.reading-content pre {
  background: var(--background-dark);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.reading-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-dark);
}

/* Blockquotes */
.reading-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: var(--background-dark);
  border-left: 5px solid var(--primary-color);
  border-radius: var(--radius-lg);
  font-style: italic;
  color: var(--text-light);
  box-shadow: var(--shadow-sm);
}

.reading-content blockquote p {
  margin: 0;
}

/* Images in content */
.reading-content img {
  width: max-content;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 2rem auto;
  /* box-shadow: var(--shadow-lg); */
  transition: transform var(--transition-base);
  display: block;
  padding: 3rem;
  background: #fff;
}

/* .reading-content img:hover {
  transform: scale(1.01);
} */

/* Horizontal rules */
.reading-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border-color),
    transparent
  );
  margin: 3rem 0;
}

/* Section dividers with text */
.reading-content .section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 3rem 0;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.875rem;
}

.reading-content .section-divider::before,
.reading-content .section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.reading-content .section-divider::before {
  margin-right: 1rem;
}

.reading-content .section-divider::after {
  margin-left: 1rem;
}

/* Definition terms */
.reading-content dt {
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 1rem;
  font-size: 1.125rem;
}

.reading-content dd {
  margin-left: 2rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--background-dark);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--secondary-color);
}

/* Highlighted/marked text */
.reading-content mark {
  background: rgba(232, 17, 35, 0.15);
  color: var(--text-dark);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* Smooth scroll behavior */
.reading-content {
  scroll-behavior: smooth;
}

/* Fade-in animation for content sections */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reading-content > * {
  animation: fadeInUp 0.6s ease-out backwards;
}

.reading-content > *:nth-child(1) {
  animation-delay: 0.05s;
}
.reading-content > *:nth-child(2) {
  animation-delay: 0.1s;
}
.reading-content > *:nth-child(3) {
  animation-delay: 0.15s;
}
.reading-content > *:nth-child(4) {
  animation-delay: 0.2s;
}
.reading-content > *:nth-child(5) {
  animation-delay: 0.25s;
}

/* Hover effects for interactive elements */
.reading-content a {
  color: var(--primary-color);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
  font-weight: 500;
}

.reading-content a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-base);
}

.reading-content a:hover {
  color: var(--primary-dark);
}

.reading-content a:hover::after {
  width: 100%;
}

/* Focus visible for accessibility */
.reading-content *:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* Print styles for better printouts */
@media print {
  .reading-content {
    padding: 0;
  }

  .reading-content > h2::before {
    display: none;
  }

  .key-takeaway,
  .exam-tip,
  .info-box,
  .warning-box {
    page-break-inside: avoid;
  }

  .reading-content img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* Right Sidebar - Tools & Resources */
.right-sidebar {
  background: var(--background);
  border-left: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}

/* Custom Scrollbar for Right Sidebar */
/* .right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.right-sidebar::-webkit-scrollbar-track {
  background: var(--background-dark);
  border-radius: 10px;
}

.right-sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
} */

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.toc-item {
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  font-size: 0.875rem;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.toc-item:hover {
  background: var(--background-dark);
  color: var(--text-dark);
}

.toc-item.active {
  border-left-color: var(--primary-color);
  background: var(--background-dark);
  color: var(--text-dark);
  font-weight: 500;
}

.resource-btn {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--background);
  color: var(--text-dark);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.resource-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.resource-btn i {
  font-size: 1rem;
}

.progress-box {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
}

.progress-bar-container {
  height: 8px;
  background: var(--background-dark);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.complete-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.75rem;
}

.complete-btn:hover {
  background: var(--primary-dark);
}

.complete-btn.completed {
  background: #22c55e;
  cursor: default;
}

.complete-btn.completed:hover {
  background: #16a34a;
}

/* Action Button Styles */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
  font-size: var(--font-size-base);
}

.action-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(232, 17, 35, 0.3);
}

.action-btn i {
  font-size: 1rem;
}

/* Quick Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  color: var(--primary-color);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Study Timer */
.timer-box {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.timer-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  font-family: "Courier New", monospace;
  margin-bottom: 0.75rem;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.timer-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--background-alt);
  color: var(--text-dark);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.timer-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.study-streak {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.study-streak i {
  color: #ff6b35;
}

/* Key Terms List */
.terms-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.term-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.term-item:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.term-word {
  font-weight: 500;
}

.term-item i {
  font-size: 0.75rem;
  opacity: 0.5;
}

/* Related Topics */
.related-topics {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.related-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.related-link:hover {
  background: var(--background-dark);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.related-link i {
  font-size: 0.75rem;
}

/* Highlights */
.highlight-btn {
  background: var(--background-dark);
  border-color: var(--border-color);
}

.highlights-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 0.5rem;
  text-align: center;
}

.highlights-count i {
  color: var(--primary-color);
}

/* Help Box */
.help-box {
  background: linear-gradient(135deg, var(--primary-color) 0%, #c00e1e 100%);
  color: white;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.help-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.help-text {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.help-btn {
  width: 100%;
  padding: 0.625rem;
  background: white;
  color: var(--primary-color);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.help-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ===================================
   SIDEBAR TOGGLE BUTTONS
   =================================== */

.sidebar-toggles {
  display: none;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  justify-content: space-between;
  /* Sticky properties for mobile */
  position: -webkit-sticky;
  position: sticky;
  top: 60px;
  z-index: 101; /* Above sticky-header */
  background: var(--background-alt);
  padding-bottom: 1rem;
  transition: box-shadow 0.3s ease;
}

/* Add shadow when stuck */
.sidebar-toggles.is-stuck {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.sidebar-toggle-btn i {
  font-size: 1rem;
}

/* Backdrop for overlay sidebars */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

@media (max-width: 1780px) {
  .subject-header {
    padding: var(--spacing-lg) 0;
  }

  .subject-icon-large {
    font-size: 4.25rem;
  }

  .layout-grid {
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-lg);
  }

  .sidebar {
    padding: var(--spacing-md);
  }

  .welcome-text h2 {
    font-size: 2.125rem;
  }

  .welcome-text p {
    font-size: 1rem;
  }

  .welcome-header-layout {
    gap: 2.5rem;
  }

  .welcome-image {
    flex: 0 0 300px;
  }

  .feature-item {
    padding: 1.25rem;
    gap: 0.875rem;
  }

  .feature-Icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .feature-Icon i {
    font-size: 1.25rem;
  }

  .content-area {
    width: 75%;
  }

  .main-container {
    grid-template-columns:
      var(--primary-sidebar-width) var(--secondary-sidebar-width)
      1fr;
  }
}

/* Responsive Design for New Layout */
/* Medium Desktop Optimization */
@media (max-width: 1366px) {
  .subject-header {
    padding: var(--spacing-lg) 0;
  }

  .subject-icon-large {
    font-size: 4.25rem;
  }

  .layout-grid {
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-lg);
  }

  .sidebar {
    padding: var(--spacing-md);
  }

  .welcome-text h2 {
    font-size: 2.125rem;
  }

  .welcome-text p {
    font-size: 1rem;
  }

  .welcome-header-layout {
    gap: 2.5rem;
  }

  .welcome-image {
    flex: 0 0 300px;
  }

  .feature-item {
    padding: 1.25rem;
    gap: 0.875rem;
  }

  .feature-Icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .feature-Icon i {
    font-size: 1.25rem;
  }

  .content-area {
    width: 75%;
  }

  .main-container {
    grid-template-columns:
      var(--primary-sidebar-width) var(--secondary-sidebar-width)
      1fr;
  }

  .topic-content {
    background: none;
    width: 100%; /* Make it fluid */
    max-width: 100%; /* Prevent overflow */
    overflow-x: hidden; /* Prevent horizontal scroll */
  }
}

/* Tablet: Primary sidebar icon-only mode */
@media (max-width: 1200px) {
  :root {
    --primary-sidebar-width: 64px;
    --secondary-sidebar-width: 280px;
  }

  /* Hide text labels in primary sidebar, show icons only */
  .primary-sidebar .side-nav-item span,
  .primary-sidebar .nav-section-label,
  .menu-toggle-btn span {
    display: none;
  }

  .primary-sidebar .side-nav-item {
    justify-content: center;
    padding: 14px;
    border-left: none;
  }

  .primary-sidebar .side-nav-item i {
    font-size: 1.125rem;
  }

  .menu-toggle-btn {
    justify-content: center;
    padding: 16px;
  }

  .menu-toggle-btn i {
    font-size: 1.25rem;
  }

  .main-container {
    grid-template-columns:
      var(--primary-sidebar-width) var(--secondary-sidebar-width)
      1fr;
  }
}

@media (max-width: 1024px) {
  /* Show toggle buttons */
  .sidebar-toggles {
    display: flex;
  }

  /* Adjust sticky-header to sit below mobile toggles */
  .sticky-header {
    top: calc(60px + 60px); /* Navbar + toggles height */
  }

  /* Make main container single column on medium screens */
  .main-container,
  .main-container.primary-collapsed,
  .main-container.secondary-collapsed,
  .main-container.primary-collapsed.secondary-collapsed {
    grid-template-columns: 1fr;
  }

  /* Convert NEW sidebars to overlay mode */
  .primary-sidebar,
  .secondary-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    height: calc(100vh - 60px);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    will-change: transform;
  }

  .primary-sidebar {
    left: 0;
    width: 240px;
    z-index: 1001;
  }

  /* Override collapsed state on mobile - show full width when active */
  .primary-sidebar.collapsed {
    width: 240px;
  }

  .secondary-sidebar.collapsed {
    width: 300px;
  }

  /* Show text labels on mobile overlay (override collapsed styles) */
  .primary-sidebar .side-nav-item span,
  .primary-sidebar .nav-section-label,
  .primary-sidebar .menu-toggle-btn span,
  .primary-sidebar.collapsed .side-nav-item span,
  .primary-sidebar.collapsed .nav-section-label,
  .primary-sidebar.collapsed .menu-toggle-btn span {
    display: inline;
    opacity: 1;
    width: auto;
    visibility: visible;
  }

  .primary-sidebar .side-nav-item,
  .primary-sidebar.collapsed .side-nav-item {
    justify-content: flex-start;
    padding: 10px 20px;
    border-left: 3px solid transparent;
  }

  .primary-sidebar .menu-toggle-btn,
  .primary-sidebar.collapsed .menu-toggle-btn {
    justify-content: flex-start;
    padding: 16px 20px;
  }

  .secondary-sidebar {
    left: 0;
    width: 300px;
    z-index: 1000;
  }

  /* Override secondary collapsed on mobile */
  .secondary-sidebar .sidebar-header span,
  .secondary-sidebar .view-all-topics,
  .secondary-sidebar .topic-nav,
  .secondary-sidebar.collapsed .sidebar-header span,
  .secondary-sidebar.collapsed .view-all-topics,
  .secondary-sidebar.collapsed .topic-nav {
    opacity: 1;
    visibility: visible;
  }

  .secondary-sidebar .sidebar-header,
  .secondary-sidebar.collapsed .sidebar-header {
    justify-content: space-between;
    padding: 16px 20px;
  }

  /* Active state - slide in (mobile overlay) */
  .primary-sidebar.active {
    transform: translateX(0);
  }

  .secondary-sidebar.active {
    transform: translateX(0);
  }

  /* When primary is open, secondary slides next to it (stacked) */
  .primary-sidebar.active ~ .secondary-sidebar.active {
    transform: translateX(240px);
  }

  /* Convert LEGACY sidebars to overlay mode (for backward compatibility) */
  .left-sidebar,
  .right-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    width: 320px;
    height: calc(100vh - 60px);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    will-change: transform;
  }

  .left-sidebar {
    left: 0;
    transform: translateX(-100%);
  }

  .right-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
    display: block; /* Re-enable right sidebar */
  }

  /* Active state - slide in */
  .left-sidebar.active {
    transform: translateX(0);
  }

  .right-sidebar.active {
    transform: translateX(0);
  }

  .section-dark2 {
    padding: 0rem;
  }

  .content-area {
    padding: 1.5rem;
    width: 100%;
    margin: 0 auto;
  }

  .reading-content img {
    height: auto;
    max-width: 100%;
    page-break-inside: avoid;
    border-radius: var(--radius-lg);
    margin: 2rem auto;
    /* box-shadow: var(--shadow-lg); */
    transition: transform var(--transition-base);
    display: block;
    padding: 5rem;
    background: #fff;
  }
}

@media (max-width: 768px) {
  /* Welcome section */
  .welcome-header-layout {
    flex-direction: column;
    gap: 2rem;
  }

  .welcome-image {
    flex: 0 0 auto;
    width: 100%;
    max-width: 300px;
  }

  .welcome-text {
    flex: 1;
    padding: 1rem;
  }

  .welcome-text h2 {
    font-size: 2rem;
  }

  .welcome-text p {
    font-size: 1rem;
  }

  /* Subject header and content canvas */
  .subject-header h1 {
    font-size: var(--font-size-3xl);
  }

  .content-canvas {
    padding: var(--spacing-md);
    min-width: unset;
    width: 100%;
    flex-direction: column;
  }

  .topic-title {
    font-size: var(--font-size-2xl);
    word-wrap: break-word;
  }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .tab-button {
    white-space: nowrap;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
  }

  /* Questions header and actions */
  .questions-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .questions-actions {
    flex-direction: column;
    width: 100%;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Notes content adjustments */
  .notes-content {
    font-size: var(--font-size-base);
    padding: 0;
  }

  .notes-content h1,
  .notes-content h2,
  .notes-content h3,
  .notes-content h4 {
    word-wrap: break-word;
  }

  /* Graph container */
  .graph-container {
    padding: var(--spacing-sm);
    overflow-x: auto;
  }

  /* Welcome screen */
  .welcome-screen {
    padding: 2rem 1rem;
  }

  /* Comparison table */
  .comparison-table {
    font-size: var(--font-size-xs);
  }

  .comparison-table thead th,
  .comparison-table tbody td {
    padding: 0.75rem var(--spacing-xs);
  }

  .comparison-table thead th {
    font-size: var(--font-size-sm);
  }

  /* Main container and sidebars */
  .main-container {
    grid-template-columns: 1fr;
  }

  /* Reduce NEW sidebar widths on mobile */
  .primary-sidebar {
    width: 200px;
  }

  .secondary-sidebar {
    width: 260px;
  }

  /* Adjust stacked position for smaller screens */
  .primary-sidebar.active ~ .secondary-sidebar.active {
    transform: translateX(200px);
  }

  /* Reduce LEGACY sidebar width on mobile */
  .left-sidebar,
  .right-sidebar {
    width: 280px;
  }

  .content-area {
    padding: 1rem;
    width: 100%;
    margin: 0;
  }

  /* Responsive navigation and title */
  .content-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .content-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .content-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .content-nav-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Bottom navigation buttons responsive */
  .bottom-nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Reduce sticky header padding on mobile */
  .sticky-header {
    padding-top: 1.5rem;
  }

  /* Responsive adjustments for reading content */
  .reading-content {
    padding: var(--spacing-sm);
  }

  .reading-content > h2 {
    font-size: 1.5rem;
    padding: 1rem 1.25rem;
    margin: 2rem 0 1rem;
  }

  .reading-content > h2::before {
    width: 32px;
    height: 32px;
  }

  .reading-content h3 {
    font-size: 1.125rem;
    padding: 0.75rem 1rem;
  }

  .reading-content ul.two-column {
    grid-template-columns: 1fr;
  }

  .key-takeaway,
  .exam-tip,
  .info-box,
  .warning-box {
    padding: 1.25rem;
    margin: 1.5rem 0;
  }

  .key-takeaway-title,
  .exam-tip-title,
  .info-box-title,
  .warning-box-title {
    font-size: 1rem;
  }

  .key-takeaway-title i,
  .exam-tip-title i,
  .info-box-title i,
  .warning-box-title i {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .reading-content table {
    font-size: 0.875rem;
  }

  .reading-content table th,
  .reading-content table td {
    padding: 0.75rem 1rem;
  }

  .reading-content img {
    height: auto;
    max-width: 100%;
    page-break-inside: avoid;
    border-radius: var(--radius-lg);
    margin: 2rem auto;
    /* box-shadow: var(--shadow-lg); */
    transition: transform var(--transition-base);
    display: block;
    padding: 2rem;
    background: #fff;
  }
}

/* ===================================
   PROFESSIONAL NOTE STYLES WITH DARK MODE
   =================================== */

/* Content Section Wrapper - Groups related subtopics */
.content-section {
  background: var(--background-dark);
  padding: 2rem;
  margin: 2rem 0;
  border-radius: var(--radius-md);
  border: 0px solid var(--border-color);
}

:root[data-theme="dark"] .content-section {
  background: var(--background-dark);
  border: 0px solid var(--border-color);
}

/* Worked Example Box - Green with checkmark */
.worked-example {
  background: rgba(16, 185, 129, 0.08);
  border-left: 1px solid var(--secondary-color);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: var(--radius-md);
}

.worked-example-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--secondary-dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.worked-example-title::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--secondary-color);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.125rem;
}

.worked-example .calculation-step {
  margin: 0.75rem 0;
  padding-left: 1rem;
  border-left: 1px solid var(--border-color);
  font-family: "Courier New", monospace;
}

:root[data-theme="dark"] .worked-example {
  background: rgba(16, 185, 129, 0.12);
}

:root[data-theme="dark"] .worked-example-title {
  color: var(--secondary-color);
}

/* Definition Box */
.definition-box {
  border-left: 0px solid #4b5563;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background-color: var(--background-alt);
  /* border-radius: var(--radius-sm); */
}

.definition-box .def-term {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.definition-box .def-meaning {
  color: var(--text-light);
  line-height: 1.6;
}

:root[data-theme="dark"] .definition-box {
  background-color: rgba(255, 255, 255, 0.03);
  border-left-color: #6b7280;
}

/* Note Box */
.note-box {
  background: var(--background-alt);
  border-left: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  /* border-radius: var(--radius-sm); */
}

.note-box .note-label {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

:root[data-theme="dark"] .note-box {
  background: rgba(255, 255, 255, 0.03);
  border-left-color: #4b5563;
}

/* Key Points Box */
.key-points-box {
  background: rgba(59, 130, 246, 0.05);
  border-left: 1px solid #3b82f6;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  /* border-radius: var(--radius-sm); */
}

.key-points-box .box-title {
  font-weight: 600;
  color: #3b82f6;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.key-points-box ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.key-points-box ul li {
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  line-height: 1.6;
}

.key-points-box ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #3b82f6;
  font-weight: bold;
  font-size: 1.2em;
}

:root[data-theme="dark"] .key-points-box {
  background: rgba(59, 130, 246, 0.08);
  border-left-color: #60a5fa;
}

:root[data-theme="dark"] .key-points-box .box-title {
  color: #60a5fa;
}

:root[data-theme="dark"] .key-points-box ul li::before {
  color: #60a5fa;
}

/* Formula Box */
.formula-box {
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  background-color: var(--background-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: left ;
}

.formula-box .formula {
  font-family: "Courier New", monospace;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0.5rem 0;
}

.formula-box .formula-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

:root[data-theme="dark"] .formula-box {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: #374151;
}

/* Diagram Placeholder */
.diagram-placeholder {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  padding: 2rem;
  padding-left: 4rem;
  text-align: left;
  border-radius: 8px;
  margin: 1rem 0;
}

.diagram-placeholder strong {
  display: block;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.diagram-placeholder p {
  font-size: 0.875rem;
  color: #94a3b8;
  margin: 0;
}

:root[data-theme="dark"] .diagram-placeholder {
  background: #f8fafc;
  border-color: #475569;
}

:root[data-theme="dark"] .diagram-placeholder strong {
  color: #94a3b8;
}

:root[data-theme="dark"] .diagram-placeholder p {
  color: #64748b;
}

/* Interactive Container */
.interactive-container {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--background);
}

.interactive-container .interactive-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 1rem;
  font-size: 1rem;
}

:root[data-theme="dark"] .interactive-container {
  background-color: rgba(255, 255, 255, 0.02);
  border-color: #374151;
}

/* Comparison Tables with Dark Mode */
.reading-content .comparison-table {
  margin: 1.5rem 0;
}

.reading-content .comparison-table table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.reading-content .comparison-table th {
  background-color: var(--background-dark);
  color: var(--text-dark);
  font-weight: 600;
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 20px solid var(--border-color);
}

.reading-content .comparison-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-light);
  background: var(--background);
}

.reading-content .comparison-table tr:last-child td {
  border-bottom: none;
}

:root[data-theme="dark"] .comparison-table th {
  background-color: var(--primary-color);
}

:root[data-theme="dark"] .comparison-table td {
  background: rgba(255, 255, 255, 0.02);
}

/* Headings with Dark Mode */
.reading-content h2 {
  color: var(--text-dark);
  font-weight: 700;
  font-size: var(--font-size-3xl);
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

.reading-content h3 {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.reading-content h4 {
  color: var(--text-light);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Reading Content with Dark Mode */
.reading-content p {
  line-height: 1.7;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.reading-content ul,
.reading-content ol {
  line-height: 1.7;
  margin-bottom: 1rem;
  padding-left: 1rem;
  color: var(--text-light);
}

.reading-content li {
  margin-bottom: 0.5rem;
}

.reading-content strong {
  font-weight: 600;
  color: var(--text-dark);
}

.reading-content code {
  background: var(--background-dark);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

:root[data-theme="dark"] .reading-content code {
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .reading-content img {
  opacity: 0.9;
  border-radius: var(--radius-sm);
}

/* Update Existing Info Boxes for Consistency */
.reading-content .info-box {
  background-color: rgba(59, 130, 246, 0.05);
  border-left: 3px solid #3b82f6;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
}

.reading-content .info-box.tip {
  background-color: rgba(16, 185, 129, 0.05);
  border-left-color: var(--secondary-color);
}

.reading-content .info-box.warning {
  background-color: rgba(245, 158, 11, 0.05);
  border-left-color: var(--accent-orange);
}

:root[data-theme="dark"] .reading-content .info-box {
  background-color: rgba(59, 130, 246, 0.08);
}

:root[data-theme="dark"] .reading-content .info-box.tip {
  background-color: rgba(16, 185, 129, 0.08);
}

:root[data-theme="dark"] .reading-content .info-box.warning {
  background-color: rgba(245, 158, 11, 0.08);
}

/* Keep icons subtle */
.reading-content .idea-light,
.reading-content .warning-icon {
  opacity: 0.7;
  font-size: 1em;
}

/* ===================================
   CHEMISTRY NOTES SPECIFIC STYLES
   Dark Mode Compatible
   =================================== */

/* Placeholder Box - For diagrams and interactive elements */
.placeholder-box {
  background: var(--background-alt);
  border: 2px dashed var(--border-color);
  padding: 2rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  text-align: center;
}

.placeholder-box .placeholder-label {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.placeholder-box .placeholder-desc {
  color: var(--text-light);
  line-height: 1.6;
  font-size: var(--font-size-sm);
  font-style: italic;
}

:root[data-theme="dark"] .placeholder-box {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-color);
}

:root[data-theme="dark"] .placeholder-box .placeholder-desc {
  color: var(--text-light);
}

/* Equation Box - Already exists but ensure dark mode */
.equation-box {
  background-color: var(--background-alt);
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--primary-color);
  font-family: "Courier New", Courier, monospace;
  font-weight: 600;
  margin: 1.5rem 0;
  text-align: center;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
}

.equation-box p {
  margin: 0.5rem 0;
  color: var(--text-dark);
}

.equation-box .equation-note {
  font-family: var(--font-family);
  font-weight: 400;
  font-size: var(--font-size-sm);
  color: var(--text-light);
  text-align: left;
  font-style: italic;
  margin-top: 0.5rem;
}

:root[data-theme="dark"] .equation-box {
  background-color: rgba(255, 255, 255, 0.03);
  border-left-color: var(--primary-color);
}

:root[data-theme="dark"] .equation-box p {
  color: var(--text-dark);
}

/* Key Points List - Ensure theme compatibility */
.notes-content .key-points,
.content-section .key-points {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0;
  color: var(--text-dark);
}

.notes-content .key-points li,
.content-section .key-points li {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  position: relative;
  line-height: 1.6;
  color: var(--text-dark);
  list-style: none;
}

.notes-content .key-points li::before,
.content-section .key-points li::before {
  content: "";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 11em;
}

/* Font Awesome xmark icon styling */
.notes-content .fa-xmark,
.content-section .fa-xmark {
  color: var(--primary-color);
  margin-right: 0.5rem;
}

/* Content Section - Ensure theme compatibility */
.notes-content .content-section h2 {
  color: var(--text-dark);
  border-bottom-color: var(--primary-color);
}

.notes-content .content-section h3 {
  color: var(--text-dark);
}

.notes-content .content-section p,
.notes-content .content-section li {
  color: var(--text-dark);
}

/* Comparison Table - Enhanced dark mode */
:root[data-theme="dark"] .comparison-table thead {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  opacity: 0.95;
}

:root[data-theme="dark"] .comparison-table tbody td:first-child {
  background-color: rgba(255, 255, 255, 0.03);
  border-right-color: var(--border-color);
}

:root[data-theme="dark"] .comparison-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

:root[data-theme="dark"] .comparison-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Definition and Note Boxes - Ensure text color in dark mode */
:root[data-theme="dark"] .definition-box .def-term {
  color: var(--text-dark);
}

:root[data-theme="dark"] .definition-box .def-meaning {
  color: var(--text-light);
}

:root[data-theme="dark"] .note-box {
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .note-box .note-label {
  color: var(--text-light);
}

:root[data-theme="dark"] .note-box p,
:root[data-theme="dark"] .note-box ul,
:root[data-theme="dark"] .note-box li {
  color: var(--text-dark);
}

/* Ensure all text in notes content is readable in dark mode */
:root[data-theme="dark"] .notes-content {
  color: var(--text-dark);
}

:root[data-theme="dark"] .notes-content h2,
:root[data-theme="dark"] .notes-content h3,
:root[data-theme="dark"] .notes-content h4 {
  color: var(--text-dark);
}

:root[data-theme="dark"] .notes-content p,
:root[data-theme="dark"] .notes-content li {
  color: var(--text-dark);
}

:root[data-theme="dark"] .notes-content strong {
  color: var(--text-dark);
}

/* Table inline styles - Override inline background colors for dark mode */
:root[data-theme="dark"] .comparison-table table tr[style*="background-color"] {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

:root[data-theme="dark"]
  .comparison-table
  table
  tr[style*="background-color"]:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Color-coded table rows for reactivity series and similar content */
/* Light mode - use subtle color hints */
.comparison-table tbody tr.row-red {
  background-color: #ffebee;
}

.comparison-table tbody tr.row-orange {
  background-color: #fff3e0;
}

.comparison-table tbody tr.row-yellow {
  background-color: #fff9c4;
}

.comparison-table tbody tr.row-green {
  background-color: #e8f5e9;
}

.comparison-table tbody tr.row-blue {
  background-color: #e3f2fd;
}

/* Dark mode - use very subtle tints */
:root[data-theme="dark"] .comparison-table tbody tr.row-red {
  background-color: rgba(244, 67, 54, 0.08);
}

:root[data-theme="dark"] .comparison-table tbody tr.row-orange {
  background-color: rgba(255, 152, 0, 0.08);
}

:root[data-theme="dark"] .comparison-table tbody tr.row-yellow {
  background-color: rgba(255, 235, 59, 0.08);
}

:root[data-theme="dark"] .comparison-table tbody tr.row-green {
  background-color: rgba(76, 175, 80, 0.08);
}

:root[data-theme="dark"] .comparison-table tbody tr.row-blue {
  background-color: rgba(33, 150, 243, 0.08);
}

/* Hover states for color-coded rows */
.comparison-table tbody tr.row-red:hover,
.comparison-table tbody tr.row-orange:hover,
.comparison-table tbody tr.row-yellow:hover,
.comparison-table tbody tr.row-green:hover,
.comparison-table tbody tr.row-blue:hover {
  filter: brightness(0.95);
}

:root[data-theme="dark"] .comparison-table tbody tr.row-red:hover,
:root[data-theme="dark"] .comparison-table tbody tr.row-orange:hover,
:root[data-theme="dark"] .comparison-table tbody tr.row-yellow:hover,
:root[data-theme="dark"] .comparison-table tbody tr.row-green:hover,
:root[data-theme="dark"] .comparison-table tbody tr.row-blue:hover {
  filter: brightness(1.15);
}

/* ===================================
   NO QUESTIONS EMPTY STATE
   =================================== */
.no-questions-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  background: var(--background-alt, #f9fafb);
  border-radius: var(--radius-lg, 12px);
  border: 1px dashed var(--border-color, #e5e7eb);
  margin: 1rem 0;
}

.no-questions-message i {
  font-size: 3rem;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 1rem;
}

.no-questions-message p {
  margin: 0;
}

.no-questions-message p:first-of-type {
  font-size: 1.1rem;
  color: var(--text-dark, #1f2937);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.no-questions-message .hint,
.no-questions-message p:last-of-type {
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
}

:root[data-theme="dark"] .no-questions-message {
  background: var(--background-alt, #1f2937);
  border-color: var(--border-color, #374151);
}

/* ===================================
   TOPICS SIDE BUTTON STYLES
   =================================== */
