.reading-page {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100dvh;
    font-family: var(--font-family);
    overflow: hidden;
}

.reading-main {
    overflow: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.reading-aside {
    grid-column: 1;
    height: 100%;
    padding: 1.5rem;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.reading-aside::-webkit-scrollbar {
    width: 6px;
}

.reading-aside::-webkit-scrollbar-track {
    background: transparent;
}

.reading-aside::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.reading-aside-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.reading-aside-header .brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.025em;
}

.reading-header {
	position: sticky;
    top: 0;
    z-index: 100;
	background-image: var(--bg-nav);
}

.book-selector {
	position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.5rem 2rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.book-name-container h6 {
	width: 200px;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.025em;
}

#chapter-select {
	width: 150px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#chapter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#chapter-reader {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    background: var(--bg-color);
    max-width: var(--maxContainerWidth);
    margin: 0 auto;
    width: 100%;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#chapter-reader::-webkit-scrollbar {
    width: 8px;
}

#chapter-reader::-webkit-scrollbar-track {
    background: transparent;
}

#chapter-reader::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#chapter-reader::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.chapter-content {
	width: 100%;
    max-width: calc(var(--maxContainerWidth) - 10rem);
    margin: auto;
	padding-bottom: 6rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.chapter-content.loaded {
    opacity: 1;
}

.chapter-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 2rem 0;
    text-align: center;
    padding-bottom: 1rem;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verse {
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 1.1rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInVerse 0.4s ease forwards;
}

.verse:nth-child(n) {
    animation-delay: calc(var(--verse-index, 0) * 0.05s);
}

@keyframes fadeInVerse {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verse-number {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 0.9em;
}

.reading-main::before {
    content: '';
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 100px;
    background: linear-gradient(
        to bottom,
        var(--bg-primary) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-main.scrolled::before {
    opacity: 1;
}

.reading-main::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    height: 50px;
    background: linear-gradient(
        to top,
        var(--bg-primary) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 50;
}

#release-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#release-list li {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-primary);
}

#release-list li:hover,
#release-list li.active {
    background: var(--bg-hover);
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.chapter-navigation {
	display: flex;
    justify-content: space-between;
    z-index: 100;
    width: 100%;
    max-width: var(--maxContainerWidth);
    margin: 0 auto;
}

.nav-btn {
	display: flex;
	align-items: center;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 50px;
	cursor: pointer;
	transition: all 0.2s ease;
	width: 50px;
	height: 50px;
	justify-content: center;
}

.nav-btn svg {
	fill: var(--text-primary);
    height: 30px;
    width: 30px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
}

.nav-btn-prev {
    flex-direction: row;
}

.nav-btn-next {
    flex-direction: row-reverse;
}

.nav-icon {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
}

.nav-text {
    font-weight: 500;
}

/* Mobile/Desktop visibility helpers */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* Mobile Book Selector Button */
.mobile-book-selector {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.mobile-book-selector:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.mobile-book-selector .dropdown-icon {
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.mobile-book-selector.active .dropdown-icon {
    transform: rotate(180deg);
}

/* Mobile Book Popup */
.mobile-book-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.mobile-book-popup.active {
    display: flex;
}

.mobile-book-popup-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mobile-book-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-book-popup-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-popup-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.close-popup-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-book-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.mobile-book-item {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.mobile-book-item:last-child {
    border-bottom: none;
}

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

.mobile-book-item.active {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 768px) {
    .reading-page {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .reading-aside {
        display: none; /* Hide sidebar on mobile */
    }

    .reading-main {
        grid-column: 1;
        grid-row: 1;
    }

    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none;
    }

    .reading-main::before {
        left: 0;
    }

    .reading-main::after {
        left: 0;
    }

    .book-selector {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .mobile-book-selector {
        display: block;
        min-width: 0;
        border: none;
        padding: 0;
        background: transparent;
    }

    #chapter-select {
        min-width: 0;
        width: fit-content;
        border: none;
        background: transparent;
    }

    #chapter-reader {
        padding: 1rem;
    }

    .chapter-navigation {
        padding: 0.75rem 1rem;
        gap: 1rem;
        top: 90% !important;
    }

    .nav-btn {
        width: 45px;
        height: 45px;
    }

    .nav-btn svg {
        height: 24px;
        width: 24px;
    }

    #chapter-reader .verse {
        font-size: 1.2rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
        gap: .25rem;
    }

    .chapter-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .chapter-content {
        max-width: none;
        padding-bottom: 4rem;
    }
}

/* Note Icon Styles */
.note-icon {
    display: inline-block;
    margin-left: var(--space-xs);
    font-size: 0.9em;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    vertical-align: super;
    line-height: 1;
}

.note-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Note Dialog Styles (from simple-editor.js) */
.note-dialog-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: 10000;
}

.note-dialog {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: noteDialogFadeIn 0.2s ease-out;
}

@keyframes noteDialogFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.note-dialog h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.note-dialog textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--bg-color);
    color: var(--text-primary);
}

.note-dialog textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.note-dialog-buttons {
    margin-top: 16px;
    text-align: right;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.note-dialog-button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.note-dialog-button.cancel {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.note-dialog-button.cancel:hover {
    background: var(--border-color);
}

.note-dialog-button.save {
    background: var(--primary-color);
    color: white;
}

.note-dialog-button.save:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

.note-dialog-button.delete {
    background: #dc3545;
    color: white;
}

.note-dialog-button.delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Text with Note Highlighting */
.text-with-note {
    background-color: #fff3cd;
    border-bottom: 2px dotted var(--primary-color);
    cursor: help;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.text-with-note:hover {
    background-color: #ffeaa7;
    border-bottom-color: #e55a2b;
}

/* Note Display Styles */
.note-display {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-hover);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-display:hover {
    background: var(--border-color);
    transform: translateX(2px);
}

/* Save Button States */
.toolbar-button.dirty {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Verse Highlighting for Navigation */
.verse.highlighted {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    padding: var(--space-sm);
    margin: var(--space-xs) 0;
}

/* Note Form Styles */
.note-form-container {
    display: none;
    margin-top: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.note-form-container.visible {
    display: block;
}

/* Note Indicator */
.note-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    margin-left: var(--space-xs);
}

.note-indicator.visible {
    display: inline-flex;
}

/* Editor Container Display States */
.chapter-editor-container {
    display: none;
}

.chapter-editor-container.visible {
    display: block;
}

.content-container.hidden {
    display: none;
}

.content-container.visible {
    display: block;
}

/* Edit Name Button */
.edit-name-btn {
    display: none;
}

.edit-name-btn.visible {
    display: inline-block;
}