/* ==========================================
   IELTS বাংলা গাইড — Premium CSS Design System
   ========================================== */

/* ===== CSS Variables / Tokens ===== */
:root {
  --font-main: 'Inter', 'Hind Siliguri', sans-serif;
  --font-bengali: 'Hind Siliguri', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dark Theme Default */
  --bg-primary: #080b11;
  --bg-secondary: #0f1420;
  --bg-tertiary: #161d2d;
  --bg-card: #0f1420;
  --bg-hover: #1e2638;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.04);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #818cf8;

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-teal: #14b8a6;

  --gradient-hero: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 45%), 
                   radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 45%), 
                   #080b11;
  --gradient-accent: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --gradient-card: linear-gradient(135deg, #0f1420 0%, #161d2d 100%);
  --gradient-btn: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --sidebar-width: 290px;
  --navbar-height: 64px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow: 0 4px 20px -2px rgba(0,0,0,0.3), 0 2px 8px -1px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 30px -5px rgba(0,0,0,0.4), 0 4px 12px -2px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px 0 rgba(99, 102, 241, 0.15);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #4f46e5;

  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-green: #059669;
  --accent-yellow: #d97706;
  --accent-red: #dc2626;
  --accent-teal: #0d9488;

  --gradient-hero: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 45%), 
                   radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 45%), 
                   #f8fafc;
  --gradient-accent: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --gradient-card: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  
  --shadow: 0 4px 20px -2px rgba(0,0,0,0.06), 0 2px 8px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 35px -5px rgba(0,0,0,0.1), 0 4px 12px -2px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 20px 0 rgba(79, 70, 229, 0.1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal overflow globally */
img, video, iframe { max-width: 100%; height: auto; }
* { overflow-wrap: break-word; }

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: rgba(15, 20, 32, 0.7);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 1000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}
[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.75);
}

.navbar-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.navbar-center { flex: 1; max-width: 480px; }
.navbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Hamburger Menu Button */
.hamburger {
  display: flex; flex-direction: column; justify-content: center;
  gap: 5px; width: 40px; height: 40px;
  background: transparent; border: none; cursor: pointer;
  border-radius: var(--radius); padding: 8px;
  transition: var(--transition);
}
.hamburger:hover { background: var(--bg-hover); }
.hamburger span {
  display: block; height: 2px; background: var(--text-primary);
  border-radius: 2px; transition: var(--transition);
  width: 100%;
}
.hamburger span:nth-child(2) { width: 80%; }
.hamburger:hover span:nth-child(2) { width: 100%; }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-icon { font-size: 22px; filter: drop-shadow(0 2px 8px rgba(99,102,241,0.3)); }
.logo-text { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.logo-accent { background: var(--gradient-accent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Search Wrapper */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 0 16px;
  gap: 10px;
  transition: var(--transition);
}
.search-wrapper:focus-within {
  border-color: var(--text-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: var(--bg-secondary);
}
.search-icon { font-size: 14px; color: var(--text-muted); }
#searchInput {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-main); font-size: 14px;
  color: var(--text-primary); padding: 9px 0;
}
#searchInput::placeholder { color: var(--text-muted); }
.search-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 12px; padding: 2px 6px;
  border-radius: 50%; transition: var(--transition);
}
.search-clear:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Progress Pill */
.progress-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  box-shadow: var(--shadow);
}
.progress-icon { font-size: 14px; color: var(--accent-yellow); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Theme Toggle & Print */
.theme-toggle, .btn-print {
  width: 40px; height: 40px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--text-primary);
}
.theme-toggle:hover, .btn-print:hover { 
  background: var(--bg-hover); 
  transform: translateY(-2px); 
  border-color: var(--text-accent);
  box-shadow: var(--shadow);
}

/* ===== SEARCH OVERLAY ===== */
.search-overlay {
  position: fixed; top: var(--navbar-height); left: 0; right: 0;
  background: rgba(8, 11, 17, 0.7); 
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 900; display: none;
  padding: 24px 16px;
  animation: fadeIn 0.2s ease;
}
.search-overlay.active { display: block; }
.search-results {
  max-width: 760px; margin: 0 auto;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  max-height: 65vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.search-result-item {
  padding: 14px 16px; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { 
  background: var(--bg-hover); 
  border-color: var(--text-accent);
  transform: translateX(4px);
}
.search-result-chapter { font-size: 12px; font-weight: 600; color: var(--text-accent); margin-bottom: 4px; }
.search-result-snippet { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
mark { background: rgba(99, 102, 241, 0.25); color: var(--text-accent); border-radius: 3px; padding: 1px 3px; font-weight: 500; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: var(--navbar-height); left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: rgba(15, 20, 32, 0.8);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 800;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.8);
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header h2 { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.chapter-count {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-tertiary); padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--border);
}

.chapter-list {
  flex: 1; overflow-y: auto;
  padding: 12px 10px;
}

.chapter-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; cursor: pointer;
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: var(--transition);
  user-select: none;
  border-left: 3px solid transparent;
}
.chapter-item:hover { 
  background: var(--bg-hover); 
  transform: translateX(3px);
}
.chapter-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-left-color: var(--text-accent);
  color: var(--text-accent);
}
[data-theme="light"] .chapter-item.active {
  background: rgba(79, 70, 229, 0.06);
}
.chapter-item.done { opacity: 0.85; }

