/* ==========================================================================
   DOKUMENTASI & ARSIP PANDUAN DIGITAL - DESIGN SYSTEM (VANILLA CSS)
   Authentic Documentation Platform (GitBook / Notion / Telegram Web Inspired)
   ========================================================================== */

:root {
  --bg-app: #080c14;
  --bg-surface: #0e1422;
  --bg-card: #131b2e;
  --bg-card-subtle: #182238;
  --bg-card-hover: #1c2742;
  
  --border-line: rgba(255, 255, 255, 0.07);
  --border-active: #3b82f6;

  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-dim: #6b7280;
  
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;

  --font-base: 14.5px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-w: 280px;
  --toc-w: 260px;
  --topbar-h: 62px;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition: all 0.18s ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--font-base);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 40;
  gap: 16px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  background: var(--accent-blue);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #fff;
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* SEARCH BAR */
.topbar-center {
  flex: 1;
  max-width: 520px;
}

.search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 8px 36px 8px 40px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-blue);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}

.search-clear-btn:hover {
  color: #fff;
}

/* TOPBAR TOOLS */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.font-size-ctrl {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-line);
}

.font-size-ctrl .tool-btn {
  border: none;
  border-radius: 0;
  padding: 6px 10px;
}

.font-size-ctrl .tool-btn:first-child {
  border-right: 1px solid var(--border-line);
}

.badge-count {
  background: var(--accent-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

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

.btn-primary-pdf {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.btn-primary-pdf:hover {
  background: var(--accent-blue);
  color: #fff;
}

.btn-pdf-action {
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  color: #fff;
}

.btn-pdf-action:hover {
  background: #2563eb;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

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

.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  cursor: pointer;
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   APP BODY & SIDEBAR
   ========================================================================== */

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 30;
}

.sidebar-top {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.sidebar-counter {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
}

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

.sidebar-chapter-group {
  margin-bottom: 8px;
}

.sidebar-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.sidebar-chapter-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chapter-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-badge-num {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  color: #93c5fd;
}

.chapter-name-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.chapter-toggle-arrow {
  color: var(--text-dim);
  font-size: 11px;
  transition: transform 0.2s ease;
}

.sidebar-chapter-group.open .chapter-toggle-arrow {
  transform: rotate(180deg);
}

.sidebar-channel-list {
  padding-left: 6px;
  margin-top: 2px;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.sidebar-chapter-group.open .sidebar-channel-list {
  display: flex;
}

.sidebar-ch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-ch-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sidebar-ch-item.active {
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  font-weight: 600;
  border-left: 2.5px solid var(--accent-blue);
}

.ch-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 185px;
}

.ch-item-count {
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--text-dim);
}

.sidebar-bottom-info {
  padding: 10px 16px;
  border-top: 1px solid var(--border-line);
  background: rgba(0, 0, 0, 0.15);
}

.reader-mode-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  background-color: var(--accent-green);
  border-radius: 50%;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: 24px 32px 80px 32px;
}

.content-view {
  max-width: 1200px;
  margin: 0 auto;
}

.content-view.hidden {
  display: none !important;
}

/* ==========================================================================
   HOME DASHBOARD
   ========================================================================== */

.home-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.home-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.badge-pill {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.home-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 10px;
  color: #fff;
}

.home-lead {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 720px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.quick-overview-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  flex-wrap: wrap;
}

.ov-item {
  display: flex;
  flex-direction: column;
}

.ov-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.ov-lbl {
  font-size: 11px;
  color: var(--text-dim);
}

.ov-sep {
  width: 1px;
  height: 30px;
  background: var(--border-line);
}

/* CHAPTER DECK */
.chapters-header {
  margin-bottom: 18px;
}

.chapters-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.chapters-header p {
  font-size: 12.5px;
  color: var(--text-dim);
}

.chapter-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.chapter-deck-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chapter-deck-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.deck-card-top {
  margin-bottom: 16px;
}

.deck-badge {
  font-size: 10px;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 6px;
  display: inline-block;
}

.deck-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.deck-meta {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.deck-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-line);
  font-size: 12px;
}

.deck-read-btn {
  color: var(--accent-cyan);
  font-weight: 600;
}

.deck-pdf-size {
  color: var(--text-dim);
  font-size: 11px;
}

/* ==========================================================================
   CHANNEL READER (TWO COLUMNS: STREAM + IN-PAGE TOC)
   ========================================================================== */

.channel-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.channel-stream {
  flex: 1;
  min-width: 0;
}

/* STICKY CHANNEL BANNER */
.channel-banner-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.channel-breadcrumb {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 6px;
}

.channel-heading {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 8px;
}

.channel-summary {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.channel-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-line);
  flex-wrap: wrap;
}

