/* ==============================================
   BOOK VIEW DISPLAY PAGE STYLES
   Page: /books/view/{BookName}
   ============================================== */

/* ==============================================
   LOADING & ERROR STATES
   ============================================== */
.book-view-loading,
.book-view-error {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 7rem 2rem 3rem 2rem;
    background: var(--bg-color, #f8f9fa);
}

.book-view-loading-spinner {
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
    border: 5px solid rgba(0, 180, 255, 0.2);
    border-top-color: var(--primary-color, #00b4ff);
    border-radius: 50%;
    animation: bookViewSpin 0.8s linear infinite;
}

@keyframes bookViewSpin {
    to { transform: rotate(360deg); }
}

.book-view-loading-text {
    margin: 0;
    color: #64748b;
    font-size: 1rem;
}

.book-view-error-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    color: #ef4444;
    font-size: 3rem;
}

.book-view-error-title {
    margin: 0 0 1rem 0;
    color: #0f172a;
    font-weight: 900;
    font-size: 2rem;
}

.book-view-error-text {
    margin: 0 0 2rem 0;
    color: #64748b;
    font-size: 1.1rem;
    text-align: center;
}

.book-view-error-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--primary-color, #00b4ff);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-view-error-button:hover {
    background: var(--secondary-color, #0174B1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 180, 255, 0.3);
}

/* ==============================================
   PAGE LAYOUT
   ============================================== */
.book-view-page {
    min-height: 100vh;
    background: var(--bg-color, #f8f9fa);
}

/* ==============================================
   HERO SECTION - Matching /book page
   ============================================== */
.book-view-hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    padding: 8rem 2rem 3rem 2rem;
    overflow: hidden;
}

.book-view-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: none;
    transform: scale(1.02);
    z-index: 0;
}

.book-view-hero-background.use-blur {
    filter: blur(30px) saturate(1.3);
    transform: scale(1.08);
    animation: heroZoomSlow 14s ease-in-out both;
}

@keyframes heroZoomSlow {
    0% { transform: scale(1.06); }
    100% { transform: scale(1.10); }
}

.book-view-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        rgba(0, 0, 0, 0.35) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.1) 100%);
    z-index: 1;
}

.book-view-hero-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 2;
}

.book-view-hero-content {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: center;
}

.book-view-hero-cover {
    position: relative;
}

.book-view-cover-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.book-view-hero-details {
    color: white;
}

.book-view-title {
    margin: 0 0 0.5rem 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.15;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Author Section with Follow Button */
.book-view-author-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.book-view-author {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    opacity: 0.95;
}

.book-view-author-link {
    color: white;
    text-decoration: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    padding-bottom: 2px;
}

.book-view-author-link:hover {
    border-bottom-color: white;
}

/* Follow Author Button */
.book-view-follow-author-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.book-view-follow-author-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.book-view-follow-author-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.book-view-follow-author-btn.following {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #22c55e;
}

.book-view-follow-author-btn.following:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.7);
}

.book-view-description {
    margin: 0 0 1.25rem 0;
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 600px;
}

/* Stats Row */
.book-view-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.book-view-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
}

.book-view-stat i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.book-view-stat i.bi-people-fill {
    color: #60a5fa !important;
}

.book-view-stat i.bi-journal-text {
    color: #a78bfa !important;
}

.book-view-stat i.bi-headphones {
    color: #34d399 !important;
}

.book-view-stat i.bi-check-circle {
    color: #22c55e !important;
}

/* ==============================================
   HERO ACTION BUTTONS
   ============================================== */
.book-view-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.book-view-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-view-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.book-view-action-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.book-view-action-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.book-view-action-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.book-view-action-outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: translateY(-2px);
}

.book-view-action-following {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 2px solid rgba(34, 197, 94, 0.5);
}

.book-view-action-following:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.7);
}

/* ==============================================
   TAB NAVIGATION
   ============================================== */
.book-view-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary, white);
    border-bottom: 1px solid var(--border-color, #e9ecef);
    position: relative;
    z-index: 100;
}

