/* Base styles, modern dark theme, Material look */
body {
  margin: 0;
  padding: 0%;
  font-family: 'PT Sans Narrow', Arial, sans-serif;
  background: #181a20;
  color: #f1f1f1;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 1.25em; /* 25% larger base font */
}

/* Loading overlay */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #1f2128;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s;
}
#loading-screen .material-icons {
  color: #00ff00;
  font-size: 3.5rem;
  margin-bottom: 0.6em;
}
#loading-screen h2 {
  color: #00ff00;
  font-size: 1.56rem; /* 25% larger than 1.25rem */
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.06em;
}

/* Hide app before ready */
.app-hidden { display: none; }

/* Main App Container */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  justify-content: flex-start;
  position: relative;
  box-sizing: border-box;
  padding: 1% 2%;
  max-width: 100%;
}

/* --- Static search input and suggestion style (matching footer look, modern, elevated) --- */
#search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2% 0;
  width: 100%;
  padding: 0;
  max-width: 100%;
}

#search-container #search-input {
  outline: none;
  padding: 1.2% 3%;
  font-size: 1.25rem; /* 25% larger */
  width: 100%;
  max-width: min(90vw, 320px);
  background: #242732;
  color: #e2e2e2;
  border: 1.5px solid #34495e;
  border-radius: 32px;
  box-shadow: 0 3px 24px #22347a18;
  margin: 0 auto;
  transition: background 0.22s, border 0.22s, box-shadow 0.18s;
  box-sizing: border-box;
}
#search-container #search-input:focus {
  background: #22253a;
  border-color: #5c88ff;
  box-shadow: 0 7px 28px #2b67e022;
}
#search-container #search-input::placeholder {
  color: #aac9eead;
  opacity: 1;
  font-family: 'PT Sans Narrow', Arial, sans-serif;
}

.search-options {
  width: 96%;
  max-width: 320px;
  margin-top: 10px;
  position: relative;
}

.search-types {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  background: #242732;
  border-radius: 20px;
  padding: 4px;
  height: 44px;
  align-items: center;
}

.search-types label {
  flex: 1;
  text-align: center;
  padding: 6px;
  border-radius: 16px;
  cursor: pointer;
  color: #00ff00;
  transition: all 0.3s ease;
}

.search-types input[type="radio"] {
  display: none;
}

.search-types input[type="radio"]:checked + label,
.search-types label:has(input[type="radio"]:checked) {
  background: transparent;
  color: #00ff00;
  border: 2px solid #00ff00;
}

.search-filters {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}

.search-filters label {
  color: #00ff00;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-filters input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888888;
  cursor: pointer;
  padding: 4px;
  display: none !important;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 100;
  font-size: 12px;
  align-items: center;
  justify-content: center;
}

.clear-search.visible {
  display: inline-flex !important;
}

.material-icons.md-18 { font-size: 18px; }
.clear-search:hover {
  background: #293046;
  color: #aaaaaa;
}

#search-container #books-suggest {
  width: 100%;
  max-width: 320px;
  min-height: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  margin-top: 0.15em;
  box-sizing: border-box;
}

.book-match {
  cursor: pointer;
  padding: 0.7em 1.1em;
  margin: 0.16em 0;
  font-size: 1.29em; /* 25% larger than 1.03em */
  border-radius: 18px;
  background: #293046;
  color: #00ff00;
  transition: background 0.18s, color 0.18s;
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.book-match:hover, .book-match.selected {
  background: #3e5995;
  color: #fff;
}
.book-match .material-icons {
  vertical-align: middle;
}

/* Chapter List styling */
.chapter-list-item {
  cursor: pointer;
  padding: 0.7em 1.2em;
  margin: 0.13em 0;
  font-size: 1.31em; /* 25% larger than 1.05em */
  border-radius: 14px;
  background: #000000;
  color: #e0e9fa;
  border: 2px solid white;
  transition: all 0.2s ease;
  text-align: center;
}
.chapter-list-item:hover,
.chapter-list-item.selected {
  background: #2d3245;
  border-color: #00ff00;
  color: #fff;
}

/* Verse results container (Scrollable under fixed footer) */
#verse-results {
  margin: 0 auto;
  width: 100%;
  max-width: min(95vw, 520px);
  display: flex;
  flex-direction: column;
  gap: 1%;
  padding: 0 2% 8% 2%;
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  transition: max-height .25s;
}
.verse {
  background: #23272c;
  border-left: 5px solid #2777e0dd;
  padding: 1em 1.1em 1em 1.4em;
  border-radius: 12px;
  box-shadow: 1px 2px 9px #23263423;
}
.verse-ref {
  color: #00ff00;
  font-weight: 500;
  font-size: 1.21em; /* 25% larger than 0.97em */
  margin-bottom: 0.16em;
}
.verse-text {
  color: #ffffff;
  font-size: 1.35em; /* 25% larger than 1.08em */
}
.verse.matched-verse {
  border-left: 10px solid #f0d661;
  background: #364469;
  box-shadow: 0 2px 15px #cfb52518;
}

