/* ==========================================================================
   📖 E-READER DESIGN SYSTEM & PALETTES (AVENIR EDITION)
   ========================================================================== */

:root {
    --transition-ereader: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    --font-serif: 'Lora', Georgia, serif;
    --font-sans: 'Avenir Next', Avenir, 'Nunito', 'Inter', system-ui, -apple-system, sans-serif;
    --border-radius-ereader: 16px;
    --border-radius-card: 20px;
}

/* Palette 1: Paperwhite Light Theme (Default - Mockup Olive Edition) */
.ereader-theme-white {
    --bg-canvas: #FAF9F3;
    --bg-surface: #FFFFFF;
    --border-ereader: #E5E2D5;
    --text-primary: #2B2D1B;
    --text-secondary: #5C5E4E;
    --text-muted: #8E907B;
    --accent-ereader: #8F9438;
    --accent-highlight: rgba(143, 148, 56, 0.08);
    --accent-gold: #8F9438;
    --shadow-ereader: 0 4px 15px rgba(43, 45, 27, 0.03);
}

/* Palette 2: Warm Amber / Sepia Theme */
.ereader-theme-sepia {
    --bg-canvas: #F4ECD8;
    --bg-surface: #FAF3E3;
    --border-ereader: #E2D7BE;
    --text-primary: #4F3C23;
    --text-secondary: #745F45;
    --text-muted: #9E8C73;
    --accent-ereader: #8F9438;
    --accent-highlight: rgba(143, 148, 56, 0.1);
    --accent-gold: #8F9438;
    --shadow-ereader: 0 4px 15px rgba(79, 60, 35, 0.04);
}

/* Palette 3: E-Ink Night / Dark Theme */
.ereader-theme-dark {
    --bg-canvas: #1B1D12;
    --bg-surface: #242718;
    --border-ereader: #343823;
    --text-primary: #E6E8DB;
    --text-secondary: #9E9F90;
    --text-muted: #65675A;
    --accent-ereader: #FFFFFF;
    --accent-highlight: rgba(215, 220, 132, 0.12);
    --accent-gold: #D7DC84;
    --shadow-ereader: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Base Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-ereader);
    position: relative;
    overflow-x: hidden;
}

/* Authentic Paper Texture */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://grainy-gradients.vercel.app/noise.svg");
    opacity: 0.035;
    pointer-events: none;
    z-index: 9999;
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

p {
    line-height: 1.6;
}

/* ==========================================================================
   📱 COMPACT TOP STATUS BAR
   ========================================================================== */
.ereader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: var(--bg-surface);
    border-bottom: 1.5px solid var(--border-ereader);
    transition: var(--transition-ereader);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    box-sizing: border-box;
}

.ereader-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ereader-logo-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.ereader-logo-text {
    font-family: var(--font-sans);
    font-weight: 850;
    font-size: 1.05rem;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.ereader-status-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Contextual Actions */
.status-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--text-primary);
    color: var(--bg-surface);
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.status-action-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.status-action-btn i {
    width: 14px;
    height: 14px;
}

.status-action-btn.hidden {
    display: none !important;
}

.status-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition-ereader);
}

.status-btn:hover {
    background-color: var(--accent-highlight);
}

/* ==========================================================================
   🍎 APPLE BOOKS DAILY READING GOAL
   ========================================================================== */
.ereader-goal-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-ereader);
    cursor: pointer;
    transition: var(--transition-ereader);
    position: relative;
    overflow: hidden;
}

.ereader-goal-card:hover {
    border-color: var(--text-primary);
}

.goal-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.goal-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.btn-toggle-goal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: var(--transition-ereader);
}

.btn-toggle-goal:hover {
    background-color: var(--accent-highlight);
    color: var(--text-primary);
}

.btn-toggle-goal i {
    width: 14px;
    height: 14px;
}

.goal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.goal-stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.goal-target-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    transition: var(--transition-ereader);
}

.goal-picker-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 4px;
}

.goal-preset-btn {
    background-color: transparent;
    border: 1px solid var(--border-ereader);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.goal-preset-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.goal-preset-btn.active {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-surface);
}

.goal-ring-container {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-ereader);
}

.goal-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border-ereader);
    stroke-width: 3.5;
}

.ring-fill {
    fill: none;
    stroke: var(--accent-gold);
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.35s ease;
}

