/* 4K centered columns for bible-chapter */
@media (min-width: 3000px) {
  .bp-app {
    /* Example ultra-wide rules, adjust as needed */
    font-size: 1.18em;
  }
  .bp-header__info {
    display: none !important;
  }
  .bible-chapter {
    columns: 4;
    column-gap: 3rem;
  }
  .bible-chapter.center-1 {
    columns: 1;
    column-gap: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.3em;
  }
  .bible-chapter.center-2 {
    columns: 2;
    column-gap: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.2em;
  }
  .bible-chapter.center-3 {
    columns: 3;
    column-gap: 3rem;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.1em;
  }

  .bible-chapter.center-4 {
    columns: 4;
    column-gap: 3rem;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
  }
  .bp-header__info {
    display: none !important;
  }
  .bp-book-scrollbar-container {
    height: 6em;
  }
  .bp-book-scrollbar {
    scrollbar-width: large;
  }
  .bp-book-scrollbar::-webkit-scrollbar {
    height: 12px;
  }
  /* Font size classes for 4K chapters */
  .bible-chapter.font-4k-psalms-119 {
    font-size: 1.2em !important;
  }
}
/* HD screens (width 900px - 2999px) */
@media (min-width: 900px) and (max-width: 2999px) {
  .bp-app {
    /* Example HD rules, adjust as needed */
    font-size: 1.08em;
  }
  .bible-chapter {
    columns: 2;
    column-gap: 3rem;
  }
  .bible-chapter.hd-center-3 {
    columns: 3;
    column-gap: 3rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  .bible-chapter.hd-center-2 {
    columns: 2;
    column-gap: 3rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
  }
  .bible-chapter.hd-center-3-psalms-119 {
    columns: 3;
    column-gap: 2rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Font size classes for HD chapters */
  .bible-chapter.font-xsmall {
    font-size: 0.82em !important;
  }
  .bible-chapter.font-msmall {
    font-size: 0.64em !important;
  }
  .bible-chapter.font-small {
    font-size: 0.92em !important;
  }
  .bible-chapter.font-psalms-119 {
    font-size: 0.49em !important;
  }
}

/* style.css - Bible Peruser dark mode layout */
:root {
  --bg-main: #181a1b;
  --bg-header: #23272a;
  --bg-footer: #23272a;
  --bg-sidebar: #202225;
  --text-main: #f5f6fa;
  --text-secondary: #b9bbbe;
  --accent: #3d4b85;
  --verse-highlight: #185398;
  --sidebar-width: 14em; /* 224px at 16px base */
  --sidebar-double-width: 28em; /* 448px at 16px base */
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: "Segoe UI", Arial, sans-serif;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Entire Book mode: maximize reading area; show both sidebars, hide header/footer/scrollbar */
.bp-app.bp-entire-book-mode .bp-header,
.bp-app.bp-entire-book-mode .bp-book-scrollbar-container,
.bp-app.bp-entire-book-mode .bp-footer,
.bp-app.bp-entire-book-mode .bp-footer__legend {
  display: none !important;
}

.bp-app.bp-entire-book-mode .bp-layout {
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
}

.bp-app.bp-entire-book-mode .bp-sidebar--left {
  top: 0;
  height: 100vh;
  max-height: 100vh;
}

.bp-app.bp-entire-book-mode .bp-sidebar--right {
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
}

.bp-app.bp-entire-book-mode .bp-main {
  height: 100vh;
  padding: 0.75rem 1rem;
  padding-bottom: 1rem;
}

/* Chapter/book search field */
.bp-book-search-field,
.bp-chapter-search-field {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.35em 0.6em;
  font-size: 0.88em;
  margin-bottom: 0.6em;
  outline: none;
}
.bp-sidebar-sticky-controls .bp-book-search-field,
.bp-sidebar-sticky-controls .bp-chapter-search-field {
  margin: 0.45em 0 0;
}
.bp-book-search-field::placeholder,
.bp-chapter-search-field::placeholder {
  color: var(--text-muted, #888);
  opacity: 1;
}
.bp-book-search-field:focus,
.bp-chapter-search-field:focus {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.bp-app.bp-entire-book-mode #prev-chapter-btn,
.bp-app.bp-entire-book-mode #next-chapter-btn,
.bp-app.bp-entire-book-mode #chapter-dropdown {
  display: none !important;
}

.bp-app.bp-entire-book-mode #entire-book-btn {
  margin-top: 0;
}

.bp-book-view {
  width: 100%;
}

.bp-book-view__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--accent);
}

.bp-book-view__chapter {
  margin: 1rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.bible-book.bible-book--dense {
  columns: 1;
  column-gap: 1.4rem;
  width: 100%;
  font-size: clamp(0.62rem, 0.56rem + 0.18vw, 0.76rem);
  line-height: 1.35;
}

.bible-book.bible-book--dense .verse-num {
  color: #dd8181;
  font-size: 0.92em;
  font-weight: 600;
}

@media (min-width: 1300px) {
  .bible-book.bible-book--dense {
    columns: 2;
  }
}

@media (min-width: 2200px) {
  .bible-book.bible-book--dense {
    columns: 3;
  }
}

/* BEM: bp-app */
.bp-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header navigation buttons (centered, dark mode) */
.bp-header__nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}
.bp-header__nav-center button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4em 1.1em;
  font-size: 1.2em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.bp-header__nav-center button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bp-header__nav-center button:hover:not(:disabled) {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}
.bp-header {
  position: relative;
}

/* Header navigation and chapter groups */
.bp-header__nav-group,
.bp-header__chapter-group {
  display: flex;
  align-items: center;
  gap: 0.5em;
  border: 1px solid #4c4c4c;
  border-radius: 6px;
  padding: 0.4em 1.1em;
}
.bp-header__nav-label,
.bp-header__chapter-label {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin: 0 0.5em;
  font-weight: 500;
}
.bp-header__nav-group button,
.bp-header__chapter-group button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4em 1.1em;
  font-size: 1.2em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.bp-header__nav-group button:disabled,
.bp-header__chapter-group button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bp-header__nav-group button:hover:not(:disabled),
.bp-header__chapter-group button:hover:not(:disabled) {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}
.bp-header__berean-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
  font-size: 1.08em;
  margin-right: 1.2em;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.bp-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.bp-layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
  grid-template-rows: 1fr;
  min-height: 0;
  height: auto;
}
.bp-layout-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.bp-sidebar {
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  width: var(--sidebar-width);
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.bp-sidebar--left {
  position: sticky;
  border-right: 1px solid #222;
  left: 0;
  top: 3.5em; /* below header */
  height: calc(100vh - 3.5em - 4.9); /* header + legend + bookbar + footer */
  max-height: calc(100vh - 3.5em - 4.9em);
  z-index: 150;
  overflow-y: auto;
}
/* Sticky chapter navigation in left sidebar */
.chapter-nav-sticky {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  padding: 8px 0;
  text-align: center;
  border-bottom: 1px solid #eee;
}
.chapter-nav-sticky {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-sidebar, #000);
}
.chapter-nav-sticky button {
  margin: 0 8px;
  padding: 6px 22px;
  font-size: 1em;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: var(--bg-sidebar, #000);
  color: var(--text-main, #222);
  cursor: pointer;
  transition: background 0.2s;
}
.chapter-nav-sticky button:disabled {
  background: #222;
  color: #888;
  cursor: not-allowed;
}
.chapter-nav-sticky button:not(:disabled):hover {
  background: var(--accent, #7289da);
  color: #fff;
}
.book-view-nav-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 0.5em;
}
.book-view-nav-label {
  color: var(--accent);
  font-size: 0.95em;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.book-view-nav-row button {
  min-width: 2.5em;
  padding-left: 0.8em;
  padding-right: 0.8em;
}

.bp-sidebar--right {
  position: sticky;
  border-left: 1px solid #222;
  right: 0;
  top: 3.5em;
  height: calc(100vh - 3.5em - 4.9em); /* header + bookbar + legend + footer */
  max-height: calc(100vh - 3.5em - 4.9em);
  z-index: 150;
  overflow-y: auto;
}
.bp-sidebar-sticky-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-sidebar);
  padding: 0.55em 0 0.6em;
  border-bottom: 1px solid #333;
}
/* Sticky highlight toggle bar in right sidebar */
.sticky-highlight-toggle-bar {
  position: relative;
  background: var(--bg-sidebar);
  z-index: 1;
  padding: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.sticky-highlight-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.08em;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.sticky-highlight-toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.2em;
}

.bp-header {
  position: sticky;
  top: 0;
  height: 3.5em;
  z-index: 200;
  background: var(--bg-header);
  color: var(--accent);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px #0002;
}
.bp-header__title {
  margin: 0;
}
.bp-header__by-gospelgo {
  font-size: 0.7em;
  font-weight: normal;
  margin-left: 0.7em;
  color: var(--text-secondary);
}
.bp-header__gospelgo-link {
  color: var(--accent);
  text-decoration: underline;
}

.by-gospelgo {
  font-size: 0.7em;
  font-weight: normal;
  margin-left: 0.7em;
  color: var(--text-secondary);
}

.by-gospelgo a {
  color: var(--accent);
  text-decoration: underline;
}

.bp-header__data {
  color: var(--text-secondary);
  font-size: 1rem;
}

.bp-header__info {
  font-size: 1em;
  color: var(--accent);
  margin-left: 0.7em;
}

.bp-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.bp-main {
  overflow-y: auto;
  height: calc(100vh - 3.5em - 11em);
  min-width: 0;
  padding-bottom: 4.2em; /* match book scroller height to prevent overlap */
  box-sizing: border-box;
}

.bp-main {
  flex: 1;
  padding-bottom: 0.6rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  background: var(--bg-main);
  color: var(--text-main);
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.bp-book-scrollbar-container {
  position: sticky;
  height: 6em;
  width: calc(
    100% - var(--sidebar-double-width)
  ); /* full width minus sidebars */
  background: var(--bg-footer);
  border: 1px solid #222;
  box-sizing: border-box;
  padding: 0.25rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  bottom: 4.2em;
  z-index: 50;
  box-shadow: 0 -2px 8px #0003;
  margin-left: var(--sidebar-width);
  margin-right: var(--sidebar-width);
}
.bp-book-scrollbar {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
  scrollbar-color: var(--accent) var(--bg-footer);
  scrollbar-width: thin;
}
.bp-book-scrollbar::-webkit-scrollbar {
  height: 8px;
}
.bp-book-scrollbar::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}
.bp-book-scrollbar::-webkit-scrollbar-track {
  background: var(--bg-footer);
}
.bp-book-scrollbar__btn {
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: none;
  border-radius: 4px;
  padding: 0.4em 0.9em;
  font-size: 1em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  outline: none;
}
.bp-book-scrollbar__btn.selected,
.bp-book-scrollbar__btn:focus {
  background: var(--accent);
  color: #fff;
}
.bp-book-scrollbar__btn:hover {
  background: #444b;
}

footer {
  background: var(--bg-footer);
  color: var(--text-secondary);
  padding: 0.75rem 2rem 0.2rem 2rem;
  text-align: center;
  font-size: 0.95rem;
  border-top: none;
  position: relative;
}

.bp-footer__legend {
  position: sticky;
  bottom: 2.1em;
  z-index: 101;
  background: var(--bg-footer);
  padding: 0.5em 2rem 0.2em 2rem;
  text-align: left;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  font-size: 1em;
  width: auto;
  box-shadow: 0 -2px 8px #0002;
  margin-left: 0px;
  margin-right: 0px;
}
.bp-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  min-height: 2.2em;
  background: var(--bg-footer);
  color: var(--text-secondary);
  padding: 0.75rem 2rem 0.75rem 2rem;
  text-align: left;
  font-size: 0.95rem;
  border-top: 1px solid #222;
  z-index: 99;
  box-shadow: 0 -2px 8px #0004;
  display: flex;
  align-items: center;
}

.header-info {
  font-size: 1em;
  color: var(--accent);
  margin-left: 0.7em;
}

.verse-highlight {
  background: linear-gradient(
    to bottom,
    transparent 15%,
    var(--verse-highlight, #343b54) 35%,
    var(--verse-highlight, #343b54) 65%,
    transparent 85%
  );
  color: #fff;
  border-radius: 4px;
  padding: 0 0px;
  transition: background 0.2s;
}

.search-highlight {
  color: #ffe923;
  border-radius: 4px;
  padding: 0 0px;
  transition: background 0.2s;
}

.topic-btn {
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.4em 1em;
  font-size: 1em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.topic-btn.active {
  /* Visually distinct right sidebar highlight button when selected */
  .topic-highlight-btn.active {
    background: var(--accent);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 0 8px var(--accent);
    cursor: default;
    pointer-events: none;
  }
  background: var(--accent);
  color: #fff;
  border: 1px solid #fff;
  box-shadow: 0 0 8px var(--accent);
}

/* Special style for topic label buttons (dark mode friendly) */
.topic-label-btn {
  background: #2d3a4a;
  color: #ffe082;
  border: 1px solid #3e4c5a;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition:
    background 0.2s,
    color 0.2s;
}
.topic-label-btn.active,
.topic-label-btn:active {
  background: #3e4c5a;
  color: #fffde7;
}
.topic-btn--with-reference {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}
.topic-book-outline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}
.outline-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95em;
}

/* Dark mode for outline reference menu tooltip */
.reference-menu {
  background: #23272a !important;
  color: #f5f6fa !important;
  border: 1px solid #444 !important;
  box-shadow: 0 2px 12px #000a !important;
  font-size: 1em;
  border-radius: 8px;
  padding: 8px 14px;
  z-index: 1000;
}
.reference-menu hr {
  border: none;
  border-top: 1px solid #333;
  margin: 8px 0;
}
.reference-menu-item {
  color: #ffe082 !important;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.reference-menu-item:hover {
  background: #3d4b85;
  color: #fff;
}

/* Mobile/tablet overlay */
@media (max-width: 899px) {
  .bp-app {
    filter: blur(2px) grayscale(0.5);
    pointer-events: none;
    user-select: none;
  }
  .bp-mobile-overlay {
    display: flex !important;
  }
}

.bp-mobile-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(24, 26, 27, 0.98);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2em 1em;
}
.bp-mobile-overlay__msg {
  font-size: 1.3em;
  margin-bottom: 1.5em;
}
.bp-mobile-overlay__actions {
  display: flex;
  gap: 1em;
  margin-bottom: 1.5em;
  flex-wrap: wrap;
  justify-content: center;
}
.bp-mobile-overlay__btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.7em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}
.bp-mobile-overlay__btn:hover {
  background: #4a5bbd;
}
.bp-mobile-overlay__logo {
  display: inline-block;
  margin-top: 1em;
}
.bp-mobile-overlay__logo img {
  height: 100px;
  width: auto;
  vertical-align: middle;
}

/* Compact header: 900px–1474px (items overlap above this range is fine, below needs scaling) */
@media (min-width: 900px) and (max-width: 1474px) {
  .bp-header {
    padding: 0.4rem 1rem;
  }
  .bp-header__title {
    font-size: 1.1em;
  }
  .bp-header__by-gospelgo {
    font-size: 0.65em;
  }
  .bp-header__nav-center {
    gap: 0.5em;
  }
  .bp-header__nav-center button {
    padding: 0.2em 0.55em;
    font-size: 0.9em;
  }
  .bp-header__nav-group,
  .bp-header__chapter-group {
    padding: 0.2em 0.55em;
    gap: 0.25em;
    margin-left: 1em !important;
  }
  .bp-header__nav-group button,
  .bp-header__chapter-group button {
    padding: 0.2em 0.55em;
    font-size: 0.9em;
  }
  .bp-header__nav-label,
  .bp-header__chapter-label {
    font-size: 0.8em;
    margin: 0 0.25em;
  }
  .bp-header__berean-link {
    font-size: 0.82em;
    margin-right: 0.5em;
  }
  .bp-header__right {
    gap: 0.7em !important;
    right: 1rem !important;
  }
}