.chapter-item-num {
  width: 24px; height: 24px;
  background: var(--bg-tertiary); border-radius: 50%;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); flex-shrink: 0;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.chapter-item.active .chapter-item-num { background: var(--text-accent); color: white; border-color: transparent; }
.chapter-item.done .chapter-item-num { background: var(--accent-green); color: white; border-color: transparent; }

.chapter-item-title {
  font-size: 13.5px; font-weight: 550; color: var(--text-primary);
  line-height: 1.4;
  transition: var(--transition);
}
.chapter-item.active .chapter-item-title { color: var(--text-accent); font-weight: 600; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.btn-reset-progress {
  width: 100%; padding: 10px; font-size: 13px; font-weight: 500;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.btn-reset-progress:hover { 
  background: rgba(239, 68, 68, 0.08); 
  color: var(--accent-red); 
  border-color: var(--accent-red);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none; 
  position: fixed; inset: 0;
  background: rgba(8, 11, 17, 0.6);
  z-index: 799; 
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
/* Fully hidden and non-blocking unless active */
.sidebar-overlay.active { 
  display: block; 
  opacity: 1; 
  pointer-events: all; 
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}
.main-content.expanded { margin-left: 0; }

/* ===== HERO SECTION ===== */
.hero-section {
  position: relative;
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  align-items: center;
  padding: 60px 48px;
  overflow: hidden;
  background: var(--gradient-hero);
}

.hero-bg {
  position: absolute; inset: 0;
  background: 
    radial-gradient(circle at 20% 40%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 45%);
  pointer-events: none;
}

.hero-content {
  flex: 1.2; max-width: 680px; z-index: 2;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--text-accent);
  padding: 8px 16px; border-radius: 30px;
  font-size: 13px; font-weight: 600; margin-bottom: 28px;
  box-shadow: var(--shadow-glow);
}

.hero-title {
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 800; line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
  font-family: var(--font-bengali);
  letter-spacing: -0.01em;
}

.gradient-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

.hero-subtitle {
  font-size: 16px; color: var(--text-secondary);
  margin-bottom: 36px; line-height: 1.7;
}

.hero-stats {
  display: flex; gap: 24px; margin-bottom: 40px; flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  min-width: 120px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--text-accent);
  box-shadow: var(--shadow-lg);
}
.stat-num {
  font-size: 28px; font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 4px; }

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.btn-primary {
  padding: 14px 32px;
  background: var(--gradient-btn);
  color: white; border: none;
  border-radius: var(--radius-xl);
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-bengali);
  box-shadow: 0 4px 18px rgba(99,102,241,0.35);
}
.btn-primary:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 8px 24px rgba(99,102,241,0.45); 
}

.btn-secondary {
  padding: 14px 32px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-bengali);
}
.btn-secondary:hover { 
  background: var(--bg-hover); 
  border-color: var(--text-accent); 
  transform: translateY(-3px); 
  box-shadow: var(--shadow);
}

/* Floating Cards Animation */
.hero-visual {
  flex: 0.8; display: flex; align-items: center; justify-content: center;
  position: relative; min-height: 400px;
  z-index: 1;
}
.floating-cards { position: relative; width: 300px; height: 350px; }
.float-card {
  position: absolute;
  background: rgba(15, 20, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: floatAnim 6s ease-in-out infinite;
  white-space: nowrap;
}
[data-theme="light"] .float-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.fc1 { top: 0; left: 10px; animation-delay: 0s; }
.fc2 { top: 65px; right: -20px; animation-delay: 1.2s; border-color: var(--accent-purple); }
.fc3 { top: 150px; left: -30px; animation-delay: 2.4s; border-color: var(--accent-blue); }
.fc4 { bottom: 85px; right: 10px; animation-delay: 0.6s; border-color: var(--accent-green); }
.fc5 { bottom: 10px; left: 20px; animation-delay: 1.8s; border-color: var(--accent-yellow); }

@keyframes floatAnim {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  55% { transform: translateY(-14px) rotate(1deg); }
}

/* ===== CONTENT AREA ===== */
.content-area { 
  padding: 40px 60px 80px; 
  max-width: 960px; 
  margin: 0 auto;
}

.chapter-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 40px; flex-wrap: wrap; gap: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 20px;
}