.goal-percent {
    position: absolute;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Goals Card Compact Strip View */
.ereader-goal-card.collapsed {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.ereader-goal-card.collapsed .goal-ring-container,
.ereader-goal-card.collapsed .goal-target-picker,
.ereader-goal-card.collapsed .goal-title {
    display: none !important;
}

.ereader-goal-card.collapsed .goal-info {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.ereader-goal-card.collapsed .goal-header-row {
    flex-grow: 1;
}

.ereader-goal-card.collapsed .goal-stats {
    font-size: 0.8rem;
    font-weight: 700;
}

.goal-strip-bar {
    width: 100%;
    margin-top: 4px;
    transition: var(--transition-ereader);
}

.goal-strip-bar.hidden {
    display: none !important;
}

.goal-strip-progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border-ereader);
    border-radius: 3px;
    overflow: hidden;
}

.goal-strip-fill {
    height: 100%;
    background-color: var(--accent-gold);
    border-radius: 3px;
    width: 0%;
    transition: width 0.35s ease;
}

/* ==========================================================================
   📏 CONTAINER & SECTIONS
   ========================================================================== */
.ereader-main-container {
    max-width: 700px;
    width: 100%;
    margin: 20px auto 100px;
    padding: 0 16px;
    flex-grow: 1;
    box-sizing: border-box;
}

.view-section {
    display: none;
    animation: ereaderFadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.view-section.active {
    display: block;
}

@keyframes ereaderFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   🌟 VIEW 1: HOME FEED (SNAP HIGHLIGHT FEED)
   ========================================================================== */
.ereader-vertical-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ereader-highlight-card {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    padding: 24px;
    box-shadow: var(--shadow-ereader);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: var(--transition-ereader);
}

.ereader-highlight-card:hover {
    border-color: var(--text-primary);
}

.ereader-highlight-card.shuffle-anim {
    animation: eInkRefresh 0.35s ease-in-out;
}

@keyframes eInkRefresh {
    0% { opacity: 1; }
    50% { opacity: 0.1; filter: grayscale(1); }
    100% { opacity: 1; }
}

.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ereader-tag {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    border: 1px solid var(--border-ereader);
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.ereader-action-btn {
    background: transparent;
    border: 1px solid var(--border-ereader);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.ereader-action-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: var(--accent-highlight);
}

.ereader-action-btn.stashed {
    background-color: var(--text-primary);
    color: var(--bg-surface);
    border-color: var(--text-primary);
}

.ereader-action-btn i {
    width: 14px;
    height: 14px;
}

.ereader-quote-text {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.5;
    font-weight: 500;
    font-style: italic;
    border-left: 3.5px solid var(--accent-gold);
    padding-left: 16px;
    color: var(--text-primary);
}

.card-quote-divider {
    height: 1px;
    background-color: var(--border-ereader);
}

.card-quote-source {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ereader-book-title {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--text-primary);
}

.ereader-author-info {
    opacity: 0.8;
}

.ereader-location-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid var(--border-ereader);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Feed action buttons (like and share footer) */
.feed-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.feed-action-btn {
    background-color: transparent;
    border: 1px solid var(--border-ereader);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.feed-action-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.feed-action-btn.active {
    background-color: var(--accent-highlight);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.feed-action-btn i {
    width: 13px;
    height: 13px;
}

/* Skeletons & Loaders */
.feed-loading-state {
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-loading-pulse {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--border-ereader) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shiver 1.5s infinite;
}

@keyframes shiver {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   📚 VIEW 2: LIBRARY (BOOK GRIDS & ROWS)
   ========================================================================== */
.ereader-book-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 600px) {
    .ereader-book-list {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

.ereader-book-row {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-ereader);
    padding: 16px;
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition-ereader);
    box-shadow: var(--shadow-ereader);
}

.ereader-book-row:hover {
    border-color: var(--text-primary);
    transform: translateY(-2px);
}

.row-cover-container {
    height: 104px;
    border: 1.5px solid var(--border-ereader);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-canvas);
    display: flex;
    align-items: center;
    justify-content: center;
}

.row-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.row-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.row-details-header h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.row-details-header .author {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.row-details-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.row-progress-bar {
    background-color: var(--border-ereader);
    height: 4px;
    border-radius: 2px;
    width: 100%;
    overflow: hidden;
}

.row-progress-fill {
    background-color: var(--accent-gold);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.row-meta-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
}

/* Skeletons */
.ereader-skeleton-row {
    height: 138px;
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-ereader);
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--border-ereader) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shiver 1.5s infinite;
}

/* Curated Category Pills Selector inside Modal */
.category-pills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.category-pill {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-ereader);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-ereader);
}

.category-pill:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.category-pill.active {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-surface);
}

/* ==========================================================================
   📬 FLOATING IMPORT DRAWER (GOSLIDE MODAL DIALOG)
   ========================================================================== */
