/* Bible Reader Styles - Nature Green Theme */

:root {
    --nature-green: #cadea3;
    --nature-green-light: #e6edc6;
    --nature-green-dark: #589735;
    --nature-bg: #f1f8e9;
    --nature-text: #33691e;
    --nature-border: #c5e1a5;
    --nature-yellow-light: #fff9c4;
    --white: #ffffff;
    --gray-light: #f5f5f5;
    --gray: #9e9e9e;
}


/* Ensure border-box sizing for bible reader */
.bible-reader,
.bible-reader * {
    box-sizing: border-box;
}

.bible-reader {
    display: flex;
    background: var(--nature-bg);
    border-radius: 8px;
    /*overflow: visible;*/
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /*margin-top: -100px;*/
    transition: height 0.3s ease;
    position: relative;
}

.bible-reader.reading-mode {
    height: calc(100vh - 100px);
    margin-top: -150px;
}

/* Sidebar Navigation */
.bible-sidebar {
    width: 280px;
    background: var(--white);
    border-right: 2px solid var(--nature-border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.bible-sidebar.collapsed {
    display: none;
    width: 0;
    opacity: 0;
    overflow: hidden;
    border: none;
}

.bible-sidebar-header {
    padding: 20px;
    background: var(--nature-green);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.bible-sidebar-header h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.translation-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    background: var(--white);
    color: var(--nature-text);
    font-size: 14px;
}

.book-list {
    padding: 15px;
}

.book-item {
    padding: 10px 12px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--nature-text);
}

.book-item:hover {
    background: var(--nature-bg);
}

.book-item.active {
    background: var(--nature-green-light);
    color: var(--nature-green-dark);
    font-weight: 600;
}

.book-name {
    flex: 1;
}

.book-num {
    font-size: 12px;
    color: var(--gray);
}

/* Scripture View Layout */
.scripture-view {
    /*flex: 1 1 auto;*/
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    width: 100%;
}

.scripture-content {
    /*flex: 1 1 auto;*/
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 30px;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
}

/* Chapter Navigation Bar */
.chapter-nav-bar {
    padding: 15px 30px;
    background: var(--gray-light);
    border-bottom: 2px solid var(--nature-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    flex-shrink: 0;
}

.scripture-info-inline {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex: 1;
}

.scripture-title-inline {
    font-size: 20px;
    font-weight: 700;
    color: var(--nature-green-dark);
    margin: 0;
}

.scripture-meta-inline {
    font-size: 14px;
    color: var(--gray);
}

.chapter-nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chapter-btn {
    padding: 8px 16px;
    border: 1px solid var(--nature-border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    font-weight: bold;
    color: var(--nature-green);
}

.chapter-btn:hover:not(:disabled) {
    background: var(--nature-green-light);
    border-color: var(--nature-green);
}

.chapter-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    color: var(--gray);
}

.chapter-select {
    padding: 8px 16px;
    border: 2px solid var(--nature-border);
    border-radius: 4px;
    background: var(--white);
    font-size: 16px;
    font-weight: 600;
    color: var(--nature-green-dark);
    min-width: 80px;
    text-align: center;
}

.chapter-select:focus {
    outline: none;
    border-color: var(--nature-green);
}

.chapter-grid-btn {
    padding: 8px 16px;
    border: 1px solid var(--nature-border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 20px;
    color: var(--nature-green);
}

.chapter-grid-btn:hover {
    background: var(--nature-green-light);
    border-color: var(--nature-green);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid var(--nature-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-light);
}

.modal-header h3 {
    margin: 0;
    color: var(--nature-green-dark);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--nature-green-dark);
}

/* Chapter Grid Modal */
.chapter-grid-modal {
    width: 600px;
}

.chapter-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.chapter-grid-item {
    aspect-ratio: 1;
    min-height: 60px;
    border: 2px solid var(--nature-border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    color: var(--nature-text);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-grid-item:hover {
    background: var(--nature-bg);
    border-color: var(--nature-green);
    transform: scale(1.05);
}

.chapter-grid-item.active {
    background: var(--nature-green);
    color: var(--white);
    border-color: var(--nature-green-dark);
}

/* Main Content Area */
.bible-content {
    display: flex;
    flex-direction: column;
    flex: 1;

    min-height: 0;      /* ✅ critical */
    overflow: hidden;   /* ✅ allowed now */
}

/* Search Panel */
.search-panel {
    padding: 20px;
    background: var(--white);
    border-bottom: 2px solid var(--nature-border);
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    max-height: 100px;
    overflow: hidden;
    width: 100%;
    flex-shrink: 0;
}

.search-panel.collapsed {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
}

.search-input-group {
    display: flex;
    gap: 10px;
    max-width: 600px;
}

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 20px 0;
    background: var(--white);
    border-bottom: 2px solid var(--nature-border);
    width: 100%;
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 20px;
    background: var(--gray-light);
    border: 1px solid var(--nature-border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--nature-text);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--nature-bg);
}

.tab-btn.active {
    background: var(--white);
    color: var(--nature-green-dark);
    border-color: var(--nature-border);
    border-bottom: 2px solid var(--white);
    margin-bottom: -2px;
    font-weight: 600;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--nature-border);
    border-radius: 4px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--nature-green);
}

