/* Leitor comum da biblioteca de livros (/biblioteca/livros/*). */

.br-page {
  background: var(--light-color);
  color: var(--text-color);
}

.br-page .site-hero {
  margin-top: 80px;
  background:
    linear-gradient(120deg, rgba(12, 30, 11, 0.86) 0%, rgba(21, 46, 18, 0.72) 48%, rgba(212, 175, 55, 0.3) 100%),
    url('/img/pages/sunnah/sunnah-lg.webp') center center / cover no-repeat;
  color: #fff;
}

.br-shell {
  padding: 32px 0 56px;
}

.br-notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-left: 4px solid var(--gold-color);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.08);
  color: var(--text-color);
  line-height: 1.5;
}

.br-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.br-sidebar,
.br-reader,
.br-panel {
  background: #fff;
  border: 1px solid rgba(51, 85, 45, 0.14);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(51, 85, 45, 0.06);
}

.br-sidebar {
  position: sticky;
  top: 96px;
  padding: 16px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.br-sidebar-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.br-sidebar-head h2 {
  margin: 0 0 6px;
  color: var(--primary-color);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  line-height: 1.25;
}

.br-sidebar-head p,
.br-panel-subtitle {
  margin: 0;
  color: var(--gray-color);
  font-size: 0.92rem;
  line-height: 1.45;
}

.br-sidebar-list,
.br-nav-list {
  display: grid;
  gap: 6px;
}

.br-nav-list {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.br-sidebar-item,
.br-nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--text-color);
  cursor: pointer;
  text-align: left;
}

.br-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  font-weight: 700;
}

.br-sidebar-item small {
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(51, 85, 45, 0.08);
  color: var(--primary-color);
  font-size: 0.78rem;
}

.br-nav-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  font-size: 0.88rem;
  line-height: 1.3;
}

.br-nav-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
}

.br-sidebar-item:hover,
.br-nav-item:hover,
.br-sidebar-item.active,
.br-nav-item.active {
  border-color: rgba(51, 85, 45, 0.28);
  background: rgba(51, 85, 45, 0.06);
}

.br-reader,
.br-panel {
  padding: 20px;
}

.br-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.br-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.br-tools {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.br-lang-btn,
.br-action-btn,
.br-clear-btn,
.br-page-btn {
  border: 1px solid rgba(51, 85, 45, 0.22);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
}

.br-lang-btn {
  padding: 10px 14px;
}

.br-action-btn,
.br-clear-btn,
.br-page-btn {
  padding: 7px 11px;
  font-size: 0.84rem;
}

.br-lang-btn:hover,
.br-action-btn:hover,
.br-clear-btn:hover,
.br-page-btn:hover:not(:disabled) {
  background: rgba(51, 85, 45, 0.07);
}

.br-page-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.br-stats {
  color: var(--gray-color);
  font-size: 0.92rem;
}

.br-panel-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.br-panel-head h2 {
  margin: 0 0 6px;
  color: var(--primary-color);
  font-family: var(--font-heading);
  font-size: 1.35rem;
  line-height: 1.25;
}

.br-list,
.br-content {
  display: grid;
  gap: 16px;
}

.br-card,
.br-item {
  border: 1px solid rgba(51, 85, 45, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  /* Keep anchored items visible below the fixed site header. */
  scroll-margin-top: 96px;
}

.br-card {
  background: #fbfcfb;
}

.br-card-meta {
  margin: 0 0 10px;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 0.9rem;
}

.br-text,
.br-rich-text {
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1.75;
}

.br-rich-text p {
  margin: 0 0 0.7em;
}

.br-rich-text p:last-child {
  margin-bottom: 0;
}

.br-rich-text ul {
  margin: 0.4em 0 0.8em 1.25em;
  padding: 0;
}

.br-rich-text li {
  margin: 0.25em 0;
}

.br-text--rtl {
  direction: rtl;
  text-align: right;
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: 1.12rem;
  line-height: 2;
}

.br-bilingual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.br-lang-block {
  min-width: 0;
}

.br-lang-block--ar {
  border-right: 3px solid rgba(212, 175, 55, 0.6);
  padding-right: 14px;
}

.br-item-title {
  margin: 0 0 10px;
  color: var(--primary-color);
  font-family: var(--font-heading);
  font-size: 1.35rem;
  line-height: 1.35;
  scroll-margin-top: 104px;
}

.br-item-title--ar {
  color: var(--gold-dark);
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: 1.35rem;
  direction: rtl;
  text-align: center;
}

.br-item--book-header {
  text-align: center;
  border-top: 3px solid var(--gold-color);
  border-bottom: 3px solid var(--gold-color);
  background: rgba(212, 175, 55, 0.05);
}

.br-item--heading {
  border: 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.55);
  background: transparent;
  border-radius: 0;
  padding: 18px 4px 10px;
  text-align: center;
}

.br-book-author,
.br-book-meta,
.br-topic {
  margin: 0 0 8px;
  color: var(--gray-color);
  line-height: 1.5;
}

.br-book-line--ar {
  direction: rtl;
  unicode-bidi: isolate;
  text-align: center;
}

.br-topic {
  color: var(--gold-dark);
  font-weight: 700;
}

.br-question {
  margin: 0 0 12px;
  color: var(--primary-color);
  font-size: 1.05rem;
  line-height: 1.45;
}

/* QA/Crianças: bloco arabe destacado sem semantica de versiculo do Alcorao */
.br-qa-arabic-line {
  direction: rtl;
  unicode-bidi: isolate;
  text-align: right;
  margin: 12px 0;
  padding: 14px 18px;
  background: rgba(139, 105, 20, 0.08);
  border-right: 4px solid #8b6914;
  border-radius: 8px;
  font-size: 1.12rem;
  line-height: 1.8;
  font-family: 'Amiri', 'Traditional Arabic', 'Scheherazade New', serif;
  color: #8b6914;
}

.br-qa-citation-pt {
  margin: 8px 0 12px;
  padding: 10px 14px;
  background: rgba(212, 175, 55, 0.08);
  border-left: 4px solid rgba(212, 175, 55, 0.5);
  border-radius: 8px;
  font-size: 0.98rem;
  line-height: 1.65;
  color: #333;
}

.br-item--manuscript {
  border-left: 4px solid var(--gold-color);
  background: rgba(212, 175, 55, 0.06);
}

.br-editorial-accordion {
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.br-editorial-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  color: var(--primary-color);
  font-weight: 700;
}

.br-editorial-summary::-webkit-details-marker {
  display: none;
}

.br-editorial-summary-title {
  line-height: 1.35;
}

.br-editorial-summary::after {
  content: 'Ver detalhes';
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-color);
  white-space: nowrap;
}

