/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet and smaller screens */
@media (max-width: 768px) {
  /* =========================
     Header & Navigation
     ========================= */
  .nav-arrow {
    font-size: 1.4rem;
    padding: 0.1rem 0.4rem;
  }
  .navigation-controls {
    gap: 0.2rem;
  }
  .book-select-button,
  .navigation-controls select {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }
  .header-content {
    grid-template-columns: 1fr auto;
    row-gap: 0.35rem;
  }
  .chapter-nav {
    grid-column: 1 / 2;
    justify-self: start;
  }
  .header-utilities {
    grid-column: 2 / 3;
    justify-self: end;
    gap: 0.25rem;
  }
  #book-select-btn {
    max-width: 140px;
  }
  #language-select-btn {
    max-width: 120px;
  }
  .navigation-controls select {
    padding-right: 1.8em;
  }
  header.shrunk .book-select-button,
  header.shrunk .navigation-controls select {
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
  }
  header.shrunk .nav-arrow {
    font-size: 1.5rem;
  }
  /* =========================
     Bible Text
     ========================= */
  .bible-text {
    /* Note: This only affects the bible text container, not the font-family */
    font-size: 1.1rem;
    padding: 0 0.75rem;
  }
  .verse {
    padding-left: 1.75rem;
  }
  .verse-icon {
    width: 2.1rem;
    height: 2.1rem;
    min-width: 2.1rem;
    min-height: 2.1rem;
    font-size: 0.94em;
  }
  .word-study-word {
    min-width: 68px;
    padding: 0.15rem 0.3rem;
  }
  .word-study-line {
    font-size: 0.66rem;
  }
  .word-study-tooltip {
    min-width: min(200px, calc(100vw - 16px));
    max-width: min(280px, calc(100vw - 16px));
  }
  /* =========================
     Modals (General)
     ========================= */
  .modal-content {
    width: 95%;
    margin: 6% auto;
    max-height: 90vh;
  }
  .auth-modal-content {
    margin: 14% auto;
    padding: 1rem 0.9rem 1.1rem;
  }
  #modal-title {
    font-size: 1.1rem;
  }
  /* Allow tabs to scroll horizontally if they don't fit */
  #modal-tabs,
  .explanation-sub-tabs,
  .reference-tabs {
    flex-wrap: wrap; /* Allow tabs to wrap to the next line */
    justify-content: center; /* Center the wrapped tabs */
  }

  /* Reduce padding on all tab buttons for more space on mobile */
  .tab-btn,
  .explanation-sub-tab,
  .reference-tab {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .tab-btn {
    font-size: 0.9rem;
    padding: 0.7rem 0.5rem;
    flex-shrink: 0;
    border-bottom: 3px solid transparent; /* Keep original border style */
  }
  .tab-btn.active {
    border-bottom-color: #3a5a8a; /* Keep original active style */
  }
  #modal-body {
    padding: 1rem;
    font-size: 0.95rem;
  }
  /* =========================
     Book Selection Modal
     ========================= */
  .book-modal-content {
    max-width: 95%;
  }
  #book-modal-title {
    font-size: 1.1rem;
  }
  .book-grid {
    grid-template-columns: 1fr; /* Single column for testaments */
    min-width: 0; /* Fix flexbox bug that can cause overflow */
  }
  .book-group ul {
    /* Use a single column for book names on most mobile devices */
    columns: 1; /* Override desktop two-column layout */
  }
}

@media (max-width: 480px) {
  /* On very small screens, make book list single column */
  /* .book-group ul is already set to 1 column in the @media (max-width: 768px) query */
  .navigation-controls {
    gap: 0.25rem;
  }
  .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
  }
  .chapter-nav {
    width: 100%;
    justify-content: center;
  }
  .header-utilities {
    width: 100%;
    justify-content: center;
  }
  .header-content {
    /* Give more vertical space if wrapping occurs */
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  .auth-modal-content {
    margin: 20% auto;
  }
  .chapter-nav {
    /* Allow the arrows and buttons to wrap on the smallest screens */
    flex-wrap: wrap;
    justify-content: center;
  }
  #book-select-btn {
    max-width: 120px;
  }
  #language-select-btn {
    max-width: 170px;
  }
  .verse-icon {
    width: 2.05rem;
    height: 2.05rem;
    min-width: 2.05rem;
    min-height: 2.05rem;
    font-size: 0.92em;
  }
  .word-study-word {
    min-width: 58px;
  }
  .word-study-original-label {
    font-size: 0.82rem;
  }
  .word-study-line {
    font-size: 0.6rem;
  }
  .word-study-card {
    padding: 0.55rem 0.6rem 0.65rem;
  }
  .word-study-lemma-script {
    font-size: 0.92rem;
  }
  .word-study-section-body {
    font-size: 0.68rem;
  }
}
