/* ===== Reader Styles ===== */
.reader-body {
    background: var(--bg);
    min-height: 100vh;
}

.reader-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 20px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.reader-toolbar-left {
    display: flex;
    align-items: center;
}

.reader-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.reader-back:hover {
    color: var(--primary);
}

.reader-toolbar-center {
    text-align: center;
    flex: 1;
    min-width: 0;
    padding: 0 16px;
}

.reader-book-title {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-heading);
}

.reader-book-author {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.reader-toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.reader-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
    font-family: var(--font-body);
}

.reader-btn:hover {
    background: var(--bg-alt);
    color: var(--text);
}

.reader-btn-kofi {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    color: #FF5E5B;
    text-decoration: none;
}

.reader-btn-kofi:hover {
    background: #FF5E5B;
    color: white;
}

@media (max-width: 640px) {
    .reader-btn-kofi-label { display: none; }
    .reader-btn-kofi { width: 36px; padding: 0; }
}

/* Table of Contents */
.reader-toc {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    z-index: 60;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.reader-toc.active {
    right: 0;
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.toc-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.toc-close {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
}

.toc-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.toc-item {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}

.toc-item:hover, .toc-item.active {
    background: rgba(108, 99, 255, 0.08);
    color: var(--primary);
}

/* Reader Content */
.reader-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px 120px;
    min-height: 100vh;
}

.reader-page {
    font-family: 'Lora', 'Merriweather', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text);
}

.reader-page h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin: 48px 0 16px;
    line-height: 1.3;
}

.reader-page h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 40px 0 16px;
    line-height: 1.3;
    color: var(--primary);
}

.reader-page h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: 32px 0 12px;
}

.reader-page p {
    margin-bottom: 1.2em;
    text-align: justify;
    hyphens: auto;
}

.reader-page blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 20px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.reader-page .chapter-title {
    text-align: center;
    font-size: 1.8rem;
    margin: 60px 0 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.reader-page .book-header {
    text-align: center;
    padding: 40px 0 60px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 40px;
}

.reader-page .book-header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.reader-page .book-header .author {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Progress bar */
.reader-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    z-index: 50;
}

.reader-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 0.1s;
}

/* Reader Sepia Theme */
.reader-body[data-reader-theme="sepia"] {
    --bg: #f5f0e6;
    --bg-alt: #ece6d8;
    --text: #4a3f35;
    --text-secondary: #7d6f5f;
    --border: #ddd5c4;
    --card-bg: #f5f0e6;
    --header-bg: rgba(245, 240, 230, 0.95);
}

@media (max-width: 768px) {
    .reader-content {
        padding: 72px 16px 100px;
    }

    .reader-page {
        font-size: 1rem;
    }

    .reader-book-title {
        font-size: 0.8rem;
    }

    .reader-toolbar-right {
        gap: 0;
    }

    .reader-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .reader-toc {
        width: 280px;
    }

    .reader-back span {
        display: none;
    }
}

/* Share FAB */
.reader-share-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.share-fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(108,99,255,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.share-fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(108,99,255,0.4);
}
.share-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.reader-share-fab.open .share-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.share-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.15s;
    text-decoration: none;
}
.share-option:hover {
    transform: scale(1.1);
}

/* Read Next Section */
.read-next-section {
    max-width: 800px;
    margin: 80px auto 40px;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.read-next-section h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-bottom: 8px;
}
.read-next-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}
.read-next-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}
.read-next-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
    text-align: left;
}
.read-next-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary, #6C63FF);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.read-next-cover {
    aspect-ratio: 2/3;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-alt);
}
.read-next-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.read-next-cover-placeholder {
    width: 100%;
    height: 100%;
}
.read-next-info h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 4px;
}
.read-next-author {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 2px;
}
.read-next-meta {
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.read-next-back {
    display: inline-block;
    color: var(--primary, #6C63FF);
    font-weight: 600;
    text-decoration: none;
}
.read-next-back:hover {
    text-decoration: underline;
}
@media (max-width: 640px) {
    .read-next-grid { grid-template-columns: 1fr; }
    .read-next-section { margin-top: 60px; padding: 32px 16px; }
}

/* In-reader Support Cards */
.reader-support-card {
    max-width: 600px;
    margin: 48px auto;
    padding: 24px 28px;
    border-radius: 12px;
    display: flex;
    gap: 18px;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 4px 18px rgba(0,0,0,0.05);
}
.reader-support-kofi {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe9e8 100%);
    border-color: #FF5E5B;
}
.reader-support-amazon {
    background: linear-gradient(135deg, #fff8e6 0%, #ffefd0 100%);
    border-color: #FFA41C;
}
[data-theme="dark"] .reader-support-kofi {
    background: linear-gradient(135deg, #2a1818 0%, #3a1f1f 100%);
}
[data-theme="dark"] .reader-support-amazon {
    background: linear-gradient(135deg, #2a2218 0%, #3a2d18 100%);
}
.reader-support-icon {
    font-size: 2rem;
    flex-shrink: 0;
}
.reader-support-body {
    flex: 1;
}
.reader-support-body h3 {
    margin: 0 0 6px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
}
.reader-support-body p {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}
a.reader-support-cta {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    background: #FF5E5B;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}
.reader-support-cta:hover {
    transform: translateY(-1px);
    background: #e84744;
}
.reader-support-cta-amazon {
    background: #FFA41C;
}
.reader-support-cta-amazon:hover {
    background: #e8901a;
}
@media (max-width: 640px) {
    .reader-support-card {
        flex-direction: column;
        text-align: center;
        margin: 36px 16px;
        padding: 20px;
    }
}

/* TTS active states */
button.reader-btn.reader-btn-active,
button.reader-btn.reader-btn-active:hover {
    background: var(--primary, #6C63FF);
    color: #fff;
}
.tts-active {
    background: rgba(108, 99, 255, 0.12);
    border-radius: 4px;
    padding: 2px 4px;
    margin: 0 -4px;
    transition: background 0.2s;
}
