/* ============================================================
   NILESHMENT — Book Detail Page Styles
   ============================================================ */

/* ─── Progress Bar ─── */
.reading-progress-bar {
  position: fixed; top: 0; left: 0; z-index: 2000;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.1s linear;
}

/* ─── Back Nav ─── */
.back-nav {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: 0.875rem; font-weight: 500;
  text-decoration: none; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  transition: var(--transition); cursor: pointer;
}
.back-btn:hover { color: var(--accent-2); border-color: var(--border-hover); background: var(--surface-hover); }

/* ─── Book Hero ─── */
.book-hero {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 60px 0;
  position: relative; overflow: hidden;
}
.book-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--bg-2);
  pointer-events: none;
}
.book-hero-inner {
  display: grid; grid-template-columns: auto 1fr; gap: 48px; align-items: center;
  position: relative; z-index: 1;
}
.book-hero-cover {
  width: 180px; height: 260px; border-radius: 6px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0; position: relative;
}
.book-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-hero-cover-fallback {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 20px; text-align: center;
}
.book-hero-cover-fallback .fe { font-size: 3rem; }
.book-hero-cover-fallback .ft {
  font-family: 'Playfair Display', serif; font-size: 1rem;
  font-weight: 700; color: white; line-height: 1.3;
}
.book-hero-cover-fallback .fa { font-size: 0.75rem; color: rgba(255,255,255,0.7); }

.book-hero-meta { padding-top: 8px; }
.book-category-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent); margin-bottom: 16px;
}
.book-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 700;
  color: var(--text); line-height: 1.15; margin-bottom: 8px;
}
.book-hero-author { font-size: 1.05rem; color: var(--text-2); margin-bottom: 20px; }
.book-hero-stats {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.hero-stat-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-2); font-weight: 500;
}
.hero-stat-chip .chip-icon { font-size: 0.9rem; }
.hero-stat-chip strong { color: var(--text); }

.book-tagline-quote {
  font-family: 'Playfair Display', serif; font-size: 1.05rem;
  font-style: italic; color: var(--gold); line-height: 1.6;
  padding-left: 16px; border-left: 3px solid var(--gold);
}

/* ─── Page Layout ─── */
.book-page-layout {
  display: grid; grid-template-columns: 260px 1fr; gap: 0;
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  align-items: start; min-height: 80vh;
}

/* ─── Sidebar TOC ─── */
.book-sidebar {
  position: sticky; top: 80px;
  padding: 32px 24px 32px 0;
  border-right: 1px solid var(--border);
}
.sidebar-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-3); margin-bottom: 16px;
}
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.toc-item a {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 8px; font-size: 0.82rem; color: var(--text-2);
  text-decoration: none; transition: var(--transition); position: relative;
}
.toc-item a:hover { background: var(--surface); color: var(--text); }
.toc-item a.active {
  background: var(--accent-glow); color: var(--accent-2); font-weight: 600;
}
.toc-item a.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--accent); border-radius: 2px;
}
.toc-num {
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0; color: var(--text-3);
}
.toc-item a.active .toc-num {
  background: var(--accent); border-color: var(--accent); color: white;
}

.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.sidebar-cta {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 8px; font-size: 0.82rem; color: var(--text-2);
  cursor: pointer; background: none; border: none; font-family: 'Inter', sans-serif;
  width: 100%; transition: var(--transition);
}
.sidebar-cta:hover { background: var(--surface); color: var(--text); }

/* ─── Main Content ─── */
.book-main { padding: 40px 0 80px 40px; }

/* ─── Section headings ─── */
.content-section { margin-bottom: 64px; scroll-margin-top: 100px; }
.section-eyebrow {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--accent-2); margin-bottom: 10px;
}
.section-heading {
  font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700;
  color: var(--text); margin-bottom: 24px; line-height: 1.25;
}

/* ─── Summary Block ─── */
.summary-card {
  padding: 24px 28px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 20px; line-height: 1.85; font-size: 0.95rem; color: var(--text-2);
}