.chapter-breadcrumb {
  font-size: 13.5px; color: var(--text-muted);
  font-weight: 500;
}
.chapter-breadcrumb .breadcrumb-chapter {
  color: var(--text-accent); font-weight: 600;
}

.chapter-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-mark-done, .btn-bookmark, .btn-quiz {
  padding: 8px 16px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  color: var(--text-secondary); font-family: var(--font-bengali);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-mark-done:hover { background: rgba(16, 185, 129, 0.08); border-color: var(--accent-green); color: var(--accent-green); }
.btn-bookmark:hover { background: rgba(245, 158, 11, 0.08); border-color: var(--accent-yellow); color: var(--accent-yellow); }
.btn-quiz:hover { background: rgba(99, 102, 241, 0.08); border-color: var(--text-accent); color: var(--text-accent); }
.btn-mark-done.done-active { background: rgba(16, 185, 129, 0.12); border-color: var(--accent-green); color: var(--accent-green); }

/* ===== CHAPTER BODY / MARKDOWN RENDERING ===== */
.chapter-body {
  font-family: var(--font-bengali);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-primary);
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chapter-h1 {
  font-size: clamp(26px, 5vw, 34px); font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.chapter-h2 {
  font-size: clamp(20px, 4vw, 24px); font-weight: 700;
  color: var(--text-primary); 
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.chapter-h3 {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary); margin: 36px 0 14px;
  display: block;
}

.chapter-h4 {
  font-size: 15px; font-weight: 700;
  color: var(--text-secondary); margin: 28px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chapter-p {
  margin-bottom: 20px;
  color: rgba(248, 250, 252, 0.9);
  font-weight: 400;
  line-height: 1.85;
}
[data-theme="light"] .chapter-p { color: rgba(15, 23, 42, 0.9); }

.chapter-hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

/* Clean Minimal Callouts (Info Cards) */
.callout-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  padding: 24px 24px 24px 60px;
  border-radius: var(--radius);
  margin: 32px 0;
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.3s ease;
}
.callout-card:hover {
  border-color: var(--text-muted);
}
.callout-card::before {
  content: 'ℹ️';
  position: absolute;
  top: 24px; left: 20px;
  font-size: 20px;
  line-height: 1;
  opacity: 0.9;
}
.callout-card.bq-tip {
  background: var(--bg-tertiary);
}
.callout-card.bq-tip::before { content: '💡'; }
.callout-card.bq-warning {
  background: var(--bg-tertiary);
}
.callout-card.bq-warning::before { content: '⚠️'; }
.callout-card.bq-danger {
  background: var(--bg-tertiary);
}
.callout-card.bq-danger::before { content: '❌'; }
.callout-card.bq-success {
  background: var(--bg-tertiary);
}
.callout-card.bq-success::before { content: '✅'; }

/* Custom Lists */
.chapter-ul, .chapter-ol {
  padding-left: 18px; margin-bottom: 24px;
}
.chapter-ul li {
  list-style: none;
  position: relative;
  padding-left: 28px;
  margin-bottom: 14px;
}
.chapter-ul li::before {
  content: '—';
  position: absolute;
  left: 0; top: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 16px;
}
.chapter-ol li { 
  margin-bottom: 14px; 
  padding-left: 10px;
}
.chapter-ol li::marker {
  color: var(--text-accent);
  font-weight: 700;
}

/* Red / Green comparative lists cards */
.chapter-ul li.li-success {
  list-style: none;
  position: relative;
  background: rgba(16, 185, 129, 0.05);
  border-left: 3px solid var(--accent-green);
  padding: 10px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 0;
}
.chapter-ul li.li-success::before { content: none; }
.chapter-ul li.li-danger {
  list-style: none;
  position: relative;
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--accent-red);
  padding: 10px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 0;
}
.chapter-ul li.li-danger::before { content: none; }

/* Minimal Table Wrapping */
.table-wrapper {
  overflow-x: auto;
  margin: 32px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
}
.table-premium {
  width: 100%; border-collapse: collapse;
  font-size: 15px; text-align: left;
}
.table-premium th {
  background: var(--bg-tertiary);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.table-premium td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.table-premium tr:last-child td { border-bottom: none; }
.table-premium tr:hover td { 
  background: var(--bg-hover); 
  color: var(--text-primary); 
}
.table-premium tr:nth-child(even) td { background: rgba(255, 255, 255, 0.01); }
[data-theme="light"] .table-premium tr:nth-child(even) td { background: rgba(0, 0, 0, 0.015); }

/* Auto mistakes coloring inside mistake tables */
.table-mistakes td:first-child {
  color: var(--accent-red);
  font-weight: 600;
  background: rgba(239, 68, 68, 0.03);
}
.table-mistakes td:nth-child(2) {
  color: var(--accent-green);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.03);
}

/* Vocab / Translation table column styling */
.table-translation td:nth-child(2) {
  color: var(--text-accent);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

/* Code block containers */
.code-container {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin: 32px 0;
  overflow: hidden;
  box-shadow: 0 10px 30px -5px rgba(0,0,0,0.3);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.code-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
}
.code-header {
  background: #161b22;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
}
.code-header::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
  margin-right: 16px;
  opacity: 0.8;
}
.code-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.code-copy-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
  border-color: var(--text-accent);
}
.code-container pre {
  padding: 20px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: #e5e7eb;
  white-space: pre;
}
.chapter-body code {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 5px;
  font-size: 13px; color: var(--text-accent);
}

