/* ═══════════════════════════════════════════════════════════════
   KURSUS FILSAFAT — Design System
   A complete, minimal, professional design system
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */

:root {
  /* Neutral palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f7;
  --bg-tertiary: #eeeeee;
  --bg-hover: #e8e8e8;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-tertiary: #888888;
  --border-color: #dddddd;
  --border-light: #eeeeee;

  /* Accent — default gray, changeable */
  --accent: #555555;
  --accent-light: #f0f0f0;
  --accent-hover: #444444;

  /* Dimensions */
  --sidebar-width: 300px;
  --header-height: 56px;
  --content-max-width: 740px;
  --font-size-base: 16px;
  --radius: 6px;
  --radius-sm: 4px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Dark Mode ─────────────────────────────────────────────── */

[data-theme="dark"] {
  --bg-primary: #141414;
  --bg-secondary: #1c1c1c;
  --bg-tertiary: #262626;
  --bg-hover: #333333;
  --text-primary: #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-tertiary: #737373;
  --border-color: #333333;
  --border-light: #262626;
  --accent-light: #262626;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Accent Colors ─────────────────────────────────────────── */

[data-accent="gray"]   { --accent: #555555; --accent-hover: #444444; }
[data-accent="slate"]  { --accent: #475569; --accent-hover: #334155; }
[data-accent="stone"]  { --accent: #78716c; --accent-hover: #57534e; }
[data-accent="teal"]   { --accent: #0d9488; --accent-hover: #0f766e; }
[data-accent="indigo"] { --accent: #4f46e5; --accent-hover: #4338ca; }
[data-accent="brown"]  { --accent: #8b6f47; --accent-hover: #725a38; }

[data-theme="dark"][data-accent="gray"]   { --accent: #a3a3a3; --accent-hover: #b5b5b5; --accent-light: #262626; }
[data-theme="dark"][data-accent="slate"]  { --accent: #94a3b8; --accent-hover: #a8b8cc; --accent-light: #1e293b; }
[data-theme="dark"][data-accent="stone"]  { --accent: #a8a29e; --accent-hover: #b8b2ae; --accent-light: #292524; }
[data-theme="dark"][data-accent="teal"]   { --accent: #2dd4bf; --accent-hover: #5eead4; --accent-light: #042f2e; }
[data-theme="dark"][data-accent="indigo"] { --accent: #818cf8; --accent-hover: #a5b4fc; --accent-light: #1e1b4b; }
[data-theme="dark"][data-accent="brown"]  { --accent: #c4a36e; --accent-hover: #d4b88a; --accent-light: #2a2015; }

/* ── Base ──────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Layout ────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sidebar-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search-input:focus {
  border-color: var(--accent);
}

.sidebar-top-links {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-top-links a,
.sidebar-footer-link {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-top-links a:hover,
.sidebar-footer-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav .loading {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Navigation sections */
.nav-section {
  border-bottom: 1px solid var(--border-light);
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.nav-section-title:hover {
  background: var(--bg-hover);
}

.nav-section-title .nav-icon {
  font-size: 14px;
}

.nav-section-title .nav-chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.nav-section.collapsed .nav-chevron {
  transform: rotate(-90deg);
}

.nav-section.collapsed .nav-section-content {
  display: none;
}

.nav-section-content {
  padding: 0 0 8px 0;
}

.nav-module-title {
  padding: 4px 20px 4px 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
}

.nav-module-title:hover {
  color: var(--text-secondary);
}

.nav-module-content {
  padding: 0 0 4px 0;
}

.nav-module.collapsed .nav-module-content {
  display: none;
}

.nav-topic-title {
  padding: 2px 20px 2px 36px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px 6px 36px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.nav-item .check {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  transition: all 0.2s;
}

.nav-item .check.done {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Main Area ─────────────────────────────────────────────── */

.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-area.expanded {
  margin-left: 0;
}

/* ── Header ────────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
}

.header-left {
  flex: 1;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  transition: background 0.15s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
}

/* ── Sidebar Toggle ────────────────────────────────────────── */

.sidebar-floating-toggle {
  position: fixed;
  top: 60px;
  left: 10px;
  z-index: 150;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.25s ease;
}
.sidebar-floating-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.app-layout .sidebar:not(.hidden) ~ .sidebar-floating-toggle {
  left: calc(var(--sidebar-width) - 16px);
  transform: rotate(180deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

/* ── Content ───────────────────────────────────────────────── */

.content {
  max-width: 960px;
  padding: 32px 48px;
  margin: 0 auto;
}

.content-reader {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* ── Dashboard ─────────────────────────────────────────────── */

.dashboard-greeting {
  margin-bottom: 32px;
}

.greeting-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.greeting-quote {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
  max-width: 600px;
  transition: opacity 0.5s;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.level-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.level-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.level-card-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.level-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.level-card-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* ── Lesson Reader ─────────────────────────────────────────── */

.lesson-header {
  margin-bottom: 32px;
}

.lesson-breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.lesson-breadcrumb a {
  color: var(--text-tertiary);
}

.lesson-breadcrumb a:hover {
  color: var(--accent);
}

.lesson-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 12px;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lesson-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.lesson-actions {
  margin-left: auto;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background: #fef2f2;
}

/* ── Lesson Body Typography ────────────────────────────────── */

.lesson-body h1 { font-size: 24px; font-weight: 700; margin: 32px 0 16px; color: var(--text-primary); }
.lesson-body h2 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; color: var(--text-primary); }
.lesson-body h3 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; color: var(--text-primary); }
.lesson-body h4 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--text-primary); }
.lesson-body h5 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--text-primary); }
.lesson-body h6 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--text-secondary); }

.lesson-body p {
  margin-bottom: 14px;
  line-height: 1.75;
  color: var(--text-primary);
}

.lesson-body ul, .lesson-body ol {
  margin: 0 0 16px 24px;
}

.lesson-body li {
  margin-bottom: 6px;
  line-height: 1.7;
  color: var(--text-primary);
}

.lesson-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 18px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.lesson-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}


.lesson-body pre > code {
  display: block;
  padding: 16px 20px;
  overflow-x: auto;
  white-space: pre;
}

.lesson-body code {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

.lesson-body :not(pre) > code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

.lesson-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 28px 0;
}

.lesson-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.lesson-body th, .lesson-body td {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.lesson-body th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.lesson-body img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* ── Special Components ────────────────────────────────────── */

.dialog-sejarah {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.dialog-sejarah .speaker {
  font-weight: 600;
  color: var(--accent);
}

.mentor-note-block {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
}

.badge-card {
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}

.badge-lencana {
  font-size: 32px;
  margin-bottom: 8px;
}

/* ══════════════════════════════════════════════════════════════
   Card Components — Structured HTML from Markdown Box-Drawing
   ══════════════════════════════════════════════════════════════ */

/* ── Shared card header ──────────────────────────────────── */

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.card-header-icon {
  font-size: 20px;
  line-height: 1;
}

.card-header-title {
  letter-spacing: 0.3px;
}

/* ── Shared card sections ────────────────────────────────── */

.card-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-section:last-child {
  border-bottom: none;
}

.card-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}

.card-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.card-list {
  margin: 0;
  padding-left: 20px;
}

.card-list li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* ── Eksperimen Pikiran card ────────────────────────────── */

.eksperimen-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.eksperimen-card .card-header {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #000));
}

.eksperimen-card .card-scenario {
  background: var(--bg-secondary);
}

.eksperimen-card .card-questions {
  padding-left: 0;
}

.eksperimen-card .card-questions .question-item {
  padding: 6px 0 6px 28px;
  position: relative;
}

.eksperimen-card .card-questions .question-item::before {
  content: attr(data-num);
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

.eksperimen-card .card-why {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

/* ── Lencana Kompetensi card ────────────────────────────── */

.lencana-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.lencana-card .card-header-lencana {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}

.lencana-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.lencana-card .lencana-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.lencana-card .lencana-level {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 10px;
  border-radius: 20px;
}

.lencana-card .card-next {
  background: var(--accent-light);
}

/* ── Peta Konsep card ───────────────────────────────────── */

.peta-konsep-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 24px 0;
  padding: 0;
  overflow: hidden;
}

.peta-konsep-header {
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.peta-tree {
  list-style: none;
  padding: 16px 20px;
  margin: 0;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.7;
}

.peta-tree ul {
  list-style: none;
  padding-left: 24px;
  margin: 2px 0 2px 10px;
  border-left: 2px solid var(--border-color);
}

.peta-node {
  position: relative;
  padding-left: 16px;
}

.peta-node::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 10px;
  width: 14px;
  height: 2px;
  background: var(--border-color);
}

.peta-root {
  padding: 12px 20px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  border-bottom: 1px solid var(--border-light);
}

.peta-node-label {
  color: var(--text-primary);
  word-break: break-word;
}

/* ── Garis Keturunan Ide card ───────────────────────────── */

.garis-keturunan-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.garis-header {
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.garis-timeline {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.garis-node {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
}

.garis-node-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.garis-node-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.garis-arrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

.garis-arrow-icon {
  font-size: 14px;
  color: var(--accent);
  font-style: normal;
  margin-right: 6px;
}

.diskusi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.fakta-card {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.ayat-ref-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}

.ingat-kembali-block {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
}

.koneksi-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.koneksi-table {
  width: 100%;
  border-collapse: collapse;
}

.koneksi-dim, .koneksi-val {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

.myth-fact {
  margin: 20px 0;
}

.myth-fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.myth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

/* ── Lesson Navigation ─────────────────────────────────────── */

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.lesson-nav-btn {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
  display: block;
}

.lesson-nav-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.lesson-nav-btn .nav-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.lesson-nav-btn .nav-title {
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}

.lesson-nav-btn.next {
  text-align: right;
}

/* ── Quiz ──────────────────────────────────────────────────── */

.quiz-container {
  max-width: 700px;
  margin: 0 auto;
}

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

.quiz-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.quiz-level-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: center;
}

.quiz-level-card:hover {
  border-color: var(--accent);
}

.quiz-level-card .level-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.quiz-level-card .level-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.quiz-level-card .level-score {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.quiz-question {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.quiz-question-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.quiz-question-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: 14px;
}

.quiz-option:hover {
  border-color: var(--accent);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.quiz-option.correct {
  border-color: #16a34a;
  background: #f0fdf4;
}

.quiz-option.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
}

[data-theme="dark"] .quiz-option.correct {
  background: #14532d;
}

[data-theme="dark"] .quiz-option.incorrect {
  background: #450a0a;
}

.quiz-option-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.quiz-option.selected .quiz-option-radio {
  border-color: var(--accent);
}

.quiz-option.selected .quiz-option-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.quiz-result {
  text-align: center;
  padding: 32px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-top: 24px;
}

.quiz-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

/* ── Search ────────────────────────────────────────────────── */

.search-bar {
  position: relative;
  margin-bottom: 32px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-tertiary);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-item {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.search-result-item:hover {
  border-color: var(--accent);
}

.search-result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.search-result-snippet mark {
  background: #fef08a;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

[data-theme="dark"] .search-result-snippet mark {
  background: #854d0e;
  color: #fef08a;
}

/* ── Glossary ──────────────────────────────────────────────── */

.glossary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.glossary-filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.glossary-filter-btn:hover,
.glossary-filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.glossary-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.glossary-term {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.glossary-arabic {
  font-size: 14px;
  color: var(--accent);
  margin-left: 8px;
  direction: rtl;
}

.glossary-def {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 6px;
}

.glossary-highlight {
  color: inherit;
  cursor: help;
  border-bottom: 1px dashed var(--accent);
}

/* ── Glossary Popup ────────────────────────────────────────── */

.glossary-popup {
  position: fixed;
  z-index: 200;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px 20px;
  max-width: 320px;
  display: none;
}

.glossary-popup.show {
  display: block;
}

.glossary-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.glossary-popup-term {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  padding-right: 20px;
}

.glossary-popup-def {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Settings ──────────────────────────────────────────────── */

.settings-container {
  max-width: 600px;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.settings-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  width: 200px;
  outline: none;
}

.settings-input:focus {
  border-color: var(--accent);
}

.settings-range {
  width: 200px;
  accent-color: var(--accent);
}

.color-options {
  display: flex;
  gap: 8px;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.active {
  border-color: var(--text-primary);
}

/* ── Bookmarks ─────────────────────────────────────────────── */

.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
}

.bookmark-item:hover {
  border-color: var(--accent);
}

.bookmark-item-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.bookmark-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.bookmark-remove {
  padding: 4px 8px;
  font-size: 12px;
  color: #dc2626;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
}

.bookmark-remove:hover {
  background: #fef2f2;
}

[data-theme="dark"] .bookmark-remove:hover {
  background: #450a0a;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Empty State ───────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ── Modal ─────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-md);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-area {
    margin-left: 0 !important;
  }

  .sidebar-floating-toggle {
    display: flex;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .content {
    padding: 20px 16px;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
  }

  .level-cards {
    grid-template-columns: 1fr;
  }

  .lesson-nav {
    flex-direction: column;
  }

  .myth-fact-grid {
    grid-template-columns: 1fr;
  }

  .greeting-name {
    font-size: 22px;
  }

  .lesson-title {
    font-size: 22px;
  }

  .quiz-levels {
    grid-template-columns: 1fr 1fr;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .sidebar-floating-toggle {
    left: 16px !important;
    top: 10px !important;
    transform: none !important;
  }
}

/* ── Scrollbar ─────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ── Utilities ─────────────────────────────────────────────── */

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ─── Google Translate Widget ───────────────────────────── */
.translate-wrapper {
  position: relative;
}

.translate-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color, #ddd);
  background: var(--bg-primary, #fff);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #555);
  font-size: 18px;
  transition: all 0.15s ease;
  padding: 0;
  font-family: inherit;
}
.translate-toggle:hover {
  background: var(--bg-hover, #e8e8e8);
  color: var(--text-primary, #1a1a1a);
}
.translate-toggle.active {
  background: var(--accent-light, #f0f0f0);
  border-color: var(--accent, #555);
  color: var(--accent, #555);
}

.translate-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 200;
  overflow: hidden;
  animation: translateDropIn 0.15s ease;
}
.translate-dropdown.show {
  display: block;
}

@keyframes translateDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.translate-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #ddd);
  background: var(--bg-secondary, #f7f7f7);
}

.translate-dropdown-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
}

.translate-gt-element {
  padding: 12px 16px;
}

/* Override Google Translate default styling */
.translate-gt-element .goog-te-gadget {
  font-family: inherit !important;
  font-size: 13px !important;
  color: var(--text-secondary, #555) !important;
}
.translate-gt-element .goog-te-gadget-simple {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}
.translate-gt-element .goog-te-gadget .goog-te-combo {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  background: var(--bg-secondary, #f7f7f7);
  color: var(--text-primary, #1a1a1a);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.translate-gt-element .goog-te-gadget .goog-te-combo:focus {
  border-color: var(--accent, #555);
}
.translate-gt-element .goog-te-gadget > span {
  display: none !important;
}

.translate-status {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-tertiary, #888);
  text-align: center;
  transition: color 0.2s;
}
.translate-status.active {
  color: #16a34a;
  font-weight: 500;
}

.translate-reset-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #ddd);
  background: var(--bg-secondary, #f7f7f7);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #555);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-align: center;
}
.translate-reset-btn:hover {
  background: var(--bg-hover, #e8e8e8);
  color: var(--text-primary, #1a1a1a);
  border-color: var(--accent, #555);
}

/* Sembunyikan HANYA banner/bar Google Translate di atas halaman, BUKAN widget combo */
.goog-te-banner-frame {
  display: none !important;
}
/* Banner top-bar Google Translate (div.skiptranslate yang langsung child body) */
body > .skiptranslate {
  display: none !important;
}
/* Google Translate sering menambahkan top offset ke body — reset */
body {
  top: 0 !important;
}
/* Pastikan widget combo box di dalam dropdown kita tetap terlihat */
.translate-gt-element .skiptranslate {
  display: block !important;
}
.translate-gt-element .goog-te-gadget {
  font-size: 0 !important;
}
.translate-gt-element .goog-te-gadget .goog-te-combo {
  font-size: 13px !important;
}

/* Mobile responsive translate */
@media (max-width: 768px) {
  .translate-dropdown {
    width: 260px;
    right: -40px;
  }
}

/* ─── RTL Fix: Google Translate + RTL languages ──────────── */
/* When Google Translate switches to RTL (Arabic, Hebrew, etc.),
   keep code blocks, tables, sidebar, and widget LTR */

/* Google Translate wrapper — let RTL flow naturally for Arabic/Hebrew */
/* Do NOT force the wrapper to LTR */

/* Force LTR only on structural/monospace elements regardless of page direction */
pre, pre code, code, pre > code,
table, table th, table td,
.sidebar, .sidebar-nav, .sidebar-search-input,
.header, .header-right, .header-left,
.translate-wrapper, .translate-dropdown, .translate-gt-element,
.quiz-option, .quiz-question,
.glossary-item, .glossary-term,
.lesson-body pre,
.eksperimen-card, .eksperimen-card .card-header, .eksperimen-card .card-label,
.lencana-card, .lencana-card .card-header, .lencana-card .card-meta, .lencana-card .card-label,
.peta-konsep-card, .peta-konsep-card .peta-konsep-header, .peta-konsep-card .peta-node-label,
.garis-keturunan-card, .garis-keturunan-card .garis-header, .garis-keturunan-card .garis-node-title {
  direction: ltr !important;
  text-align: left !important;
}

/* Box-drawing characters MUST stay LTR */
.lesson-body pre > code {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: embed;
}

/* RTL text in paragraphs should flow naturally */
.lesson-body p {
  direction: inherit;
  text-align: inherit;
}

/* ── RTL language support (Arabic, Hebrew, Farsi, Urdu, etc.) ── */
/* Google Translate sets lang attr on <html> but doesn't set dir */
html[lang="ar"], html[lang="he"], html[lang="fa"], html[lang="ur"],
html[lang^="ar-"], html[lang^="he-"], html[lang^="fa-"], html[lang^="ur-"],
html[lang="yi"], html[lang="ps"], html[lang="sd"] {
  direction: rtl;
}
html[lang="ar"] .lesson-body,
html[lang="he"] .lesson-body,
html[lang="fa"] .lesson-body,
html[lang="ur"] .lesson-body,
html[lang="yi"] .lesson-body,
html[lang^="ar-"] .lesson-body,
html[lang^="he-"] .lesson-body,
html[lang^="fa-"] .lesson-body,
html[lang^="ur-"] .lesson-body {
  direction: rtl;
  text-align: right;
}
html[lang="ar"] .lesson-body p,
html[lang="he"] .lesson-body p,
html[lang="fa"] .lesson-body p,
html[lang="ur"] .lesson-body p,
html[lang^="ar-"] .lesson-body p,
html[lang^="he-"] .lesson-body p,
html[lang^="fa-"] .lesson-body p,
html[lang^="ur-"] .lesson-body p {
  direction: rtl;
  text-align: right;
}
html[lang="ar"] .lesson-body h1,
html[lang="ar"] .lesson-body h2,
html[lang="ar"] .lesson-body h3,
html[lang="he"] .lesson-body h1,
html[lang="he"] .lesson-body h2,
html[lang="he"] .lesson-body h3 {
  direction: rtl;
  text-align: right;
}

/* Hide separator lines in lesson body */
.lesson-body hr {
  display: none;
}

/* But inline code stays LTR */
.lesson-body :not(pre) > code {
  direction: ltr !important;
  unicode-bidi: embed;
}