.big-idea-block {
  padding: 28px 32px; border-radius: 8px;
  background: var(--bg-3);
  border-left: 4px solid var(--accent);
}
.big-idea-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.big-idea-text {
  font-family: 'Playfair Display', serif; font-size: 1.15rem;
  color: var(--text); line-height: 1.7; font-style: italic;
}

/* ─── Chapter Cards ─── */
.chapters-grid { display: flex; flex-direction: column; gap: 20px; }

.chapter-card {
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  background: var(--surface); transition: var(--transition);
}
.chapter-card:hover { border-color: var(--border-hover); box-shadow: 0 4px 24px var(--accent-glow); }

.chapter-header {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px;
  cursor: pointer; user-select: none;
}
.chapter-num {
  width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; color: var(--accent);
  font-family: 'Playfair Display', serif;
}
.chapter-title-wrap { flex: 1; }
.chapter-label {
  font-size: 0.65rem; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 2px;
}
.chapter-name {
  font-family: 'Playfair Display', serif; font-size: 1.05rem;
  font-weight: 600; color: var(--text); line-height: 1.3;
}
.chapter-toggle {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--text-3); transition: transform 0.3s ease;
}
.chapter-card.open .chapter-toggle { transform: rotate(180deg); }

.chapter-body {
  padding: 0 24px; max-height: 0; overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4,0,0.2,1), padding 0.3s ease;
}
.chapter-card.open .chapter-body { max-height: 600px; padding: 0 24px 24px; }

.chapter-summary-text {
  font-size: 0.95rem; color: var(--text-2); line-height: 1.85;
  padding-top: 4px; border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ─── Key Insights Grid ─── */
.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.insight-card {
  padding: 18px 20px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
  transition: var(--transition);
}
.insight-card:hover { background: var(--surface-hover); border-color: var(--border-hover); transform: translateY(-2px); }
.insight-icon {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  background: var(--surface-hover); border: 1px solid var(--border-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: var(--accent);
  font-family: 'Playfair Display', serif;
}
.insight-text-wrap .insight-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-2); margin-bottom: 4px;
}
.insight-text-wrap .insight-body { font-size: 0.88rem; color: var(--text-2); line-height: 1.55; }

/* ─── Quotes ─── */
.quotes-grid { display: flex; flex-direction: column; gap: 18px; }
.quote-block {
  padding: 24px 28px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--gold); position: relative;
  overflow: hidden;
}
.quote-block::before {
  content: '\201C'; position: absolute; top: 0; right: 16px;
  font-size: 6rem; color: var(--gold-glow); font-family: 'Playfair Display', serif;
  line-height: 1; pointer-events: none;
}
.quote-text {
  font-family: 'Playfair Display', serif; font-size: 1.1rem;
  line-height: 1.7; color: var(--text); font-style: italic; margin-bottom: 12px;
  position: relative;
}
.quote-attribution { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }

/* ─── QUIZ SECTION ─── */
.quiz-section {
  background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 40px; position: relative; overflow: hidden;
}
.quiz-section::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--bg-2);
  pointer-events: none;
}

.quiz-header { text-align: center; margin-bottom: 32px; position: relative; }
.quiz-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 999px; margin-bottom: 12px;
  background: var(--accent-glow); border: 1px solid var(--accent);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-2);
}
.quiz-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.quiz-subtitle { font-size: 0.88rem; color: var(--text-2); }

/* Progress tracker */
.quiz-progress-wrap { margin-bottom: 28px; position: relative; }
.quiz-progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--text-3); margin-bottom: 8px;
}
.quiz-progress-bar {
  height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.4s ease;
}

/* Question */
.quiz-question-wrap { margin-bottom: 24px; min-height: 120px; }
.quiz-q-num {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-2); margin-bottom: 8px;
}
.quiz-q-text {
  font-family: 'Playfair Display', serif; font-size: 1.15rem;
  font-weight: 600; color: var(--text); line-height: 1.5;
}