.ereader-upload-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(43, 45, 27, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 16px;
    transition: opacity 0.25s ease;
}

.ereader-upload-drawer.hidden {
    display: none !important;
}

.upload-modal-content {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: modalSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.drawer-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.icon-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-ereader);
}

.icon-close-btn:hover {
    background-color: var(--accent-highlight);
    color: var(--text-primary);
}

.drawer-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.k-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.k-drop-zone {
    border: 1.5px dashed var(--text-muted);
    background-color: var(--bg-canvas);
    padding: 24px 16px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-ereader);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.k-drop-zone:hover {
    border-color: var(--accent-gold);
    background-color: var(--accent-highlight);
}

.k-drop-zone:hover .k-upload-icon {
    transform: translateY(-2px);
}

.k-upload-icon {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.k-drop-zone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.k-drop-zone span {
    font-weight: 700;
    text-decoration: underline;
    color: var(--accent-gold);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.k-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.k-form-group label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.k-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-ereader);
    border: 1.5px solid var(--text-primary);
}

.k-btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-surface);
}

.k-btn-primary:hover {
    opacity: 0.9;
}

.k-btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
}

.k-btn-secondary:hover {
    background-color: var(--accent-highlight);
}

.k-btn-small {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.k-btn:disabled {
    border-color: var(--border-ereader);
    color: var(--text-muted);
    cursor: not-allowed;
    background-color: transparent;
}

.k-progress-container {
    margin-top: 12px;
    position: relative;
    background-color: var(--border-ereader);
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
}

.k-progress-bar {
    height: 100%;
    background-color: var(--accent-gold);
    width: 0%;
    transition: width 0.2s ease;
}

.k-progress-text {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 6px;
}

.upload-status-message {
    font-size: 0.8rem;
    margin-top: 8px;
    text-align: center;
    font-weight: 700;
}

/* ==========================================================================
   💖 VIEW 3: NOTEBOOK / SAVED BOOKMARKS
   ========================================================================== */
.ereader-notebook-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.k-stash-card {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    padding: 20px;
    box-shadow: var(--shadow-ereader);
    transition: var(--transition-ereader);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.k-stash-card:hover {
    border-color: var(--text-primary);
}

.k-stash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.k-stash-body {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.5;
    font-style: italic;
    color: var(--text-primary);
    border-left: 2.5px solid var(--accent-gold);
    padding-left: 12px;
}

.k-stash-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    border-top: 1px solid var(--border-ereader);
    padding-top: 10px;
}

.k-stash-footer i {
    width: 13px;
    height: 13px;
}

/* ==========================================================================
   👥 VIEW 4: COMMUNITY & POSTS
   ========================================================================== */
.community-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.community-post-card {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    padding: 20px;
    box-shadow: var(--shadow-ereader);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: var(--transition-ereader);
}

.community-post-card:hover {
    border-color: var(--text-primary);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-highlight);
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.78rem;
    border: 1px solid var(--border-ereader);
}

.post-author-block {
    display: flex;
    flex-direction: column;
}

.post-writer {
    font-weight: 800;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.post-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.post-badge {
    background-color: var(--accent-highlight);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-badge i {
    width: 10px;
    height: 10px;
}

.post-quote {
    font-family: var(--font-serif);
    font-size: 0.98rem;
    line-height: 1.45;
    font-style: italic;
    color: var(--text-secondary);
    border-left: 2px solid var(--border-ereader);
    padding-left: 10px;
}

.post-thought {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    border-top: 1px solid var(--border-ereader);
    padding-top: 10px;
}

.post-book-link {
    font-family: var(--font-serif);
    color: var(--text-secondary);
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-post-like {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.btn-post-like:hover {
    color: var(--accent-gold);
}

.btn-post-like i {
    width: 13px;
    height: 13px;
}

.btn-post-like.liked {
    color: var(--accent-gold);
}

.btn-post-like.liked i {
    fill: var(--accent-gold);
}

/* ==========================================================================
   📖 IMMERSIVE FULL-SCREEN E-READER SHEET
   ========================================================================== */
.ereader-reader-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease;
    overflow-x: hidden;
}

.ereader-reader-sheet.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.reader-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-ereader);
    height: 52px;
    flex-shrink: 0;
}

.reader-header-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: var(--transition-ereader);
}

.reader-header-btn:hover {
    background-color: var(--accent-highlight);
}

.reader-header-btn i {
    width: 16px;
    height: 16px;
}

.reader-title-meta {
    text-align: center;
    max-width: 50%;
}

