/* ═══════════════════════════════════════════════════════════
   Kursus Sejarah Islam — Design System
   Clean, neutral, institutional. No gradients. No AI vibes.
   ═══════════════════════════════════════════════════════════ */

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

/* ─── CSS Custom Properties ─────────────────────────────── */
: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 — minimal */
  --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; }

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

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

img { max-width: 100%; height: auto; }

/* ─── Layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

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

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

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

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

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  transition: all 0.15s ease;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

/* ─── Theme Toggle ──────────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.theme-toggle:hover {
  background: var(--bg-hover);
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.sidebar-nav {
  padding: 8px 0;
}

.nav-section {
  margin-bottom: 4px;
}

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

.nav-section-title .arrow {
  font-size: 10px;
  transition: transform 0.2s;
  margin-left: auto;
}
.nav-section-title.expanded .arrow {
  transform: rotate(90deg);
}

.nav-section-content {
  display: none;
  padding-left: 12px;
}
.nav-section-content.show {
  display: block;
}

.nav-module-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}
.nav-module-title:hover {
  color: var(--text-secondary);
}
.nav-module-title .arrow {
  font-size: 9px;
  transition: transform 0.2s;
  margin-left: auto;
}
.nav-module-title.expanded .arrow {
  transform: rotate(90deg);
}

.nav-module-content {
  display: none;
}
.nav-module-content.show {
  display: block;
}

.nav-topic-title {
  padding: 4px 20px 4px 32px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 36px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item .check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.nav-item .check.done {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.sidebar-footer-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: none;
}
.sidebar-footer-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* ─── Content Area ──────────────────────────────────────── */
.content {
  flex: 1;
  padding: 32px 48px;
  max-width: 960px;
}

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

/* ─── Dashboard ─────────────────────────────────────────── */
.dashboard-greeting {
  margin-bottom: 8px;
}

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

.greeting-quote {
  font-size: 14px;
  color: var(--text-tertiary);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.5;
  min-height: 42px;
  transition: opacity 0.4s ease;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

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

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

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

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

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}

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

/* ─── Level Cards ───────────────────────────────────────── */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 32px 0 16px;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.level-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.level-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.level-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.level-card-icon {
  font-size: 20px;
}

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

.level-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.level-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Lesson Reader ─────────────────────────────────────── */
.lesson-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.lesson-breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

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

.lesson-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
}

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

.lesson-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

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

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-sm.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Lesson content typography */
.lesson-body h1 { font-size: 24px; font-weight: 700; margin: 32px 0 16px; }
.lesson-body h2 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; }
.lesson-body h3 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }
.lesson-body h4 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }

.lesson-body p {
  margin-bottom: 14px;
  line-height: 1.75;
}

.lesson-body ul, .lesson-body ol {
  margin: 0 0 16px 24px;
}
.lesson-body li {
  margin-bottom: 6px;
  line-height: 1.7;
}

.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-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
}

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

.lesson-body p > code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
}

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

.lesson-body .table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

.lesson-body table {
  width: 100%;
  border-collapse: collapse;
  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 .mentor-note {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  margin: 4px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.lesson-body .info-box {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin: 4px 0;
  font-size: 14px;
}

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

.lesson-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  max-width: 45%;
}
.lesson-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.lesson-nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.mark-complete-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 24px;
  font-family: inherit;
  transition: background 0.15s;
}
.mark-complete-btn:hover {
  background: var(--accent-hover);
}
.mark-complete-btn.completed {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ─── Quiz ──────────────────────────────────────────────── */
.quiz-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

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

.quiz-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.quiz-question-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.quiz-question-text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.6;
}

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

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  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: #22c55e;
  background: #f0fdf4;
}
.quiz-option.incorrect {
  border-color: #ef4444;
  background: #fef2f2;
}
[data-theme="dark"] .quiz-option.correct {
  background: #052e16;
}
[data-theme="dark"] .quiz-option.incorrect {
  background: #350a0a;
}

.quiz-option-radio {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  flex-shrink: 0;
}
.quiz-option.selected .quiz-option-radio {
  border-color: var(--accent);
  background: var(--accent);
}

.quiz-result {
  text-align: center;
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

/* ─── Search ────────────────────────────────────────────── */
.search-bar {
  position: relative;
  max-width: 480px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--text-tertiary);
}

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