/* Options */
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.quiz-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  transition: var(--transition); font-family: 'Inter', sans-serif;
  text-align: left; width: 100%;
  color: var(--text-2); font-size: 0.9rem;
}
.quiz-option:hover:not(:disabled) { border-color: var(--border-hover); background: var(--surface-hover); color: var(--text); }
.quiz-option:disabled { cursor: not-allowed; }
.quiz-option.correct { background: rgba(16,185,129,0.1); border-color: #10b981; color: #10b981; }
.quiz-option.wrong   { background: rgba(239,68,68,0.1);  border-color: #ef4444; color: #ef4444; }
.quiz-option.reveal  { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.3); }

.option-letter {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-3);
  margin-top: 1px;
}
.quiz-option.correct .option-letter { background: #10b981; border-color: #10b981; color: white; }
.quiz-option.wrong   .option-letter { background: #ef4444; border-color: #ef4444; color: white; }
.quiz-option.reveal  .option-letter { background: rgba(16,185,129,0.3); border-color: #10b981; color: #10b981; }

/* Explanation */
.quiz-explanation {
  padding: 16px 20px; border-radius: 12px; margin-bottom: 20px;
  background: rgba(124,58,237,0.08); border: 1px solid rgba(124,58,237,0.25);
  display: none;
}
.quiz-explanation.visible { display: block; }
.explanation-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-2); margin-bottom: 6px;
}
.explanation-text { font-size: 0.88rem; color: var(--text-2); line-height: 1.55; }

/* Quiz buttons */
.quiz-footer { display: flex; align-items: center; justify-content: space-between; }
.quiz-score-display {
  font-size: 0.85rem; color: var(--text-2);
}
.quiz-score-display strong { color: var(--gold); font-size: 1rem; }
.quiz-next-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 6px;
  background: var(--text);
  color: var(--bg); font-size: 0.875rem; font-weight: 600;
  border: none; cursor: pointer; font-family: 'Inter', sans-serif;
  transition: var(--transition); display: none;
}
.quiz-next-btn.visible { display: inline-flex; }
.quiz-next-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }

/* Quiz Results */
.quiz-results {
  text-align: center; padding: 20px 0;
  display: none;
}
.quiz-results.visible { display: block; }
.results-emoji { font-size: 3.5rem; margin-bottom: 16px; }
.results-score {
  font-family: 'Playfair Display', serif; font-size: 3rem;
  font-weight: 700; margin-bottom: 8px;
}
.results-score .score-frac span { color: var(--accent-2); }
.results-message {
  font-size: 1.05rem; color: var(--text-2); margin-bottom: 24px; line-height: 1.6;
}
.quiz-restart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: var(--transition);
}
.quiz-restart-btn:hover { background: var(--surface-hover); border-color: var(--border-hover); }

/* ─── Reading Progress FloatingBar ─── */
.floating-progress {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 8px 20px; border-radius: 999px; z-index: 900;
  background: var(--bg-2); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78rem; color: var(--text-2);
  opacity: 0; transition: opacity 0.3s ease;
}
.floating-progress.visible { opacity: 1; }
.fp-bar { width: 80px; height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; }
.fp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 2px; transition: width 0.1s; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .book-page-layout { grid-template-columns: 1fr; }
  .book-sidebar { display: none; }
  .book-main { padding: 32px 0 60px; }
  .insights-grid { grid-template-columns: 1fr; }
  .book-hero-inner { grid-template-columns: 1fr; gap: 24px; text-align: center; justify-items: center; }
  .book-hero-cover { width: 140px; height: 200px; margin: 0 auto; }
  .book-hero-stats { justify-content: center; }
  .book-tagline-quote { border-left: none; padding-left: 0; padding-top: 16px; border-top: 3px solid var(--gold); }
}
@media (max-width: 640px) {
  body { padding-bottom: 80px; } /* Room for bottom nav */
  .book-page-layout { padding: 0 16px; }
  .book-hero { padding: 30px 0; }
  .book-hero-title { font-size: 2rem; }
  .quiz-section { padding: 24px 16px; }
  .summary-card { padding: 20px 16px; font-size: 1rem; }
  .chapter-header { padding: 16px; }
  .chapter-num { width: 32px; height: 32px; font-size: 0.8rem; }
  .quote-block { padding: 20px 16px; }
}