.search-btn {
    padding: 10px 24px;
    background: var(--nature-green);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.search-btn:hover {
    background: var(--nature-green-dark);
}

.search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.clear-search-btn {
    padding: 10px 20px;
    background: var(--gray-light);
    color: var(--nature-text);
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    cursor: pointer;
}

.verse {
    margin-bottom: 15px;
    line-height: 1.8;
    font-size: 16px;
    color: var(--nature-text);
    padding-left: 10px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.verse.highlighted {
    background: rgba(174, 213, 129, 0.15);
    border-left-color: var(--nature-green);
    padding-left: 15px;
    margin-left: -5px;
}

.verse-num {
    display: inline-block;
    min-width: 35px;
    font-weight: 700;
    color: var(--nature-green);
    font-size: 14px;
    vertical-align: super;
    margin-right: 5px;
}

.verse-text {
    display: inline;
}

/* Special text formatting */
.verse-title {
    display: block;
    font-weight: 600;
    font-style: italic;
    color: var(--nature-green-dark);
    margin-bottom: 8px;
    font-size: 15px;
}

.verse-comment {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    color: var(--nature-green);
    background: var(--nature-bg);
    border: 1px solid var(--nature-green-light);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 18px;
    cursor: help;
    margin: 0 3px;
    vertical-align: baseline;
    position: relative;
}

.verse-comment:hover {
    background: var(--nature-green-light);
    color: var(--nature-green-dark);
    border-color: var(--nature-green);
}

.cross-ref {
    color: var(--nature-green);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px dotted var(--nature-green);
    cursor: pointer !important;
    margin: 0 2px;
    transition: all 0.2s;
    display: inline-block;
    padding: 1px 3px;
}

.cross-ref:hover {
    color: var(--nature-green-dark);
    border-bottom-style: solid;
    background: var(--nature-bg);
    border-radius: 3px;
    text-decoration: none;
}

/* Search Results */
.search-results {
    padding: 20px 40px;
    background: var(--white);
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.search-result-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--nature-border);
}

.search-result-count {
    font-size: 14px;
    color: var(--gray);
}

.search-result-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--nature-bg);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: var(--nature-green-light);
}

.search-result-ref {
    font-weight: 600;
    color: var(--nature-green-dark);
    margin-bottom: 5px;
}

.search-result-text {
    line-height: 1.6;
    color: var(--nature-text);
}

.search-result-text mark {
    background: var(--nature-green-light);
    padding: 2px 4px;
    border-radius: 2px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--nature-border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--nature-green-light);
}

.pagination-btn.active {
    background: var(--nature-green);
    color: var(--white);
    border-color: var(--nature-green);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Verse Actions */
.verse-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.verse-actions {
    opacity: 0;
    transition: opacity 0.2s;
    position: relative;
}

.verse-container:hover .verse-actions {
    opacity: 1;
}

.verse-actions-btn {
    background: var(--nature-green-light);
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 5px;
    line-height: 1;
    transition: all 0.2s;
}

.verse-actions-btn:hover {
    color: var(--nature-green);
    background: var(--nature-green-dark);
    border-radius: 3px;
}

.verse-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 180px;
    margin-top: 2px;
}

.verse-actions-menu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--nature-text);
    transition: all 0.2s;
    font-size: 14px;
}

.verse-actions-menu button:hover {
    background: var(--nature-bg);
}

.verse-actions-menu button:not(:last-child) {
    border-bottom: 1px solid var(--nature-border);
}

.verse.marked {
    background: rgba(174, 213, 129, 0.2);
}