.search-results {
  margin-top: 24px;
}

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

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

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

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

.search-result-snippet mark {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

/* ─── Glossary ──────────────────────────────────────────── */
.glossary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 24px;
}

.glossary-filter-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.15s;
}
.glossary-filter-btn:hover,
.glossary-filter-btn.active {
  background: var(--accent);
  color: #fff;
  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(--text-tertiary);
  margin-left: 8px;
}

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

/* ─── Glossary Popup ────────────────────────────────────── */
.glossary-popup {
  position: fixed;
  max-width: 340px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: none;
}

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

.glossary-popup-term {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

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

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

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

/* ─── Settings ──────────────────────────────────────────── */
.settings-container {
  max-width: 560px;
}

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

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

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

.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);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  width: 200px;
}
.settings-input:focus {
  border-color: var(--accent);
}

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

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

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}
.color-option:hover,
.color-option.active {
  border-color: var(--text-primary);
}

.color-option[data-color="gray"] { background: #555555; }
.color-option[data-color="slate"] { background: #475569; }
.color-option[data-color="stone"] { background: #78716c; }
.color-option[data-color="teal"] { background: #0d9488; }
.color-option[data-color="indigo"] { background: #4f46e5; }
.color-option[data-color="brown"] { background: #8b6f47; }

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid #ef4444;
  background: transparent;
  color: #ef4444;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

/* ─── Bookmarks ─────────────────────────────────────────── */
.bookmark-list {
  display: flex;
  flex-direction: column;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

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

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

.bookmark-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}
.bookmark-remove:hover {
  color: #ef4444;
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-state-text {
  font-size: 14px;
}

/* ─── Modal/Overlay ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  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;
  }
  .content {
    padding: 20px 16px;
  }
  .content-reader {
    padding: 20px 8px;
  }
  .header {
    padding: 0 16px;
  }
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
  }
  .lesson-nav {
    flex-direction: column;
  }
  .lesson-nav-btn {
    max-width: 100%;
    width: 100%;
    justify-content: center;
  }
  .lesson-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .lesson-actions {
    margin-left: 0;
  }
}

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

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ─── Loading States ────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ─── Page titles ───────────────────────────────────────── */
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ─── Quiz Level Selector───────────────────────────────── */
.quiz-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.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.15s;
}
.quiz-level-card:hover {
  border-color: var(--accent);
}
.quiz-level-card.active {
  border-color: var(--accent);
  border-width: 2px;
}

/* ─── Sidebar Search ────────────────────────────────────── */
.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}
.sidebar-search-input:focus {
  border-color: var(--accent);
}
.sidebar-search-input::placeholder {
  color: var(--text-tertiary);
}

/* ─── Utilities ─────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ─── Sidebar Floating 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);
}

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

/* ─── Mitos vs Fakta ────────────────────────────────────── */
.myth-fact {
  margin: 32px 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.myth-fact-header {
  background: var(--bg-hover);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--border-color);
}
.myth-fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-color);
}
@media (max-width: 768px) {
  .myth-fact-grid {
    grid-template-columns: 1fr;
  }
}
.myth-card {
  background: var(--bg-primary);
  padding: 24px;
}
.myth-card.myth {
  border-right: 1px solid var(--border-color);
}
.myth-card.fact {
  background: var(--bg-secondary);
}
.myth-label {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.myth-card.myth .myth-label { color: #d9534f; }
.myth-card.fact .myth-label { color: #5cb85c; }
.myth-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ─── Catatan Mentor ────────────────────────────────────── */
.mentor-note-block {
  margin: 32px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.mentor-note-title {
  background: var(--bg-hover);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}
.mentor-note-body {
  padding: 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

/* ─── Lencana & Sertifikat ──────────────────────────────── */
.badge-card {
  margin: 32px 0;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.badge-lencana {
  border-top: 4px solid #f0ad4e;
}
.badge-sertifikat {
  border-top: 4px solid #5bc0de;
}
.badge-card-header {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.badge-icon {
  font-size: 48px;
  line-height: 1;
}
.badge-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.badge-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.badge-criteria {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  text-align: left;
  display: inline-block;
  background: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.badge-criteria li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.badge-next {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}