.reader-title-meta h4 {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-title-meta span {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.reader-control-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aa-icon {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

/* Aa Text Sizing Menu (Goslide Dropdown Overlay) */
.dropdown-container {
    position: relative;
}

.aa-menu-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: 12px;
    width: 240px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: dropdownFade 0.2s ease forwards;
}

.aa-menu-dropdown.hidden {
    display: none !important;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.aa-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aa-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.aa-size-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-ereader);
    border-radius: 8px;
    overflow: hidden;
}

.size-btn {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    width: 44px;
    height: 36px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.size-btn:hover {
    background-color: var(--border-ereader);
}

.size-display {
    font-size: 0.8rem;
    font-weight: 700;
}

.font-style-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.font-style-btn {
    background-color: var(--bg-canvas);
    border: 1.5px solid var(--border-ereader);
    color: var(--text-secondary);
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.font-style-btn.active {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.tone-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.tone-btn {
    height: 32px;
    border-radius: 6px;
    border: 1.5px solid var(--border-ereader);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    transition: var(--transition-ereader);
}

.tone-btn.tone-white { background-color: #FAF9F3; color: #2B2D1B; }
.tone-btn.tone-sepia { background-color: #F4ECD8; color: #4F3C23; }
.tone-btn.tone-dark { background-color: #1B1D12; color: #E6E8DB; border-color: #343823; }

.tone-btn.active {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 1px var(--accent-gold);
}

/* Immersive Reading Mode Tabs */
.reader-mode-switcher {
    display: flex;
    background-color: var(--bg-surface);
    border-bottom: 1.5px solid var(--border-ereader);
    height: 40px;
    flex-shrink: 0;
}

.mode-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-ereader);
}

.mode-tab:hover {
    color: var(--text-primary);
}

.mode-tab.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

.mode-tab i {
    width: 16px;
    height: 16px;
}

/* Immersive Scrollable Page Body */
.reader-page-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reader-chapter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
}

.nav-ch-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-ereader);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-ereader);
    flex-shrink: 0;
}

.nav-ch-btn:hover {
    border-color: var(--text-primary);
}

.nav-ch-btn i {
    width: 14px;
    height: 14px;
}

/* Custom dropdown selector for chapters */
.ereader-custom-select {
    position: relative;
    flex-grow: 1;
    max-width: 280px;
}

.custom-select-trigger {
    width: 100%;
    padding: 6px 14px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-ereader);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-ereader);
}

.custom-select-trigger:hover {
    border-color: var(--text-primary);
}

.custom-select-trigger i {
    width: 12px;
    height: 12px;
}

.custom-select-options {
    position: absolute;
    bottom: 36px;
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: 12px;
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1200;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
}

.custom-select-options.hidden {
    display: none !important;
}

.custom-select-options li {
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid var(--border-ereader);
    color: var(--text-secondary);
}

.custom-select-options li:last-child {
    border-bottom: none;
}

.custom-select-options li:hover,
.custom-select-options li.selected {
    background-color: var(--accent-highlight);
    color: var(--text-primary);
    font-weight: 700;
}

/* Reading Book Page */
.ereader-book-page {
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    padding: 24px;
    box-shadow: var(--shadow-ereader);
    box-sizing: border-box;
}