/* Bold / Italics */
.chapter-body strong { color: var(--text-primary); font-weight: 700; }
.chapter-body em { color: var(--accent-yellow); font-style: normal; font-weight: 600; }

/* Indicators */
.emoji-indicator {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 4px;
}

/* Chapter Navigation Bottom Buttons */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 56px; padding-top: 28px;
  border-top: 1px solid var(--border);
}

.btn-prev, .btn-next {
  padding: 12px 28px;
  border-radius: 30px; 
  font-size: 14.5px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-bengali);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-prev {
  background: var(--bg-secondary); 
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-prev:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary);
  border-color: var(--text-accent);
}
.btn-next { 
  background: var(--gradient-btn); 
  color: white; 
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-next:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45); 
}

/* ===== QUIZ AREA ===== */
.quiz-area {
  padding: 40px 24px;
  max-width: 760px;
  margin: 0 auto;
  animation: fadeInUp 0.45s ease;
}

.quiz-header {
  margin-bottom: 32px;
  text-align: center;
}

.quiz-header h2 {
  font-size: 24px; font-weight: 800;
  color: var(--text-primary); margin-bottom: 16px;
}

.quiz-progress-bar {
  height: 8px; background: var(--bg-tertiary);
  border-radius: 4px; overflow: hidden; margin-bottom: 10px;
  border: 1px solid var(--border);
}
.quiz-bar-fill {
  height: 100%; border-radius: 4px;
  background: var(--gradient-accent);
  transition: width 0.4s ease;
}

#quizCounter { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.quiz-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}

.quiz-question {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 24px;
  line-height: 1.65; font-family: var(--font-bengali);
}

#quizAnswer {
  width: 100%; padding: 14px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-bengali); font-size: 14.5px;
  resize: vertical; outline: none;
  transition: var(--transition);
  margin-bottom: 12px;
  line-height: 1.6;
}
#quizAnswer:focus { 
  border-color: var(--text-accent); 
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); 
  background: var(--bg-secondary);
}

.btn-quiz-submit {
  width: 100%;
  padding: 14px; font-size: 15px; font-weight: 700;
  background: var(--gradient-btn); color: white;
  border: none; border-radius: var(--radius-lg);
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-bengali);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-quiz-submit:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4); 
}

.quiz-feedback {
  margin-top: 24px; padding: 20px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid var(--accent-green);
  border-radius: var(--radius-lg);
  font-size: 14.5px; color: var(--text-primary);
  line-height: 1.7; font-family: var(--font-bengali);
  box-shadow: var(--shadow);
}

.quiz-nav { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }

.btn-quiz-next, .btn-quiz-end {
  padding: 11px 24px; font-size: 14.5px; font-weight: 600;
  border-radius: var(--radius-lg); cursor: pointer;
  transition: var(--transition); font-family: var(--font-bengali);
}
.btn-quiz-next {
  background: var(--gradient-btn); color: white; border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-quiz-next:hover {
  transform: translateY(-2px); 
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35); 
}
.btn-quiz-end {
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-secondary);
}
.btn-quiz-end:hover { 
  border-color: var(--accent-red); 
  color: var(--accent-red); 
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 24px; font-size: 14px; font-weight: 600;
  color: var(--text-primary); font-family: var(--font-bengali);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000; max-width: 340px;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translateY(0); opacity: 1; border-color: var(--text-accent); }