/* Multi-Language Comparison Styles */
.compare-controls {
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 2px solid var(--nature-border);
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    width: 100%;
    flex-shrink: 0;
    max-height: 250px;
    overflow: hidden;
}

.compare-controls.collapsed {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
}

.compare-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.compare-control-label {
    font-weight: 600;
    color: var(--nature-text);
    font-size: 14px;
}

.compare-select {
    padding: 6px 12px;
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    background: var(--white);
    font-size: 14px;
    min-width: 150px;
    min-block-size: 70px;
}

.compare-mode-toggle {
    display: flex;
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    overflow: hidden;
}

.compare-mode-btn {
    padding: 6px 16px;
    background: var(--white);
    border: none;
    border-right: 1px solid var(--nature-border);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--nature-text);
}

.compare-mode-btn:last-child {
    border-right: none;
}

.compare-mode-btn:hover {
    background: var(--nature-bg);
}

.compare-mode-btn.active {
    background: var(--nature-green);
    color: var(--white);
    font-weight: 600;
}

.translation-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--nature-green-light);
    color: var(--nature-green-dark);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
}

/* Side-by-side table view */
.verse-compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.verse-compare-table th {
    background: var(--nature-green-light);
    color: var(--nature-green-dark);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--nature-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.verse-compare-table td {
    padding: 15px;
    border: 1px solid var(--nature-border);
    vertical-align: top;
    line-height: 1.8;
}

.verse-compare-table tr:nth-child(even) {
    background: var(--gray-light);
}

.verse-compare-table tr:hover {
    background: var(--nature-bg);
}

.verse-compare-table .verse-num-col {
    width: 50px;
    text-align: center;
    font-weight: 700;
    color: var(--nature-green);
    background: var(--nature-bg);
}

/* Sequential (stacked) view */
.verse-sequential {
    margin-bottom: 25px;
    padding: 15px;
    background: var(--white);
    border-radius: 8px;
    border-left: 3px solid var(--nature-green);
}

.verse-sequential-num {
    display: inline-block;
    min-width: 40px;
    font-weight: 700;
    color: var(--nature-green);
    font-size: 16px;
    margin-bottom: 10px;
}

.verse-sequential-translation {
    margin-bottom: 15px;
    padding: 12px;
    background: var(--nature-bg);
    border-radius: 4px;
    border-left: 2px solid var(--nature-green-light);
}

.verse-sequential-translation:last-child {
    margin-bottom: 0;
}

.verse-sequential-header {
    font-weight: 600;
    color: var(--nature-green-dark);
    font-size: 13px;
    margin-bottom: 6px;
}

.verse-sequential-text {
    line-height: 1.8;
    color: var(--nature-text);
}

/* View Controls Toolbar */
.view-controls-toolbar {
    padding: 8px 15px;
    background: var(--nature-green-light);
    border-bottom: 2px solid var(--nature-green);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0; /* must not shrink — toolbar has fixed height */
}

.quick-nav-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    max-width: 400px;
    min-width: 200px;
}

.quick-nav-label {
    font-weight: 600;
    color: var(--nature-green-dark);
    font-size: 13px;
    white-space: nowrap;
}

.quick-nav-select {
    flex: 1 1 auto;
    min-width: 150px;
    max-width: 100%;
}

.select2-container--default .select2-selection--single {
    height: 32px !important;
    border-color: var(--nature-border) !important;
    border-radius: 4px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    padding-left: 10px !important;
    color: var(--nature-text) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 30px !important;
}

.select2-dropdown {
    border-color: var(--nature-border) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--nature-green-light) !important;
    color: var(--nature-green-dark) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--nature-green) !important;
    color: var(--white) !important;
}

.view-controls-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.view-control-btn {
    padding: 6px 12px;
    background: var(--white);
    border: 1px solid var(--nature-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--nature-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-control-btn:hover {
    background: var(--nature-bg);
    border-color: var(--nature-green);
}

.view-control-btn.active {
    background: var(--nature-green);
    color: var(--white);
    font-weight: 600;
    border-color: var(--nature-green-dark);
}

.view-control-btn i {
    font-size: 14px;
}

.view-controls-divider {
    width: 1px;
    height: 20px;
    background: var(--nature-border);
    margin: 0 5px;
}

.reading-mode-label {
    font-size: 12px;
    color: var(--nature-green-dark);
    font-weight: 600;
    margin-right: 5px;
}

.sidebar-toggle-btn {
    position: absolute;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: var(--nature-green);
    color: var(--white);
    border: 2px solid var(--nature-green-dark);
    border-radius: 0 8px 8px 0;
    border-left: none;
    padding: 12px 8px;
    cursor: pointer;
    transition: left 0.3s ease, background 0.2s ease;
    box-shadow: var(--shadow-md);
    flex: none; /* Don't participate in flex layout */
    width: auto;
    height: auto;
}

/* media screen small */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        left: 0;
    }
}