.ereader-book-page.page-flip-left {
    animation: flipLeft 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.ereader-book-page.page-flip-right {
    animation: flipRight 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes flipLeft {
    0% { transform: translateX(0); opacity: 1; }
    45% { transform: translateX(-15px); opacity: 0; }
    55% { transform: translateX(15px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes flipRight {
    0% { transform: translateX(0); opacity: 1; }
    45% { transform: translateX(15px); opacity: 0; }
    55% { transform: translateX(-15px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.reader-content-view.hidden {
    display: none !important;
}

.ereader-block-heading {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.ereader-block-heading i {
    width: 12px;
    height: 12px;
}

.ereader-page-text {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.65;
    color: var(--text-primary);
    user-select: text;
}

.ereader-page-text p {
    margin-bottom: 14px;
}

.ereader-page-text h1, .ereader-page-text h2, .ereader-page-text h3 {
    font-family: var(--font-sans);
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.ereader-page-text ul, .ereader-page-text ol {
    padding-left: 20px;
    margin-bottom: 14px;
}

.ereader-page-text li {
    margin-bottom: 6px;
}

/* Atomic Insights View (notebook-style cards) */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-card {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-ereader);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-card-text {
    font-size: 0.92rem;
    line-height: 1.45;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-insight-action {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.btn-insight-action:hover {
    color: var(--accent-gold);
}

.btn-insight-action i {
    width: 12px;
    height: 12px;
}

.btn-insight-action.active {
    color: var(--accent-gold);
}

.btn-insight-action.active i {
    fill: var(--accent-gold);
}

/* Immersive Footer */
.reader-progress-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 36px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-ereader);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    z-index: 1060;
    box-sizing: border-box;
}

/* ==========================================================================
   📲 OS COMPATIBLE STICKY BOTTOM NAVIGATION BAR
   ========================================================================== */
.ereader-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--bg-surface);
    border-top: 1.5px solid var(--border-ereader);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
}

.k-nav-item {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    position: relative;
    transition: var(--transition-ereader);
}

.k-nav-item:hover {
    color: var(--text-primary);
}

.k-nav-item i {
    width: 18px;
    height: 18px;
}

.k-nav-item.active {
    color: var(--accent-gold);
}

/* active indicator dot */
.k-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent-gold);
    animation: dotFadeIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes dotFadeIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.k-nav-item.active i {
    stroke-width: 2.5px;
}

.ereader-nav-badge {
    position: absolute;
    top: 8px;
    right: 25%;
    background-color: var(--text-primary);
    color: var(--bg-surface);
    font-size: 0.62rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 8px;
    border: 1.5px solid var(--bg-surface);
}

/* ==========================================================================
   📬 SHARE THOUGHT BOTTOM SHEET (INSTAGRAM PARADIGM)
   ========================================================================== */
.share-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(43, 45, 27, 0.3);
    backdrop-filter: blur(2px);
    z-index: 1010;
    transition: opacity 0.25s ease;
}

.share-sheet-backdrop.hidden {
    display: none !important;
}

.share-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border-top: 1.5px solid var(--border-ereader);
    border-radius: 20px 20px 0 0;
    z-index: 1020;
    padding: 16px 20px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    box-sizing: border-box;
}

.share-sheet.hidden {
    display: none !important;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.share-sheet-handle {
    width: 36px;
    height: 4px;
    background-color: var(--border-ereader);
    border-radius: 2px;
    margin: 0 auto;
}

.share-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-sheet-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.share-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-field label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.share-field-hint {
    text-transform: none;
    font-weight: 500;
    font-size: 0.68rem;
}

.share-field input[type="text"],
.share-field textarea,
.share-select {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--border-ereader);
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: var(--transition-ereader);
}

.share-field input[type="text"]:focus,
.share-field textarea:focus,
.share-select:focus {
    border-color: var(--accent-gold);
}

.share-verified-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 700;
}

.share-verified-row i {
    width: 14px;
    height: 14px;
    fill: rgba(143, 148, 56, 0.1);
}

.share-submit-btn {
    width: 100%;
}

/* ==========================================================================
   📦 PROGRESSIVE WEB APP (PWA) INSTALL COMPONENTS
   ========================================================================== */
.pwa-install-banner {
    position: fixed;
    bottom: 76px;
    left: 16px;
    right: 16px;
    background-color: var(--text-primary);
    color: var(--bg-surface);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1500; /* Elevated high above layout boundaries */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease;
}

.pwa-install-banner.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-install-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-install-icon i {
    width: 18px;
    height: 18px;
    color: var(--bg-surface);
}

.pwa-install-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-install-text strong {
    font-size: 0.82rem;
    font-weight: 800;
}

.pwa-install-text span {
    font-size: 0.7rem;
    opacity: 0.8;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-install-btn {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition-ereader);
}

.pwa-install-btn:hover {
    opacity: 0.9;
}

.pwa-dismiss-btn {
    background: transparent;
    border: none;
    color: var(--bg-surface);
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.7;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-ereader);
}

.pwa-dismiss-btn:hover {
    opacity: 1;
}

/* Premium Install Guide Modal Overlay */
.pwa-guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(43, 45, 27, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1600;
    padding: 16px;
}

.pwa-guide-modal.hidden {
    display: none !important;
}

.guide-modal-content {
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-ereader);
    border-radius: var(--border-radius-card);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: modalSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.guide-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guide-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 850;
    color: var(--text-primary);
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.guide-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-ereader);
    padding-top: 12px;
}

.guide-modal-footer p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: center;
}

/* ==========================================================================
   🔔 GLOBAL TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    width: calc(100% - 32px);
    max-width: 320px;
    pointer-events: none;
}

.toast {
    background-color: var(--text-primary);
    color: var(--bg-surface);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    animation: toastIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    pointer-events: auto;
}

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

.toast.toast-fadeout {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-8px); }
}

.toast.toast-info {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1.5px solid var(--border-ereader);
}