/* ===== RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.mobile-open { transform: translateX(0); }
  
  /* Transition handled nicely */
  .sidebar-overlay { 
    transition: opacity 0.3s ease; 
  }
  
  .main-content { margin-left: 0 !important; }
  .hero-section { padding: 40px 24px; flex-direction: column; }
  .hero-visual { display: none; }
  
  .content-area { padding: 24px 16px 60px; }
  .quiz-area { padding: 24px 16px; }
  
  .chapter-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .chapter-nav { flex-direction: column; gap: 12px; }
  .btn-prev, .btn-next { width: 100%; justify-content: center; }
}

@media (max-width: 600px) {
  .navbar { padding: 0 16px; }
  .navbar-center { display: none; } /* Hide search bar input on tiny screens */
  
  .hero-title { font-size: 28px; }
  .hero-stats { gap: 12px; }
  .stat-card { padding: 14px 16px; flex: 1; min-width: 90px; }
  .stat-num { font-size: 24px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .btn-primary, .btn-secondary { text-align: center; width: 100%; padding: 12px 20px; }
  
  .chapter-body { font-size: 15px; line-height: 1.7; }
  .chapter-p { margin-bottom: 16px; }
  
  .callout-card {
    padding: 16px 16px 16px 44px;
    margin: 24px 0;
    font-size: 14px;
  }
  .callout-card::before {
    top: 16px; left: 14px;
    font-size: 18px;
  }
  
  .chapter-ul, .chapter-ol { padding-left: 12px; margin-bottom: 16px; }
  .chapter-ul li { font-size: 14px; margin-bottom: 10px; padding-left: 24px; }
  .chapter-ul li::before { font-size: 14px; }
  
  .table-wrapper { margin: 24px 0; border-radius: 8px; }
  .table-premium th, .table-premium td { padding: 10px 12px; font-size: 13.5px; }
  
  .code-container { margin: 24px 0; border-radius: 8px; }
  .code-content { padding: 12px 16px; font-size: 13px; }
}

/* ===== PRINT STYLES (PDF EXPORT) ===== */
@media print {
  /* Hide non-essential UI */
  .navbar, .sidebar, .chapter-header, .chapter-nav, .quiz-area, .hero-section, .toast, .sidebar-overlay, .btn-print { 
    display: none !important; 
  }
  
  /* Reset layout for printing */
  body, html { 
    background: #ffffff !important; 
    color: #000000 !important; 
    margin: 0 !important; 
    padding: 0 !important;
  }
  .main-content { 
    margin: 0 !important; 
    padding: 0 !important;
    width: 100% !important;
  }
  .content-area { 
    padding: 0 !important; 
    max-width: 100% !important; 
  }
  
  /* Force browsers to print backgrounds and colors */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Typography & Colors specifically for print */
  .chapter-body { color: #111 !important; }
  .chapter-p { color: #222 !important; }
  .chapter-h1, .chapter-h2, .chapter-h3, .chapter-h4 {
    color: #000 !important;
    page-break-after: avoid;
    break-after: avoid;
  }
  
  /* Tables */
  .table-premium th { 
    background: #f1f5f9 !important; 
    color: #000 !important; 
    border-bottom: 2px solid #cbd5e1 !important;
  }
  .table-premium td {
    color: #333 !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  .table-wrapper {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    margin: 20px 0 !important;
  }
  
  /* Callout Cards (Info boxes) */
  .callout-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #111 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .callout-card.bq-tip { background: #fef3c7 !important; border-color: #fde68a !important; }
  .callout-card.bq-warning { background: #f3e8ff !important; border-color: #e9d5ff !important; }
  .callout-card.bq-danger { background: #fee2e2 !important; border-color: #fecaca !important; }
  .callout-card.bq-success { background: #d1fae5 !important; border-color: #a7f3d0 !important; }
  
  /* Code Blocks */
  .code-container {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #111 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .code-content { color: #0f172a !important; text-shadow: none !important; }
  
  /* Prevent breaks in tables and lists */
  .chapter-body table, .chapter-ul li, .chapter-ol li { 
    page-break-inside: avoid; 
    break-inside: avoid; 
  }
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.text-accent { color: var(--text-accent); }
.chapter-body h1 .emoji { font-size: 24px; }
.chapter-body > * { animation: fadeInUp 0.4s ease both; }