.sidebar-toggle-btn:hover {
    background: var(--nature-green-dark);
    padding-right: 14px;
}

.sidebar-toggle-btn:not(.sidebar-visible) {
    left: 0;
}

.view-tabs {
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.view-tabs.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

/* Notepad */
.notepad-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 30px 40px;
    background: var(--white);
    min-height: 0;
}

.notepad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--nature-border);
}

.notepad-actions {
    display: flex;
    gap: 10px;
}

.notepad-btn {
    padding: 8px 16px;
    background: var(--nature-green);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.notepad-btn:hover {
    background: var(--nature-green-dark);
}

.notepad-btn.secondary {
    background: var(--gray-light);
    color: var(--nature-text);
}

.notepad-btn.secondary:hover {
    background: var(--gray);
}

.notepad-verse {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--nature-bg);
    border-left: 3px solid var(--nature-green);
    border-radius: 4px;
    position: relative;
}

.notepad-verse-ref {
    font-weight: 600;
    color: var(--nature-green-dark);
    margin-bottom: 5px;
}

.notepad-verse-text {
    line-height: 1.6;
    color: var(--nature-text);
}

.notepad-verse-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
}

.notepad-verse-remove:hover {
    color: #d32f2f;
}

.marked-verses-bar {
    padding: 10px 20px;
    background: var(--nature-bg);
    border-bottom: 1px solid var(--nature-border);
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
    align-items: center;
}

.marked-verses-info {
    color: var(--nature-text);
    font-size: 14px;
}

.marked-verses-actions {
    display: flex;
    gap: 10px;
}

.marked-verses-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .bible-reader {
        flex-direction: column;
        height: auto;
    }

    .bible-sidebar {
        width: 100%;
        max-height: 300px;
    }

    .chapter-nav-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }

    .scripture-info-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        width: 100%;
    }

    .chapter-nav-controls {
        width: 100%;
        justify-content: center;
    }

    .scripture-content {
        padding: 20px;
    }

    .notepad-container {
        padding: 20px;
    }

    .chapter-grid-modal {
        width: 90%;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 8px;
        padding: 20px;
    }

    .chapter-grid-item {
        min-height: 50px;
        font-size: 16px;
    }
}

.scripture-view {
    flex: 1 1 auto;
}

/* ===== FIX SCROLL LAYOUT ===== */

html, body {
    height: 100%;
}

/* Root container — offset 95px = #main padding-top (56px navbar + 32px space-xl) + container padding-top (7px) */
.bible-reader {
    display: flex;
    height: calc(100vh - 95px);
    overflow: hidden;
}

/* Sidebar stays fixed */
.bible-sidebar {
    flex: 0 0 280px;
    overflow-y: auto;
}
.bible-content {
    display: flex;
    flex-direction: column;
    flex: 1;

    min-height: 0;      /* ✅ critical */
    overflow: hidden;   /* ✅ allowed now */
}

.scripture-view {
    display: flex;
    flex-direction: column;
    flex: 1;

    min-height: 0;      /* ✅ critical */
    overflow: hidden;   /* ✅ allowed now */
}

.scripture-content {
    flex: 1;
    min-height: 0;

    overflow-y: auto;   /* ✅ ONLY place scroll should exist */
}
/* Also ensure other views scroll */
.search-results,
.notepad-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}


/*#main.flex-shrink-0 {*/
/*    flex-shrink: 1;   !* ✅ allow shrinking *!*/
/*    min-height: 0;    !* ✅ critical *!*/
/*}*/

/*#bible-app {*/
/*    display: flex;*/
/*    flex-direction: column;*/
/*    min-height: 0;*/
/*    flex: 1;*/
/*}*/

/* Compact navigation is separate from the desktop study toolbar. */
.bible-mobile-navigation,
.mobile-compare-options {
    display: none;
}