.book-view-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-view-tab-btn:hover {
    background: var(--bg-hover, #f0f0f0);
}

.book-view-tab-btn.active {
    background: #00b4ff;
    color: white;
}

/* ==============================================
   CONTENT AREA
   ============================================== */
.book-view-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    /* Don't use overflow-x: hidden here - it breaks position: sticky for children */
}

/* ==============================================
   CHAPTER NAVIGATION
   ============================================== */
.book-view-chapter-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary, white);
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 85px;
    z-index: 99;
    width: 100%; /* Ensure it doesn't exceed container */
    box-sizing: border-box; /* Include padding in width calculation */
}

.book-view-nav-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-tertiary, #f5f5f5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary, #333);
}

.book-view-nav-btn:hover:not(:disabled) {
    background: #00b4ff;
    color: white;
}

.book-view-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.book-view-chapter-select {
    flex: 1;
    max-width: 400px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-secondary, white);
    color: var(--text-primary, #333);
}

/* ==============================================
   CHAPTER CONTENT
   ============================================== */
.book-view-chapter-content {
    background: var(--bg-secondary, white);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.book-view-chapter-cover {
    text-align: center;
    padding: 2rem;
}

.book-view-chapter-cover img {
    max-width: 300px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.book-view-toc h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary, #333);
    font-weight: 800;
}

.book-view-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.book-view-toc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.book-view-toc-item:hover {
    background: var(--bg-hover, #f5f5f5);
}

.book-view-toc-number {
    width: 40px;
    height: 40px;
    background: #00b4ff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.book-view-toc-title {
    font-size: 1.1rem;
    color: var(--text-primary, #333);
    font-weight: 500;
}

.book-view-chapter-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary, #333);
    font-size: 1.75rem;
    font-weight: 800;
}

.book-view-section-content {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-primary, #333);
}

.book-view-section-content p {
    margin-bottom: 1.5rem;
}

/* Section Image Styling - constrained to viewport */
.book-view-section-image-container {
    width: 100%;
    max-height: 75vh;
    max-height: 75dvh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

.book-view-section-image {
    max-height: 75vh;
    max-height: 75dvh;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Section Video Styling */
.book-view-section-video {
    margin: 2rem 0;
    text-align: center;
}

.book-view-loading-sections,
.book-view-no-content {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #666);
}

/* ==============================================
   PREVIEW MODE BANNER
   ============================================== */
.preview-info-banner {
    background: linear-gradient(135deg, #e6f6ff 0%, #f0f9ff 100%);
    border-radius: 0;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    color: #0174b1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(1, 116, 177, 0.15);
}

.preview-info-banner i {
    font-size: 1.2rem;
}

.preview-info-banner a {
    color: #0174b1;
    font-weight: 700;
    text-decoration: underline;
}

.preview-info-banner a:hover {
    color: #015a8c;
}

body.dark-mode .preview-info-banner {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.3) 0%, rgba(30, 58, 95, 0.2) 100%);
    color: #93c5fd;
    border-color: #1e3a5f;
}

body.dark-mode .preview-info-banner a {
    color: #60a5fa;
}

/* ==============================================
   LOCKED CHAPTER / UPGRADE PROMPT
   ============================================== */
.book-view-upgrade-prompt {
    text-align: center;
    padding: 3rem 2rem;
}

.upgrade-prompt-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border-radius: 50%;
    color: white;
    font-size: 2rem;
}

.upgrade-prompt-title {
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary, #333);
}

.upgrade-prompt-text {
    max-width: 500px;
    margin: 0 auto 2rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary, #666);
}

.upgrade-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.upgrade-prompt-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.upgrade-prompt-btn.primary {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #1a1a1a;
}

.upgrade-prompt-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 193, 7, 0.4);
}

