/* ----- Lesson View (school-friendly reading) ----- */
.lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  margin-bottom: var(--space-xl);
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  font-family: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--text-lg);
  line-height: 1.9;
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Headings */
.lesson-content h1 {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 3px solid;
  border-image: var(--accent-gradient) 1;
  line-height: 1.3;
}

.lesson-content h1:first-child {
  margin-top: 0;
}

.lesson-content h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
  line-height: 1.35;
}

.lesson-content h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  line-height: 1.4;
  padding-left: var(--space-md);
  border-left: 4px solid var(--accent-primary);
}

.lesson-content h4 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

/* Paragraphs */
.lesson-content p {
  margin-bottom: var(--space-lg);
  font-size: inherit;
  line-height: inherit;
}

/* Bold & italic */
.lesson-content strong {
  font-weight: 700;
  color: var(--text-primary);
}

.lesson-content em {
  font-style: italic;
  color: var(--text-primary);
  opacity: 0.9;
}

/* Links */
.lesson-content a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3);
  text-underline-offset: 3px;
  transition: all var(--transition-fast);
}

.lesson-content a:hover {
  color: var(--accent-primary-hover);
  text-decoration-color: var(--accent-primary);
}

/* Inline code */
.lesson-content code,
.hljs-inline {
  font-family: var(--font-mono);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  color: var(--text-accent);
  word-break: break-word;
}

.hljs-inline {
  color: var(--syntax-property);
  /* Give it a slightly different color if it's "code" */
}

/* Code blocks */
.lesson-content pre {
  background: var(--code-block-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
  line-height: 1.6;
}

.lesson-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

/* Syntax Highlighting (Highlight.js integration) */
.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
  color: var(--syntax-keyword);
  font-weight: 600;
}

.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name {
  color: var(--syntax-variable);
}

.hljs-string,
.hljs-doctag,
.hljs-regexp {
  color: var(--syntax-string);
}

.hljs-function,
.hljs-title,
.hljs-section,
.hljs-attribute {
  color: var(--syntax-function);
}

.hljs-attr,
.hljs-property,
.hljs-params,
.hljs-number {
  color: var(--syntax-property);
}

.hljs-comment,
.hljs-quote,
.hljs-deletion {
  color: var(--text-muted);
  font-style: italic;
}

.hljs-built_in,
.hljs-type,
.hljs-class {
  color: var(--syntax-function);
  border-bottom: 1px dashed hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3);
}

.hljs-meta {
  color: var(--text-muted);
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

/* Premium Code Block Wrapper */
.code-block-wrapper {
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--code-block-bg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.code-block-wrapper:hover {
  box-shadow: var(--shadow-md);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-md);
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

[data-theme="dark"] .code-block-header {
  background: rgba(255, 255, 255, 0.05);
}

.code-block-dots {
  display: flex;
  gap: 6px;
}

.code-block-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-1 {
  background: var(--mac-close);
}

.dot-2 {
  background: var(--mac-minimize);
}

.dot-3 {
  background: var(--mac-maximize);
}

.code-block-lang {
  flex: 1;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-mono);
  opacity: 0.6;
}

.code-copy-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.code-copy-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.code-copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

.code-block-wrapper pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* Unordered lists */
.lesson-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: var(--space-lg);
}

.lesson-content ul li {
  position: relative;
  padding-left: 28px;
  margin-bottom: var(--space-sm);
  line-height: 1.7;
}

.lesson-content ul li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gradient);
}

/* Nested lists */
.lesson-content ul ul {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.lesson-content ul ul li::before {
  background: var(--text-muted);
  width: 6px;
  height: 6px;
  top: 11px;
}

/* Ordered lists */
.lesson-content ol {
  padding-left: 0;
  margin-bottom: var(--space-lg);
  counter-reset: lesson-counter;
  list-style: none;
}

.lesson-content ol li {
  position: relative;
  padding-left: 36px;
  margin-bottom: var(--space-md);
  counter-increment: lesson-counter;
  line-height: 1.7;
}

.lesson-content ol li::before {
  content: counter(lesson-counter);
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  background: var(--accent-gradient);
  color: var(--accent-contrast);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Blockquotes */
.lesson-content blockquote {
  border-left: 4px solid var(--accent-primary);
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.05);
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.lesson-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal rules */
.lesson-content hr {
  border: none;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  margin: var(--space-2xl) 0;
  opacity: 0.3;
}

/* Images */
.lesson-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
  box-shadow: var(--shadow-md);
}

/* Tables */
.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.95em;
}

.lesson-content th,
.lesson-content td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  text-align: left;
}

.lesson-content th {
  background: var(--bg-glass);
  font-weight: 700;
  color: var(--text-primary);
}

.lesson-content tr:hover td {
  background: var(--bg-glass);
}

/* Checkmarks and emojis styling */
.lesson-content p:has(br) {
  margin-bottom: var(--space-md);
}




/* ----- Lessons List ----- */
.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-sm);
}

.lesson-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.lesson-num {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.lesson-info {
  flex: 1;
}

.lesson-title {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.lesson-meta-info {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ----- Lesson Navigation (Simple Links) ----- */
.lesson-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  margin: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-color);
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

.lesson-navigation--top {
  margin-top: 0;
  margin-bottom: var(--space-xl);
}

.lesson-navigation--bottom {
  border-top: 1px solid var(--border-color);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-xl);
}

.lesson-nav-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: all var(--transition-fast);
  max-width: 45%;
  cursor: pointer;
}

.lesson-nav-link .nav-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-weight: 400;
}

.lesson-nav-link .nav-title {
  font-size: var(--text-sm);
  color: var(--accent-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.lesson-nav-link:hover .nav-title {
  color: var(--accent-primary-hover);
  text-decoration: underline;
}

.lesson-nav-link.next-link {
  text-align: right;
  align-items: flex-end;
  margin-left: auto;
}

@media (max-width: 600px) {
  .lesson-nav-link .nav-title {
    max-width: 150px;
  }
}