/* Lesson Content Styling */
:root {
  --bg-dark: #0a0a0c;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-color: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

body {
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

.lesson-container {
  max-width: 800px;
  margin: 80px auto;
  padding: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
}

.lesson-header {
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 2rem;
}

.lesson-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lesson-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h2 {
  font-size: 1.8rem;
  margin-top: 3rem;
  color: var(--accent-color);
}

h3 {
  font-size: 1.3rem;
  margin-top: 2rem;
  color: #fff;
}

p, li {
  color: var(--text-main);
  opacity: 0.9;
}

code {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-color);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
}

pre {
  background: #111;
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid var(--glass-border);
}

pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
}

blockquote {
  border-left: 4px solid var(--accent-color);
  margin: 2rem 0;
  padding: 1rem 2rem;
  background: rgba(56, 189, 248, 0.05);
  border-radius: 4px 12px 12px 4px;
}

hr {
  border: 0;
  height: 1px;
  background: var(--glass-border);
  margin: 3rem 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.back-link:hover {
  transform: translateX(-5px);
  color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

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

th {
  color: var(--accent-color);
  font-weight: 700;
}

.success-criteria {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 3rem;
}

.success-criteria h2 {
  color: #22c55e;
  margin-top: 0;
}

.view-lesson-btn {
  background: var(--accent-color);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.view-lesson-btn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-2px);
}

.research-highlight {
  background: rgba(168, 85, 247, 0.05); /* Purple tint */
  border: 1px solid rgba(168, 85, 247, 0.2);
  padding: 1.5rem;
  border-radius: 12px;
  margin: 2rem 0;
}

.research-highlight h3 {
  color: #a855f7;
  margin-top: 0;
}

/* Sticky Chapter Bar (Dark Mode) */
.sticky-chapter-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(3, 7, 18, 0.85); /* Matches --primary-bg with transparency */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  margin: -2rem -2rem 2rem -2rem; /* Negative margin to stretch full width of container padding */
  border-radius: 20px 20px 0 0; /* Rounded top corners if inside a container, but usually top-level */
}

/* Fix for if the sticky bar is strictly inside .lesson-container padding */
/* We might need to adjust .lesson-container padding logic if we want strictly top-of-viewport stickiness. 
   Currently .lesson-container has 2rem padding. To stick to TOP of Browser Window, 
   nav needs to be outside or we use negative margins + top adjustment.
   However, sticking to top of CONTAINER is safer for layout. 
   Let's assume we want top of CONTAINER for now, or use top: 0 with the parent.
*/

.sticky-chapter-bar.is-stuck {
  background: rgba(3, 7, 18, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 0; /* Flatten corners when stuck if full width */
  margin: -2rem -2rem 2rem -2rem; /* Keep offset */
}

.nav-container {
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
}

.nav-chapter-num {
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--accent-color);
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.nav-current-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  opacity: 1;
  transition: opacity 0.2s;
}

.nav-right a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-right a:hover {
  color: #fff;
}

/* Reading Progress Bar */
.nav-progress-bar {
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color), #818cf8);
  width: 0%;
  transition: width 0.1s linear;
  position: absolute;
  bottom: 0;
  left: 0;
  box-shadow: 0 0 10px var(--accent-color);
}

/* Enhanced Header Banner */
.lesson-header {
  position: relative;
  overflow: hidden;
  /* Attempting a generic subtle pattern if no image is present */
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.1), transparent 40%);
}

/* Mobile Tweak */
@media (max-width: 600px) {
  .nav-current-title {
    display: none; /* Hide title on small screens */
  }
}

/* Copy Code Button */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    z-index: 10;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border-color: #22c55e;
}

/* ========================================
   PAYWALL STYLES (Newspaper Mode)
   ======================================== */
.paywall-blur {
    /* Gradual fade: visible at top, blur/fade toward bottom */
    mask-image: linear-gradient(to bottom, black 200px, rgba(0,0,0,0.5) 400px, transparent 600px);
    -webkit-mask-image: linear-gradient(to bottom, black 200px, rgba(0,0,0,0.5) 400px, transparent 600px);
    pointer-events: none;
    user-select: none;
    padding-bottom: 0 !important;
    overflow: hidden;
    max-height: 70vh;
}

.paywall-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, var(--bg-dark) 50%, rgba(10, 10, 12, 0.95) 70%, transparent 100%);
    z-index: 9999;
    pointer-events: auto;
}

.paywall-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.3), 0 25px 50px rgba(0,0,0,0.5);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    backdrop-filter: blur(10px);
    max-width: 380px;
    width: 90%;
    margin: 0 1rem;
    animation: floatUp 0.6s ease-out;
}

@keyframes floatUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.paywall-card h2 { 
    margin-top: 0; 
    color: #fff; 
    font-size: 1.4rem;
}

.paywall-card p { 
    color: var(--text-muted); 
    margin-bottom: 0.8rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.paywall-card .cta-button {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--accent-color), #0ea5e9);
    color: #000;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.paywall-card .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}

.paywall-card .cta-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.paywall-card .cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ========================================
   AUTH UI IN STICKY NAV
   ======================================== */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-auth {
    display: flex;
    align-items: center;
}

.nav-auth .cta-button.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: linear-gradient(135deg, var(--accent-color), #0ea5e9);
    color: #000;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-auth .cta-button.small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.floating-auth {
    background: rgba(30, 41, 59, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