.upgrade-prompt-btn.secondary {
    background: transparent;
    color: var(--text-secondary, #666);
    border: 2px solid var(--border-color, #e9ecef);
}

.upgrade-prompt-btn.secondary:hover {
    background: var(--bg-hover, #f5f5f5);
    border-color: var(--text-secondary, #666);
}

body.dark-mode .upgrade-prompt-title {
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .upgrade-prompt-text {
    color: var(--text-secondary, #aaa);
}

body.dark-mode .upgrade-prompt-btn.secondary {
    border-color: var(--border-color, #333);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .upgrade-prompt-btn.secondary:hover {
    background: var(--bg-hover, #252525);
}

/* ==============================================
   TOC LOCKED/COMPLETED STATES
   ============================================== */
.book-view-toc-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.book-view-toc-item.locked:hover {
    background: transparent;
}

.book-view-toc-lock {
    margin-left: auto;
    color: #9ca3af;
    font-size: 0.9rem;
}

.book-view-toc-number.completed {
    background: #22c55e;
}

.book-view-toc-item.completed .book-view-toc-title {
    color: var(--text-secondary, #666);
}

/* ==============================================
   CHAPTER FEEDBACK SECTION
   ============================================== */
.chapter-feedback {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color, #e9ecef);
    text-align: center;
}

.chapter-feedback-header h4 {
    margin: 0 0 1.25rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #333);
}

.chapter-feedback-rating {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.feedback-btn {
    width: 56px;
    height: 56px;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 50%;
    background: var(--bg-secondary, white);
    color: var(--text-secondary, #666);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-btn:hover {
    border-color: var(--primary-color, #00b4ff);
    color: var(--primary-color, #00b4ff);
    transform: scale(1.1);
}

.feedback-btn.active {
    border-color: var(--primary-color, #00b4ff);
    background: var(--primary-color, #00b4ff);
    color: white;
    transform: scale(1.1);
}

.feedback-btn:first-child:hover,
.feedback-btn:first-child.active {
    border-color: #ef4444;
    color: #ef4444;
}

.feedback-btn:first-child.active {
    background: #ef4444;
    color: white;
}

.feedback-btn:last-child:hover,
.feedback-btn:last-child.active {
    border-color: #ec4899;
    color: #ec4899;
}

.feedback-btn:last-child.active {
    background: #ec4899;
    color: white;
}

.feedback-thanks {
    margin: 0 0 1.5rem 0;
    color: #22c55e;
    font-weight: 600;
    font-size: 0.95rem;
}

.guest-feedback-text {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary, #666);
    font-size: 0.95rem;
}

.guest-feedback-text a {
    color: var(--primary-color, #00b4ff);
    font-weight: 600;
    text-decoration: underline;
}

.chapter-feedback-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.chapter-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-action-btn:hover {
    border-color: var(--primary-color, #00b4ff);
    color: var(--primary-color, #00b4ff);
    background: rgba(0, 180, 255, 0.05);
}

.chapter-comment-form {
    margin-top: 1.5rem;
    text-align: left;
}

.chapter-comment-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    background: var(--bg-secondary, white);
    color: var(--text-primary, #333);
}

.chapter-comment-input:focus {
    outline: none;
    border-color: var(--primary-color, #00b4ff);
}

.chapter-comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.chapter-comment-cancel,
.chapter-comment-submit {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-comment-cancel {
    background: transparent;
    border: 2px solid var(--border-color, #e9ecef);
    color: var(--text-secondary, #666);
}

.chapter-comment-cancel:hover {
    border-color: var(--text-secondary, #666);
}

.chapter-comment-submit {
    background: var(--primary-color, #00b4ff);
    border: none;
    color: white;
}

.chapter-comment-submit:hover:not(:disabled) {
    background: var(--secondary-color, #0174b1);
}

.chapter-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==============================================
   CHAPTER COMMENTS DISPLAY
   ============================================== */
.chapter-comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e9ecef);
}

.chapter-comments-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-tertiary, #f8f9fa);
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 12px;
    font-weight: 600;
    color: var(--text-primary, #333);
    cursor: pointer;
    transition: all 0.2s;
}

.chapter-comments-toggle:hover {
    border-color: var(--primary-color, #00b4ff);
    color: var(--primary-color, #00b4ff);
}

.chapter-comments-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chapter-comment-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary, #f8f9fa);
    border-radius: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4ff, #0174B1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-body { 
    flex: 1; 
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary, #333);
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-secondary, #999);
}

.comment-delete-btn {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary, #999);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.comment-text {
    margin: 0;
    color: var(--text-primary, #333);
    line-height: 1.5;
}

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 768px) {
    .book-view-hero {
        padding: 7rem 1rem 2rem 1rem;
        min-height: auto;
    }

    .book-view-hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .book-view-hero-cover {
        max-width: 180px;
        margin: 0 auto;
    }

    .book-view-author-section {
        justify-content: center;
    }

    .book-view-stats {
        justify-content: center;
    }

    .book-view-hero-actions {
        justify-content: center;
    }

    .book-view-description {
        margin-left: auto;
        margin-right: auto;
    }

    .book-view-content {
        padding: 1.5rem 1rem;
    }

    .book-view-chapter-content {
        padding: 1.5rem 1rem;
    }

    .book-view-chapter-nav {
        top: 70px; /* Adjusted for mobile nav height */
        gap: 0.5rem; /* Tighter spacing on mobile */
        padding: 0.75rem; /* Less padding on mobile */
        margin-left: 0; /* Ensure contained within parent */
        margin-right: 0; /* Ensure contained within parent */
        border-radius: 8px; /* Slightly smaller radius for mobile */
    }
    
    .book-view-nav-btn {
        width: 36px; /* Smaller buttons on mobile */
        height: 36px;
        flex-shrink: 0; /* Prevent buttons from shrinking */
    }
    
    .book-view-chapter-select {
        flex: 1;
        max-width: none; /* Allow full width on mobile */
        min-width: 0; /* Allow shrinking if needed */
        padding: 0.5rem 0.75rem; /* Less padding on mobile */
        font-size: 0.9rem; /* Slightly smaller text */
    }
}

/* ==============================================
   DARK MODE
   ============================================== */
body.dark-mode .book-view-page,
body.dark-mode .book-view-loading,
body.dark-mode .book-view-error {
    background: var(--bg-color, #0a0a0a);
}

body.dark-mode .book-view-hero-overlay {
    background: linear-gradient(90deg,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.2) 100%);
}

body.dark-mode .book-view-tabs {
    background: var(--bg-secondary, #1a1a1a);
    border-color: var(--border-color, #333);
}

body.dark-mode .book-view-tab-btn {
    color: var(--text-secondary, #aaa);
}

body.dark-mode .book-view-tab-btn:hover {
    background: var(--bg-hover, #252525);
}

body.dark-mode .book-view-chapter-nav {
    background: var(--bg-secondary, #1a1a1a);
}

body.dark-mode .book-view-nav-btn {
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .book-view-chapter-select {
    background: var(--bg-secondary, #1a1a1a);
    border-color: var(--border-color, #333);
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .book-view-chapter-content {
    background: var(--bg-secondary, #1a1a1a);
}

body.dark-mode .book-view-toc h2,
body.dark-mode .book-view-chapter-title,
body.dark-mode .book-view-toc-title {
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .book-view-section-content {
    color: var(--text-primary, #e0e0e0);
}

body.dark-mode .book-view-toc-item:hover {
    background: var(--bg-hover, #252525);
}

body.dark-mode .book-view-error-title {
    color: #e2e8f0;
}

body.dark-mode .book-view-error-text,
body.dark-mode .book-view-loading-text {
    color: #94a3b8;
}

body.dark-mode .book-view-error-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.dark-mode .book-view-follow-author-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .book-view-follow-author-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .book-view-follow-author-btn.following {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
}

body.dark-mode .chapter-feedback {
    border-color: var(--border-color, #333);
}

body.dark-mode .chapter-feedback-header h4 {
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .feedback-btn {
    background: var(--bg-secondary, #1a1a1a);
    border-color: var(--border-color, #333);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .chapter-action-btn {
    border-color: var(--border-color, #333);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .chapter-action-btn:hover {
    background: rgba(0, 180, 255, 0.1);
}

body.dark-mode .chapter-comment-input {
    background: var(--bg-tertiary, #252525);
    border-color: var(--border-color, #333);
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .chapter-comment-cancel {
    border-color: var(--border-color, #333);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .chapter-comments-toggle {
    background: var(--bg-tertiary, #252525);
    border-color: var(--border-color, #333);
    color: var(--text-primary, #f0f0f0);
}

body.dark-mode .chapter-comment-item {
    background: var(--bg-tertiary, #252525);
}
