/* Open Library navigation + pagination correction layer. Loaded last. */

/* Journal primary navigation: active state must follow the actual OJS route. */
html body.openlib-journal-page .openlib_journal_nav .pkp_navigation_primary > li > a.openlib-nav-active,
html body.openlib-journal-page .openlib_journal_nav .pkp_navigation_primary > li > a[aria-current="page"] {
  color:#DC2626 !important;
  border-bottom-color:#DC2626 !important;
  background:#FFF7F7 !important;
}
html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_nav .pkp_navigation_primary > li > a.openlib-nav-active,
html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_nav .pkp_navigation_primary > li > a[aria-current="page"] {
  color:#FCA5A5 !important;
  border-bottom-color:#EF4444 !important;
  background:#241416 !important;
}

/* OJS page_links outputs bare <a> and <strong> elements (not ul/li/current).
   Style the actual markup so the active page can not fall outside the controls. */
html body .cmp_pagination,
html body .openlib_search_pagination {
  box-sizing:border-box !important;
  display:flex !important;
  flex-wrap:wrap !important;
  align-items:center !important;
  justify-content:center !important;
  gap:7px !important;
  width:100% !important;
  margin:26px 0 8px !important;
  padding:18px 10px 0 !important;
  border-top:1px solid #E2E8F0 !important;
  clear:both !important;
  color:#64748B !important;
  font-size:12px !important;
  line-height:1 !important;
}
html body .cmp_pagination > a,
html body .cmp_pagination > strong,
html body .openlib_search_pagination > a,
html body .openlib_search_pagination > strong {
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  flex:0 0 auto !important;
  min-width:38px !important;
  height:38px !important;
  margin:0 !important;
  padding:0 11px !important;
  border:1px solid #D7DEE7 !important;
  border-radius:9px !important;
  background:#fff !important;
  color:#475569 !important;
  font-size:12px !important;
  font-weight:800 !important;
  line-height:1 !important;
  text-decoration:none !important;
  box-shadow:none !important;
}
html body .cmp_pagination > a:hover,
html body .cmp_pagination > a:focus,
html body .openlib_search_pagination > a:hover,
html body .openlib_search_pagination > a:focus {
  border-color:#FCA5A5 !important;
  background:#FFF1F2 !important;
  color:#B91C1C !important;
  outline:0 !important;
  box-shadow:0 0 0 3px rgba(220,38,38,.10) !important;
}
html body .cmp_pagination > strong,
html body .openlib_search_pagination > strong {
  border-color:#DC2626 !important;
  background:#DC2626 !important;
  color:#fff !important;
}

/* Search result counter: keep it readable and visually attached to results. */
html body .openlib_search_results_count {
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  min-height:34px !important;
  padding:7px 11px !important;
  border:1px solid #FECACA !important;
  border-radius:9px !important;
  background:#FFF7F7 !important;
  color:#B91C1C !important;
  font-size:12px !important;
  font-weight:800 !important;
  line-height:1.25 !important;
}
html[data-openlib-color-mode="dark"] body .openlib_search_results_count {
  border-color:#7F1D1D !important;
  background:#241416 !important;
  color:#FCA5A5 !important;
}
html[data-openlib-color-mode="dark"] body .cmp_pagination,
html[data-openlib-color-mode="dark"] body .openlib_search_pagination {
  border-top-color:#334155 !important;
  color:#94A3B8 !important;
}
html[data-openlib-color-mode="dark"] body .cmp_pagination > a,
html[data-openlib-color-mode="dark"] body .openlib_search_pagination > a {
  border-color:#334155 !important;
  background:#111827 !important;
  color:#CBD5E1 !important;
}
html[data-openlib-color-mode="dark"] body .cmp_pagination > strong,
html[data-openlib-color-mode="dark"] body .openlib_search_pagination > strong {
  border-color:#EF4444 !important;
  background:#DC2626 !important;
  color:#fff !important;
}

@media (max-width:640px) {
  html body .cmp_pagination,
  html body .openlib_search_pagination { gap:5px !important; padding-left:4px !important; padding-right:4px !important; }
  html body .cmp_pagination > a,
  html body .cmp_pagination > strong,
  html body .openlib_search_pagination > a,
  html body .openlib_search_pagination > strong {
    min-width:34px !important;
    height:34px !important;
    padding:0 9px !important;
    border-radius:8px !important;
  }
}