/* --- Tighter static footer --- */
#chapter-footer-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: #151922f9;
  display: flex !important;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  padding: 0.2em 0 0.35em 0;
  border-top: 1.5px solid #4443;
  font-size: 1em;
  min-height: 38px;
  box-shadow: 0 -2px 14px #0004;
  transition: opacity .22s;
}

#chapter-footer-nav button.chapter-nav-btn {
  background: none;
  border: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  font-size: 0.92em; /* 25% smaller than 1.23em */
  cursor: pointer;
  font-family: inherit;
  padding: 0.25em 0.7em;
  border-radius: 14px;
  transition: background 0.2s, color 0.2s;
}
#chapter-footer-nav button.chapter-nav-btn:hover {
  background: #273355bb;
  color: #ffe49c;
}
#chapter-footer-nav .material-icons {
  font-size: 1.17em;
  vertical-align: middle;
}

::-webkit-scrollbar { display: none; }

.verse-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.5em;
}

.verse {
  flex: 1;
  background: #23272c;
  border-left: 5px solid #2777e0dd;
  padding: 1em 1.1em 1em 1.4em;
  border-radius: 12px;
  box-shadow: 1px 2px 9px #23263423;
}

input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.copy-button {
  background: #00ff00;
  color: #000000;
  border: none;
  border-radius: 24px;
  padding: 8px 16px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  margin: 0 8px;
}

.copy-button:hover {
  background: #33ff33;
}

.copy-button .material-icons {
  font-size: 20px;
}

.return-chart-button {
  background: #242732;
  color: #00ff00;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin: 0 8px;
  font-size: 14px;
}

.return-chart-button:hover {
  background: #2d3245;
  color: #00ff00;
}

.help-button {
  background: #242732;
  color: #00ff00;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin: 0 8px;
}

.help-button:hover {
  background: #2d3245;
  color: #00ff00;
}

.help-button .material-icons {
  font-size: 20px;
}

.help-search-type-btn {
  background: #242732;
  color: #888888;
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  height: 32px;
  min-width: 44px;
}

.help-search-type-btn:hover {
  background: #2d3245;
  color: #aaaaaa;
}

.help-search-type-btn .material-icons {
  font-size: 18px;
  line-height: 1;
}







/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  background: #23272c;
  margin: 15vh auto;
  width: 90%;
  max-width: 500px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid #34495e;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #34495e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  color: #00ff00;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3em;
}

.close-modal {
  background: none;
  border: none;
  color: #00ff00;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-modal:hover {
  background: #293046;
  color: #fff;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body section {
  margin-bottom: 20px;
}

.modal-body h3 {
  color: #00ff00;
  margin: 0 0 8px 0;
  font-size: 1.1em;
}

.modal-body p {
  color: #e0e9fa;
  margin: 0;
  line-height: 1.5;
}

/* --- Mobile-first: Extra mobile-safe overrides for narrow screens --- */
@media (max-width: 400px) {
  #search-container {
    width: 100%;
    padding: 0 2%;
    margin: 3% 0;
  }
  #search-container #search-input {
    font-size: 1em;
    width: 100%;
    padding: 2% 4%;
    max-width: 96vw;
  }
  #search-container #books-suggest {
    width: 100%;
  }
  #chapter-footer-nav {
    font-size: 0.88em;
    min-height: 28px;
    padding: 0.5% 1% 1% 1%;
    gap: 2%;
  }
  #verse-results {
    width: 100%;
    padding: 0 2% 12% 2%;
  }
  #app {
    padding: 4% 2%;
  }
}

.book-header {
  position: relative;
  z-index: 1001; /* Changed z-index to a value higher than other elements */
}

.testament-section {
  width: 100%;
  margin-bottom: 2em;
}

.testament-title {
  color: #00ff00;
  text-align: center;
  margin: 0.5em 0 0.75em 0;
  font-size: 1.75em; /* 25% larger than 1.4em */
  font-weight: 500;
  text-transform: uppercase;
}

.books-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 0;
  margin: 10px 0;
  justify-content: center;
}

.book-grid-item {
  background: #000000;
  border-radius: 12px;
  padding: 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  transition: all 1s ease;
  border: 2px solid white;
  text-align: center;
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: calc((100% - 40px) / 3);
  max-width: calc((100% - 40px) / 3);
}

.book-grid-item:hover {
  background: #2d3245;
  border-color: #00ff00;
  transform: translateY(-2px);
}

.book-grid-item .material-icons {
  color: #00ff00;
  font-size: 2.2em;
}

.book-grid-item .book-name {
  color: #e0e9fa;
  font-size: 1.38em; /* 25% larger than 1.1em */
  font-weight: 500;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  min-width: 0;
  text-overflow: ellipsis;
}

@media (min-width: 769px) {
  #app {
    padding: 1% 2%;
  }

  #verse-results {
    padding: 0 3% 6% 3%;
  }
}

.footer-section.middle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
}