/* ============================================================
   LAYAR 3: DAFTAR ISI
   Bilah atas, kartu progres, daftar isi, tombol mengambang, dan banner install.
   ============================================================ */

#toc-screen, #bookmarks-screen { background: var(--bg-main); }

.top-bar {
  min-height: calc(60px + var(--safe-top));
  padding: var(--safe-top) 1rem 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo { height: 34px; }
.overlay-logo { height: 72px; }

.brand-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top-actions { display: flex; gap: 8px; flex-shrink: 0; }

.toc-content, .bookmark-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1rem 7rem 1rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.toc-card, .bookmark-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.toc-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--primary);
  letter-spacing: 0.05em;
}

/* Kartu progres */
.progress-card {
  background: var(--grad);
  color: var(--on-primary);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
.progress-card small { opacity: 0.85; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
.progress-card .pc-title { font-weight: 700; font-size: 1rem; margin: 2px 0 10px; line-height: 1.3; }
.progress-track { height: 6px; background: color-mix(in srgb, currentColor 25%, transparent); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: currentColor; border-radius: 6px; transition: width 0.4s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.75rem; margin-top: 6px; opacity: 0.9; }

/* Pencarian */
.search-box { position: relative; margin-bottom: 1rem; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-box input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 16px;
  outline: none;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.toc-item {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  gap: 8px;
}

.toc-item:hover, .toc-item:focus-visible { background: var(--primary-light); }
.toc-item.current { background: var(--primary-light); }

.toc-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 75%;
  line-height: 1.35;
}

.toc-item-dots {
  flex: 1;
  border-bottom: 2px dotted var(--border-color);
  margin-bottom: 5px;
  min-width: 12px;
}

.toc-item-page {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  min-width: 32px;
}

/* Judul bagian (KUTTAB / MADRASAH) */
.toc-head {
  margin-top: 1.25rem;
  padding: 0.8rem 0.9rem;
  background: var(--primary-light);
  border-radius: 10px;
  align-items: center;
}
.toc-head:first-child { margin-top: 0; }
.toc-head .toc-item-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary);
  max-width: none;
}
.toc-head .toc-item-dots { border-bottom-color: transparent; }
.toc-head .toc-item-page { font-size: 0.9rem; }

/* Sub judul */
.toc-sub {
  margin-left: 1rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border-color);
  border-radius: 0 8px 8px 0;
}
.toc-sub .toc-item-title { font-weight: 500; color: var(--text-main); }
.toc-sub:hover, .toc-sub.current { border-left-color: var(--primary); }

.empty-state { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; font-size: 0.9rem; }
.empty-state .icon { width: 40px; height: 40px; margin-bottom: 0.75rem; opacity: 0.6; }

.floating-cta {
  position: absolute;
  bottom: calc(52px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: calc(100% - 2rem);
  max-width: 400px;
  display: flex;
  gap: 10px;
}

/* Banner install */
.install-banner {
  background: var(--grad);
  color: var(--on-primary);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-md);
}
.install-banner.show { display: flex; }