/* Keep this after the desktop scrolling rules so phones use page scrolling. */
@media (max-width: 768px) {
    .bible-reader,
    .bible-reader.reading-mode {
        display: block;
        height: auto;
        min-height: 60vh;
        margin-top: 0;
        overflow: visible;
    }

    .bible-reader .bible-sidebar,
    .bible-reader .sidebar-toggle-btn,
    .bible-reader .view-controls-right,
    .bible-reader .desktop-compare-select,
    .bible-reader .desktop-compare-hint,
    .bible-reader .desktop-compare-display,
    .bible-reader .desktop-book-indent {
        display: none;
    }

    .bible-reader .bible-content,
    .bible-reader .scripture-view,
    .bible-reader .scripture-content,
    .bible-reader .search-results,
    .bible-reader .notepad-container {
        flex: none;
        height: auto;
        min-width: 0;
        overflow: visible;
    }

    .bible-mobile-navigation {
        display: grid;
        gap: 12px;
        padding: 16px;
        background: var(--white);
        border-bottom: 1px solid var(--nature-border);
        border-radius: 8px 8px 0 0;
    }

    .bible-mobile-navigation label {
        display: grid;
        gap: 4px;
        min-width: 0;
        font-size: 13px;
        font-weight: 600;
    }

    .bible-mobile-actions {
        display: flex;
        gap: 8px;
    }

    .bible-mobile-actions button {
        flex: 1;
        justify-content: center;
    }

    .bible-reader button,
    .bible-reader select,
    .bible-reader input[type="text"] {
        min-height: 44px;
        font-size: 16px;
    }

    .bible-reader .translation-select {
        min-width: 0;
        max-width: 100%;
    }

    .bible-reader .view-controls-toolbar {
        display: none;
        padding: 12px 16px;
    }

    .bible-reader .view-controls-toolbar.mobile-tools-open {
        display: flex;
    }

    .bible-reader .quick-nav-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .bible-reader .quick-nav-container .select2-container {
        width: 100% !important;
        min-width: 0;
    }

    .bible-reader .compare-controls,
    .bible-reader .search-panel {
        max-height: none;
        padding: 12px 16px;
    }

    .bible-reader .compare-controls.collapsed,
    .bible-reader .search-panel.collapsed {
        display: none;
    }

    .bible-reader .compare-control-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .mobile-compare-options {
        display: grid;
        gap: 4px;
    }

    .mobile-compare-options label {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 44px;
    }

    .mobile-compare-options input {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .bible-reader .search-input-group {
        flex-wrap: wrap;
    }

    .bible-reader .search-input {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }

    .bible-reader .search-btn,
    .bible-reader .clear-search-btn {
        flex: 1;
    }

    .bible-reader .view-tabs {
        flex-wrap: wrap;
        padding: 4px 8px;
    }

    .bible-reader .chapter-nav-bar {
        gap: 12px;
        padding: 16px;
    }

    .bible-reader .chapter-nav-controls {
        display: grid;
        grid-template-columns: 44px minmax(64px, 1fr) 44px 44px;
        gap: 8px;
    }

    .bible-reader .chapter-btn,
    .bible-reader .chapter-grid-btn {
        padding: 8px;
    }

    .bible-reader .scripture-content,
    .bible-reader .search-results,
    .bible-reader .notepad-container {
        padding: 16px;
        overflow-wrap: anywhere;
    }

    .bible-reader .verse {
        flex: 1;
        min-width: 0;
        font-size: 18px;
        line-height: 1.8;
        padding: 8px 0;
    }

    .bible-reader .verse-container {
        gap: 4px;
    }

    .bible-reader .verse-actions {
        opacity: 1;
        flex: 0 0 44px;
    }

    .bible-reader .verse-actions-btn {
        width: 44px;
        color: var(--nature-green-dark);
        border-radius: 6px;
    }

    .bible-reader .verse-actions-menu {
        max-width: calc(100vw - 64px);
    }

    .bible-reader .verse-sequential,
    .bible-reader .verse-sequential-translation {
        padding: 12px;
    }

    .bible-reader .notepad-header,
    .bible-reader .marked-verses-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .bible-reader .notepad-actions,
    .bible-reader .marked-verses-actions,
    .bible-reader .pagination {
        flex-wrap: wrap;
        gap: 6px;
    }

    .bible-reader .chapter-grid-modal {
        width: calc(100% - 24px);
        max-height: calc(100dvh - 24px);
    }

    .bible-reader .chapter-grid {
        min-height: 0;
        overflow-y: auto;
        padding: 12px;
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }

    .bible-reader .modal-header {
        padding: 12px;
    }
}