.channel-badges {
  display: flex;
  gap: 8px;
}

.badge-counter {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.badge-status {
  font-size: 11px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

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

/* IN-CHANNEL FILTER & TAGS */
.in-channel-filter-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-line);
}

.filter-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.filter-input-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
}

.filter-input-wrap input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 34px;
  color: #fff;
  font-size: 12.5px;
  font-family: inherit;
}

.filter-input-wrap input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.tags-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line);
  color: var(--text-dim);
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tag-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tag-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* ==========================================================================
   TUTORIAL CARDS IN STREAM
   ========================================================================== */

.tutorial-feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.tut-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 22px;
  scroll-margin-top: 80px;
  transition: var(--transition);
  position: relative;
}

.tut-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.tut-card.highlighted {
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.tut-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-line);
}

.tut-title-wrap {
  flex: 1;
}

.tut-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  display: block;
}

.tut-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.tut-tags {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tut-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 3px;
}

.tut-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-action {
  background: transparent;
  border: 1px solid var(--border-line);
  color: var(--text-dim);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-icon-action:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon-action.active-bookmark {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}

/* TUTORIAL TEXT */
.tut-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 16px;
}

.tut-text code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
  font-size: 12.5px;
}

.tut-text a {
  color: var(--accent-blue);
  text-decoration: underline;
  word-break: break-all;
}

/* PHOTO GALLERY / ALBUM GRID */
.tut-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.tut-gallery.single-photo {
  grid-template-columns: 1fr;
  max-width: 520px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-line);
  cursor: pointer;
  aspect-ratio: 16/10;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-step-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.gallery-zoom-hint {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-dim);
  font-size: 9.5px;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
}

/* FOOTER NAV */
.channel-footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-line);
}

/* ==========================================================================
   RIGHT SIDEBAR: IN-PAGE TABLE OF CONTENTS (ON THIS PAGE)
   ========================================================================== */

.in-page-toc {
  width: var(--toc-w);
  position: sticky;
  top: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 10px;
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.toc-count {
  font-size: 10.5px;
  color: var(--accent-cyan);
}

.toc-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toc-link {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}

.toc-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.toc-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  font-weight: 600;
}

/* ==========================================================================
   SEARCH & BOOKMARKS VIEWS
   ========================================================================== */

.search-view-header, .bookmarks-header {
  margin-bottom: 20px;
}

.search-view-header h2, .bookmarks-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.search-view-header p, .bookmarks-header p {
  font-size: 12.5px;
  color: var(--text-dim);
}

.search-results-list, .bookmarks-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: var(--bg-card);
}

.sr-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.sr-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.sr-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-mark {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 1px 3px;
  border-radius: 2px;
}

/* ==========================================================================
   MODALS & LIGHTBOX
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-badge-pdf {
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.modal-title-wrap h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.modal-title-wrap p {
  font-size: 11.5px;
  color: var(--text-dim);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}

.ebook-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ebook-card-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ebook-card-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ebook-info h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.ebook-info p {
  font-size: 11px;
  color: var(--text-dim);
}

.modal-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border-line);
  background: rgba(0, 0, 0, 0.15);
}

.modal-footer-note {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

/* LIGHTBOX */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(8px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-overlay.hidden {
  display: none !important;
}

.lightbox-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  z-index: 130;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 30px;
  width: 44px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  z-index: 130;
  transition: var(--transition);
}

.lightbox-nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav-btn.prev {
  left: 20px;
}

.lightbox-nav-btn.next {
  right: 20px;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
  font-size: 12px;
  color: var(--text-secondary);
}

.lightbox-counter {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #fff;
  margin-left: 8px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid var(--accent-green);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 150;
}

.toast svg {
  color: var(--accent-green);
}

.toast.hidden {
  display: none !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 1080px) {
  .in-page-toc {
    display: none;
  }
}

@media (max-width: 840px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    transition: transform 0.25s ease;
  }

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

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    background: rgba(0, 0, 0, 0.7);
    z-index: 25;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .mobile-only {
    display: flex;
  }

  .desktop-only {
    display: none;
  }

  .main-content {
    padding: 16px 12px 60px 12px;
  }

  .home-header {
    padding: 20px;
  }

  .home-title {
    font-size: 20px;
  }

  .channel-banner-card {
    padding: 16px;
  }
}
