/* Lightweight styles for Lessons panel */
#lessonsPanel { padding: 0; color: #222; line-height: 1.4; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
#lessonsPanel.panel { background: #ffffff !important; }

/* Header section with lesson content at top */
#lessonsPanel .lessonsHeader { 
  padding: 12px; 
  background: #f8f9fa; 
  border-bottom: 1px solid #e0e0e0; 
  flex-shrink: 0; 
}
#lessonsPanel .lessonsHeader h2 { margin: 0 0 8px 0; font-size: 18px; }
#lessonsPanel .lessonProgress { margin: 8px 0; font-weight: 600; color: #1976d2; }
#lessonsPanel .lessonContent { 
  margin-top: 8px; 
  background: #fff; 
  border: 1px solid #e0e0e0; 
  border-radius: 6px; 
  padding: 12px; 
  max-height: 200px; 
  overflow-y: auto; 
}
#lessonsPanel .lessonContent h3 { margin: 0 0 8px 0; font-size: 16px; }
#lessonsPanel .lessonContent p { margin: 0 0 8px 0; }
#lessonsPanel .lessonContent .startLesson { 
  background: #4caf50; 
  color: white; 
  border: none; 
  border-radius: 4px; 
  padding: 8px 16px; 
  cursor: pointer; 
  font-weight: 600; 
}
#lessonsPanel .lessonContent .startLesson:hover { background: #45a049; }
#lessonsPanel .step { margin-top: 10px; }

/* Tabbed interface */
#lessonsPanel .lessonsTabs { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
}
#lessonsPanel .tabButtons { 
  display: flex; 
  background: #f5f5f5; 
  border-bottom: 1px solid #e0e0e0; 
  flex-shrink: 0; 
}
#lessonsPanel .tabButton { 
  flex: 1; 
  padding: 12px 16px; 
  background: transparent; 
  border: none; 
  border-bottom: 3px solid transparent; 
  cursor: pointer; 
  font-weight: 600; 
  color: #666; 
  transition: all 0.2s; 
}
#lessonsPanel .tabButton:hover { 
  background: #e8f4fd; 
  color: #1976d2; 
}
#lessonsPanel .tabButton.active { 
  background: #fff; 
  color: #1976d2; 
  border-bottom-color: #1976d2; 
}
#lessonsPanel .tabContent { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
}
#lessonsPanel .tabPanel { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
}
#lessonsPanel .tabPanel:not(.active) { 
  display: none; 
}

/* Controls section */
#lessonsPanel .lessonsControls { 
  padding: 12px; 
  background: #fff; 
  border-bottom: 1px solid #e0e0e0; 
  flex-shrink: 0; 
}
#lessonsPanel .controls { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  flex-wrap: wrap; 
}
#lessonsPanel .lessonSearch { 
  flex: 1; 
  min-width: 150px; 
  padding: 6px 8px; 
  border: 1px solid #ddd; 
  border-radius: 4px; 
  font-size: 14px; 
}
#lessonsPanel .lessonLevel { 
  padding: 6px 8px; 
  border: 1px solid #ddd; 
  border-radius: 4px; 
  background: white; 
  font-size: 14px; 
}
#lessonsPanel .refreshLessons { 
  background: #1976d2; 
  color: white; 
  border: none; 
  border-radius: 4px; 
  padding: 6px 10px; 
  cursor: pointer; 
  font-size: 14px; 
}
#lessonsPanel .refreshLessons:hover { background: #145ea6; }

/* Scrollable lessons list */
#lessonsPanel .lessonsList { 
  flex: 1; 
  overflow-y: auto; 
  padding: 12px; 
  background: #fff; 
  min-height: 0; /* Important for flex scrolling */
}