.br-editorial-accordion[open] .br-editorial-summary::after {
  content: 'Ocultar detalhes';
}

.br-editorial-content {
  padding: 0 14px 12px;
}

.br-editorial-content .br-bilingual {
  border-top: 1px solid rgba(51, 85, 45, 0.14);
  padding-top: 12px;
}

.br-item--conclusion {
  text-align: center;
  border-color: rgba(212, 175, 55, 0.45);
}

.br-item--bismillah .br-lang-block--ar .br-rich-text p:first-child {
  color: var(--gold-dark);
  font-size: 1.35rem;
}

.br-page-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  color: var(--gray-color);
}

.br-empty,
.br-loading,
.br-error {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--gray-color);
}

.br-error {
  color: #9b1c1c;
}

.br-floating {
  position: fixed;
  left: 14px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(51, 85, 45, 0.3);
  background: var(--primary-color);
  color: #fff;
  z-index: 1600;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.br-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 8, 0.58);
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.br-modal.active {
  display: flex;
}

.br-dialog {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(51, 85, 45, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  padding: 16px;
}

.br-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.br-dialog-head h3 {
  margin: 0;
  color: var(--primary-color);
  font-family: var(--font-heading);
}

.br-dialog-close {
  border: 1px solid rgba(51, 85, 45, 0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  background: #fff;
  color: var(--primary-color);
  cursor: pointer;
}

.br-lang-options {
  display: grid;
  gap: 10px;
}

.br-lang-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(51, 85, 45, 0.15);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 0.92rem;
  color: var(--primary-color);
  font-weight: 700;
  background: #fff;
  cursor: pointer;
}

.br-lang-flag {
  width: 24px;
  height: 18px;
  object-fit: contain;
}

.br-lang-ar .br-panel-head,
.br-lang-ar .br-panel-head h2,
.br-lang-ar .br-panel-head p {
  direction: rtl;
  text-align: right;
}

/* C8: footnote item */
.br-item--footnote {
  border: 0;
  border-top: 1px dashed var(--border-color);
  border-radius: 0;
  background: transparent;
  padding: 8px 4px;
}
.br-footnote-text {
  margin: 0;
  font-size: 0.82rem;
  color: var(--gray-color);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .br-layout {
    grid-template-columns: 1fr;
  }

  .br-sidebar {
    position: static;
    max-height: none;
  }

  /* C4: limit nav-list height on mobile (Nahj has 241 items) */
  .br-nav-list {
    max-height: 200px;
    overflow-y: auto;
  }

  .br-bilingual {
    grid-template-columns: 1fr;
  }

  .br-qa-arabic-line { font-size: 1.02rem; padding: 12px 14px; }
  .br-qa-citation-pt { font-size: 0.92rem; padding: 8px 12px; }
}

@media (max-width: 768px) {
  .br-page .site-hero {
    margin-top: 0;
    padding: 42px 0 32px;
  }

  .br-shell {
    padding: 24px 0 40px;
  }

  .br-lang-btn {
    display: none;
  }

  .br-floating {
    display: inline-flex;
  }

  .br-reader,
  .br-panel {
    padding: 14px;
  }

  .br-card,
  .br-item {
    padding: 14px;
  }

  .br-page-nav {
    flex-wrap: wrap;
  }
}