/* Module and category grouping */
#lessonsPanel .module-group { margin-bottom: 24px; }
#lessonsPanel .module-title { 
  font-size: 18px; 
  font-weight: 700; 
  color: #1976d2; 
  margin: 0 0 12px 0; 
  padding-bottom: 6px; 
  border-bottom: 3px solid #e3f2fd; 
}
#lessonsPanel .category-group { margin-bottom: 12px; }
#lessonsPanel .category-header { 
  display: flex; 
  align-items: center; 
  padding: 8px 12px; 
  background: #f8f9fa; 
  border: 1px solid #e0e0e0; 
  border-radius: 6px; 
  cursor: pointer; 
  transition: background-color 0.2s; 
  user-select: none; 
}
#lessonsPanel .category-header:hover { 
  background: #e8f4fd; 
}
#lessonsPanel .category-caret { 
  font-size: 12px; 
  color: #1976d2; 
  margin-right: 8px; 
  transition: transform 0.2s; 
  min-width: 12px; 
}
#lessonsPanel .category-title { 
  font-size: 14px; 
  font-weight: 600; 
  color: #424242; 
  margin: 0; 
  flex: 1; 
}
#lessonsPanel .category-count { 
  font-size: 12px; 
  color: #666; 
  background: #e0e0e0; 
  padding: 2px 6px; 
  border-radius: 10px; 
}
#lessonsPanel .catalog { 
  margin-top: 8px; 
  transition: all 0.3s ease; 
  overflow: hidden; 
}
#lessonsPanel .catalog.collapsed { 
  max-height: 0; 
  margin-top: 0; 
  opacity: 0; 
}

/* Lesson items */
#lessonsPanel .catalog { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
}
#lessonsPanel .catalog .lessonItem { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  background: #f7f7f7; 
  border: 1px solid #ddd; 
  border-radius: 6px; 
  padding: 10px 12px; 
  margin: 6px 0; 
  transition: background-color 0.2s; 
}
#lessonsPanel .catalog .lessonItem:hover { background: #e8f4fd; }
#lessonsPanel .catalog .title { font-weight: 600; flex: 1; }
#lessonsPanel .catalog .meta { 
  font-size: 12px; 
  color: #666; 
  margin: 0 8px; 
  padding: 2px 6px; 
  background: #e0e0e0; 
  border-radius: 3px; 
}
#lessonsPanel .catalog .lessonItem button { 
  background: #1976d2; 
  color: white; 
  border: none; 
  border-radius: 4px; 
  padding: 6px 12px; 
  cursor: pointer; 
  font-size: 12px; 
}
#lessonsPanel .catalog .lessonItem button:hover { background: #145ea6; }

/* Completion badges */
#lessonsPanel .catalog .lessonItem.completed { 
  background: #e8f5e8; 
  border-color: #4caf50; 
}
#lessonsPanel .catalog .lessonItem.completed .title { color: #2e7d32; }
#lessonsPanel .catalog .lessonItem .badge { 
  background: #4caf50; 
  color: white; 
  border-radius: 50%; 
  width: 20px; 
  height: 20px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 12px; 
  font-weight: bold; 
  margin-right: 8px; 
}

.hide { display: none; }

/* Floating guide */
#lessonGuide { position: fixed; right: 12px; bottom: 12px; width: 320px; max-width: 90vw; max-height: 80vh; background: #ffffff; border: 1px solid #cfcfcf; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 1000; display: flex; flex-direction: column; }
#lessonGuide .lg-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: #1976d2; color: #fff; border-radius: 8px 8px 0 0; flex-shrink: 0; }
#lessonGuide .lg-header .lg-title { font-weight: 600; }
#lessonGuide .lg-header .lg-minimize, #lessonGuide .lg-header .lg-hide { background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; margin-left: 8px; }
#lessonGuide.minimized .lg-body { display: none; }
#lessonGuide .lg-body { padding: 10px; color: #222; overflow-y: auto; flex: 1; }
#lessonGuide .lg-step { margin-top: 8px; padding: 8px; background: #f4f8ff; border: 1px solid #e3eefc; border-radius: 6px; }
#lessonGuide .lg-learning-goals { margin-bottom: 12px; padding: 8px; background: #e8f5e8; border: 1px solid #c8e6c9; border-radius: 6px; }
#lessonGuide .lg-learning-goals h4 { margin: 0 0 6px 0; color: #2e7d32; font-size: 14px; }
#lessonGuide .lg-learning-goals ul { margin: 0; padding-left: 16px; }
#lessonGuide .lg-learning-goals li { margin: 2px 0; font-size: 13px; }

/* Blockly preview inside lessons (feature-flagged) */
#lessonsPanel .lessonBlocksSection { margin-top: 10px; }
#lessonsPanel .lesson-blocks-header { font-weight: 600; margin: 6px 0; }
#lessonsPanel .lesson-blocks { height: 220px; border: 1px solid #ddd; border-radius: 4px; background: #fff; }
