/* ===========================
   BIBLA ONLINE KJV — STYLES
   Kisha Biblike e Durrësit
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #1a365d;
    --navy-dark: #12284a;
    --gold: #c9a84c;
    --gold-light: #e8d48b;
    --parchment: #faf6ed;
    --parchment-dark: #f0e8d5;
    --text-dark: #2c2416;
    --text-mid: #5a4e3a;
    --text-light: #8b7d65;
    --border-light: #e6dcc8;
    --verse-hover: rgba(201, 168, 76, 0.12);
    --verse-active: rgba(201, 168, 76, 0.25);
    --highlight: rgba(255, 235, 59, 0.4);
    --sidebar-w: 280px;
    --header-h: 60px;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, #ece6d8 0%, #f1ede4 40%, #f5f1ea 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.bible-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
    color: #fff;
    height: var(--header-h);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border-bottom: 2px solid var(--gold);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
}

.header-home {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}
.header-home:hover { opacity: 1; }
.header-home img { border-radius: 4px; }
.header-brand { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.5px; }

.header-title { text-align: center; }
.header-title h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
.header-version {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.7;
}

.header-actions { display: flex; gap: 6px; align-items: center; }
.lang-toggle {
    display: flex;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    overflow: hidden;
}
.lang-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.5px;
}
.lang-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.lang-btn.active {
    background: var(--gold);
    color: var(--navy);
}
.header-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.header-btn:hover { background: rgba(255,255,255,0.2); }
.header-btn svg { width: 20px; height: 20px; }

/* --- Search Overlay --- */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
}
.search-overlay.active { display: flex; }

.search-overlay-inner {
    width: 100%;
    max-width: 640px;
    padding: 0 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    padding: 0 16px;
}
.search-bar-icon { width: 22px; height: 22px; opacity: 0.4; flex-shrink: 0; }
.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    padding: 16px 12px;
    font-family: inherit;
    background: transparent;
}
.search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.search-close:hover { opacity: 1; }
.search-close svg { width: 20px; height: 20px; }

.search-hints {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 4px;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}
.hint-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}
.hint-btn:hover { background: rgba(255,255,255,0.3); }

.search-options-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 4px 4px;
    flex-wrap: wrap;
}
.search-scope-bar,
.search-mode-bar {
    display: flex;
    align-items: center;
    gap: 14px;
}
.search-scope-bar .scope-option,
.search-mode-bar .scope-option {
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
}
.search-scope-bar .scope-option input[type="radio"],
.search-mode-bar .scope-option input[type="radio"] {
    accent-color: var(--gold);
}
.search-mode-bar {
    border-left: 1px solid rgba(255,255,255,0.25);
    padding-left: 16px;
}

/* Back-to-search button */
.back-to-search {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 28px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 900;
    transition: background 0.2s, transform 0.2s;
}
.back-to-search:hover {
    background: var(--navy-light, #2a4a7f);
    transform: translateX(-50%) scale(1.04);
}

.search-results {
    margin-top: 12px;
    max-height: 50vh;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
}
.search-results.has-results { display: block; }

.search-result-item {
    padding: 14px 18px;
    border-bottom: 1px solid #f0ece3;
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--verse-hover); }
.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.search-result-ref {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.search-copy-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 6px;
    cursor: pointer;
    color: var(--text-mid);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 0;
}
.search-copy-btn:hover {
    color: var(--navy);
    border-color: var(--navy);
    background: rgba(26,54,93,0.06);
}
.search-result-text {
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.5;
}
.search-result-text mark {
    background: var(--highlight);
    padding: 1px 2px;
    border-radius: 2px;
}

/* --- Compare / Parallel View --- */
.search-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}
.compare-btn:hover {
    background: #244a7a;
    transform: translateY(-1px);
}
.compare-btn.compare-back {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--navy);
}
.compare-btn.compare-back:hover {
    background: rgba(26,54,93,0.08);
}
.compare-item {
    padding: 12px 16px;
}
.compare-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}
.compare-col {
    background: rgba(250,246,237,0.5);
    border-radius: 6px;
    padding: 10px 12px;
    border-left: 3px solid var(--gold);
}
.compare-col-other {
    border-left-color: var(--navy);
    background: rgba(26,54,93,0.04);
}
.compare-lang-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 4px;
}
.compare-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.compare-col-header .search-copy-btn {
    padding: 3px 4px;
}
.compare-col-other .compare-lang-label {
    color: var(--navy);
}
.compare-text {
    font-size: 0.86rem;
    color: var(--text-mid);
    line-height: 1.55;
}
@media (max-width: 600px) {
    .compare-columns {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .search-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .copy-all-bar {
        flex-wrap: wrap;
    }
}

/* --- Copy All Bar --- */
.copy-all-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #f5f1e8;
    border-bottom: 1px solid #e8e2d5;
    flex-wrap: wrap;
}
.copy-all-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-right: 4px;
}
.copy-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-mid);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.copy-all-btn:hover {
    background: rgba(26,54,93,0.06);
    border-color: var(--navy);
    color: var(--navy);
}

/* --- Layout --- */
.bible-layout {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

/* --- Sidebar --- */
.bible-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border-light);
    height: calc(100vh - var(--header-h));
    position: sticky;
    top: var(--header-h);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 50;
    /* Subtle warm bottom glow */
    background-image: linear-gradient(to bottom, #fff 85%, rgba(201,168,76,0.06) 100%);
}

.sidebar-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 16px 0;
}

.sidebar-section { padding: 0 16px; margin-bottom: 24px; }
.sidebar-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* Testament toggle */
.testament-group { margin-bottom: 4px; }
.testament-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: var(--parchment);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--navy);
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background 0.15s;
    font-family: inherit;
}
.testament-toggle:hover { background: var(--parchment-dark); }
.toggle-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.25s;
    flex-shrink: 0;
}
.testament-toggle.active .toggle-arrow { transform: rotate(0deg); }
.testament-toggle:not(.active) .toggle-arrow { transform: rotate(-90deg); }
.testament-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Book list */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: visible;
    overflow: visible;
}
.book-list.collapsed { display: none; }

.book-item {
    padding: 7px 12px 7px 30px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-mid);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book-item:hover { background: var(--parchment); color: var(--navy); }
.book-item.active {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
}

/* --- Concordance Section --- */
.concordance-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.4;
}

.concordance-input-wrap {
    display: flex;
    gap: 6px;
}
.concordance-input-wrap input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.concordance-input-wrap input:focus { border-color: var(--gold); }
.concordance-input-wrap button {
    padding: 8px 10px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}
.concordance-input-wrap button:hover { background: var(--navy-dark); }
.concordance-input-wrap button svg { width: 16px; height: 16px; }

.concordance-scope {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 12px;
}
.scope-option {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--text-mid);
    cursor: pointer;
}
.scope-option input[type="radio"] { accent-color: var(--gold); cursor: pointer; }

.concordance-results {
    max-height: 300px;
    overflow-y: auto;
}
.concordance-header-info {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}
.concordance-item {
    padding: 8px 0;
    border-bottom: 1px solid #f5f0e5;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 3px;
    padding-left: 4px;
    padding-right: 4px;
}
.concordance-item:hover { background: var(--verse-hover); }
.concordance-item:last-child { border-bottom: none; }
.concordance-item-ref {
    font-weight: 600;
    color: var(--gold);
    margin-right: 6px;
}
.concordance-item-text {
    color: var(--text-mid);
    line-height: 1.4;
}
.concordance-item mark {
    background: var(--highlight);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Progress */
.concordance-progress { margin-top: 12px; }
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}
.progress-text { font-size: 0.78rem; color: var(--text-light); }
.progress-cancel {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 0.78rem;
    cursor: pointer;
    margin-left: 8px;
    text-decoration: underline;
    font-family: inherit;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
}
.sidebar-overlay.active { display: block; }

/* --- Main Content --- */
.bible-main {
    flex: 1;
    padding: 24px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

/* Chapter Controls */
.chapter-controls {
    margin-bottom: 20px;
}
.controls-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.controls-inner select {
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-dark);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 0;
}
.controls-inner select:focus { border-color: var(--gold); }
#bookSelect { flex: 1; min-width: 140px; }
#chapterSelect { width: 100px; }
.go-btn {
    padding: 10px 24px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.go-btn:hover { background: var(--navy-dark); }

/* --- Bible Page (printed book look) --- */
.bible-page-wrap {
    perspective: 1200px;
    overflow: hidden;
}

.bible-page {
    background: var(--parchment);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-shadow:
        0 1px 4px rgba(0,0,0,0.06),
        0 4px 16px rgba(0,0,0,0.04),
        inset 0 0 60px rgba(139, 117, 85, 0.04);
    min-height: 400px;
    position: relative;
    overflow: hidden;
    /* Subtle parchment texture via repeating gradient */
    background-image:
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(139,117,85,0.03) 0%, transparent 50%);
    background-color: var(--parchment);
}

/* Page turn overlay sheet — peels away like a real book page */
.page-turn-sheet {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--parchment);
    background-image:
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(139,117,85,0.03) 0%, transparent 50%);
    z-index: 5;
    backface-visibility: hidden;
    pointer-events: none;
}

.page-turn-sheet.turn-next {
    transform-origin: right center;
    animation: pagePeelNext 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}
.page-turn-sheet.turn-prev {
    transform-origin: left center;
    animation: pagePeelPrev 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* Fold crease shadow on the sheet */
.page-turn-sheet::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.page-turn-sheet.turn-next::after {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.1), transparent);
    animation: foldShadowIn 0.6s ease forwards;
}
.page-turn-sheet.turn-prev::after {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.1), transparent);
    animation: foldShadowIn 0.6s ease forwards;
}

.bible-page.page-swipe-drag {
    transition: none !important;
}

@keyframes pagePeelNext {
    0% {
        transform: perspective(1200px) rotateY(0deg);
        box-shadow: -2px 0 8px rgba(0,0,0,0.06);
    }
    55% {
        transform: perspective(1200px) rotateY(-70deg);
        box-shadow: -15px 0 40px rgba(0,0,0,0.18);
    }
    100% {
        transform: perspective(1200px) rotateY(-90deg);
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes pagePeelPrev {
    0% {
        transform: perspective(1200px) rotateY(0deg);
        box-shadow: 2px 0 8px rgba(0,0,0,0.06);
    }
    55% {
        transform: perspective(1200px) rotateY(70deg);
        box-shadow: 15px 0 40px rgba(0,0,0,0.18);
    }
    100% {
        transform: perspective(1200px) rotateY(90deg);
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes foldShadowIn {
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

body.dark-mode .page-turn-sheet {
    background: #1e2230;
    background-image: none;
}

/* Page edge shadow (left spine) */
.bible-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(139,117,85,0.06), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Page edge shadow (right) */
.bible-page::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    background: linear-gradient(to left, rgba(139,117,85,0.04), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Chapter header */
.chapter-header {
    text-align: center;
    padding: 40px 50px 20px;
}
.chapter-book {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    color: var(--navy);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.chapter-number-display {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--text-light);
    letter-spacing: 3px;
    text-transform: uppercase;
}
.chapter-ornament {
    color: var(--gold);
    font-size: 1rem;
    line-height: 1;
    margin: 6px 0;
    opacity: 0.7;
}

/* Decorative chapter divider between header and text */
.chapter-header::after {
    content: '';
    display: block;
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 16px auto 0;
    opacity: 0.5;
}

/* --- Bible Text --- */
.page-text {
    padding: 16px 50px 50px;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.08rem;
    line-height: 1.9;
    color: var(--text-dark);
    column-count: 1;
    column-gap: 0;
    column-rule: none;
    text-align: left;
    hyphens: none;
}

/* Each verse on its own row */
.verse {
    display: block;
    margin-bottom: 1em;
    padding-bottom: 0.1em;
}

/* Compact verse text: less space within, more between verses */
.verse {
    line-height: 1.4;
}
.page-text {
    line-height: 1.2;
}
}
}

/* Welcome screen */
.bible-welcome {
    column-span: all;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-mid);
}
.welcome-illustration {
    margin-bottom: 20px;
}
.welcome-svg {
    width: 160px;
    height: auto;
    opacity: 0.85;
}
.welcome-divider {
    display: flex;
    justify-content: center;
    margin: 18px 0 14px;
}
.welcome-divider svg {
    width: 120px;
    height: 12px;
}
.bible-welcome h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 12px;
}
.bible-welcome p {
    max-width: 420px;
    margin: 0 auto 12px;
    font-size: 0.95rem;
    line-height: 1.6;
}
.welcome-verse {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    color: var(--text-light);
    font-size: 0.9rem !important;
    margin-top: 20px !important;
}

/* Verses */
.verse {
    cursor: pointer;
    transition: background 0.15s;
    padding: 1px 3px;
    border-radius: 3px;
    position: relative;
}
.verse:hover { background: var(--verse-hover); }
.verse.selected { background: var(--verse-active); }
.verse.highlighted { background: var(--highlight); }

.verse-num {
    font-family: 'Inter', sans-serif;
    font-size: 0.6em;
    font-weight: 700;
    color: #8b4513;
    vertical-align: super;
    margin-right: 2px;
    user-select: none;
    letter-spacing: 0;
}

/* Drop cap on first verse */
.verse.first-verse .drop-cap {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.4em;
    line-height: 0.8;
    padding-right: 6px;
    padding-top: 6px;
    color: var(--navy);
    font-weight: 700;
}

/* Loading */
.page-loading {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--gold);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Chapter Navigation --- */
.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding: 14px 0;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.nav-btn:hover { background: var(--parchment); border-color: var(--gold); }
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.nav-btn:disabled:hover { background: #fff; border-color: var(--border-light); }
.nav-btn svg { width: 16px; height: 16px; }
.nav-current {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    color: var(--text-mid);
    font-weight: 600;
}

/* --- Verse Popover --- */
.verse-popover {
    position: fixed;
    z-index: 150;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    max-width: 380px;
    display: none;
    animation: popoverIn 0.15s ease;
    overflow-y: auto;
}
.verse-popover.active { display: block; }

@keyframes popoverIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.popover-ref {
    font-weight: 700;
    color: var(--navy);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.popover-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.popover-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.popover-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text-dark);
}
.popover-btn:hover { background: var(--parchment); border-color: var(--gold); }
.popover-btn svg { width: 15px; height: 15px; }
.popover-wa {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}
.popover-wa:hover { background: #1ebe57; border-color: #1ebe57; }
.popover-wa svg { width: 15px; height: 15px; }

/* --- Multi-select mode --- */
.verse.multi-selected {
    background: var(--verse-active);
    border-radius: 3px;
}

/* Subtle left accent on multi-selected verse */
.verse.multi-selected::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 2px;
    bottom: 2px;
    width: 3px;
    background: var(--gold);
    border-radius: 2px;
}

/* Change cursor in multi-select mode */
.multiselect-active .verse {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Multi-select floating toolbar */
.multiselect-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--navy);
    color: #fff;
    padding: 10px 20px;
    border-radius: 14px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.3);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    font-size: 0.88rem;
    font-family: inherit;
}
.multiselect-toolbar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.multiselect-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
}
.multiselect-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--gold);
    color: var(--navy);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.82rem;
}

.multiselect-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.multiselect-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    color: #fff;
}
.multiselect-btn:hover {
    background: rgba(255,255,255,0.2);
}
.multiselect-btn svg { flex-shrink: 0; }

.multiselect-wa {
    background: #25D366;
    border-color: #25D366;
}
.multiselect-wa:hover { background: #1ebe57; }

.multiselect-cancel {
    border: none;
    background: rgba(255,255,255,0.08);
    padding: 7px 8px;
}
.multiselect-cancel:hover { background: rgba(255,77,77,0.3); }

@media (max-width: 768px) {
    .multiselect-toolbar {
        bottom: 16px;
        left: 12px;
        right: 12px;
        transform: translateX(0) translateY(100px);
        border-radius: 14px;
        padding: 10px 14px;
        gap: 10px;
    }
    .multiselect-toolbar.active {
        transform: translateX(0) translateY(0);
    }
    .multiselect-btn {
        padding: 7px 10px;
        font-size: 0.78rem;
    }
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--navy);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Verse of the Day Widget --- */
.votd-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 800;
}
.votd-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.votd-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.votd-fab svg { stroke: #fff; }

.votd-popup {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    animation: votdSlideUp 0.25s ease;
}
.votd-popup.open { display: block; }
@keyframes votdSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.votd-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--navy);
    color: #fff;
}
.votd-popup-title {
    font-weight: 600;
    font-size: 0.95rem;
}
.votd-popup-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    transition: color 0.15s;
}
.votd-popup-close:hover { color: #fff; }
.votd-text {
    margin: 0;
    padding: 20px 18px 12px;
    font-family: 'Lora', serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-dark);
    border-left: 3px solid var(--gold);
    margin-left: 18px;
    margin-top: 16px;
    margin-bottom: 0;
    padding-left: 14px;
    padding-top: 0;
    padding-bottom: 0;
    font-style: italic;
}
.votd-ref {
    padding: 10px 18px 4px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--navy);
    text-align: right;
}
.votd-actions {
    display: flex;
    gap: 6px;
    padding: 10px 18px 16px;
    justify-content: flex-end;
}
.votd-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #e0dcd3;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-mid);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.votd-action-btn:hover {
    border-color: var(--navy);
    color: var(--navy);
    background: rgba(26,54,93,0.05);
}
.votd-share { color: #25D366; }
.votd-share:hover { border-color: #25D366; background: rgba(37,211,102,0.06); color: #1ebe57; }
.votd-read { color: var(--gold); }
.votd-read:hover { border-color: var(--gold); background: rgba(201,168,76,0.08); }

@media (max-width: 480px) {
    .votd-popup { width: calc(100vw - 32px); right: -8px; }
    .votd-widget { bottom: 16px; right: 16px; }
}

/* --- Font Size Controls --- */
.font-size-controls {
    display: flex;
    gap: 2px;
}

    .font-btn {
        background: none;
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 4px;
        color: #fff;
        font-size: 0.95rem;
        font-weight: 700;
        padding: 8px 16px;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s;
        font-family: inherit;
        line-height: 1.2;
        min-width: 44px;
        min-height: 44px;
    }
    .font-btn:hover {
        background: rgba(255,255,255,0.12);
        border-color: rgba(255,255,255,0.4);
    }

    @media (max-width: 600px) {
        .font-size-controls {
            gap: 8px;
        }
        .font-btn {
            font-size: 1.15rem;
            padding: 12px 20px;
            min-width: 48px;
            min-height: 48px;
            border-radius: 8px;
        }
    }

/* Font size body classes */
body.font-sm .page-text { font-size: 0.85rem; }
body.font-md .page-text { font-size: 1rem; }
body.font-lg .page-text { font-size: 1.15rem; }
body.font-xl .page-text { font-size: 1.32rem; }
body.font-sm .verse-num { font-size: 0.55em; }
body.font-lg .verse-num { font-size: 0.6em; }
body.font-xl .verse-num { font-size: 0.62em; }

/* --- Verse Highlight Colors --- */
.verse.hl-yellow { background: rgba(255, 245, 157, 0.45); border-radius: 2px; }
.verse.hl-green  { background: rgba(165, 214, 167, 0.4); border-radius: 2px; }
.verse.hl-blue   { background: rgba(144, 202, 249, 0.35); border-radius: 2px; }
.verse.hl-pink   { background: rgba(244, 143, 177, 0.3); border-radius: 2px; }

/* --- Highlight Picker (in popover) --- */
.popover-highlight-wrap {
    position: relative;
}
.popover-highlight-toggle svg,
.popover-bookmark svg {
    width: 18px;
    height: 18px;
}
.popover-bookmark.bookmarked svg {
    fill: var(--gold);
    stroke: var(--gold);
}
.highlight-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0dcd3;
    border-radius: 8px;
    padding: 6px 8px;
    gap: 5px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    z-index: 1100;
    flex-direction: row;
    margin-bottom: 6px;
}
.highlight-picker.open { display: flex; }
.hl-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    font-size: 0;
    line-height: 0;
}
.hl-color:hover {
    transform: scale(1.2);
    border-color: var(--navy);
}
.hl-clear {
    background: #f5f5f5 !important;
    font-size: 11px;
    line-height: 24px;
    color: var(--text-mid);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Bookmarks Panel (sidebar) --- */
.bookmarks-section {
    border-top: 1px solid var(--border-light);
}
.bookmarks-list {
    max-height: 260px;
    overflow-y: auto;
}
.bookmarks-empty {
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 8px 0;
    line-height: 1.5;
}
.bookmark-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
}
.bookmark-item:hover { background: var(--verse-hover); }
.bookmark-ref {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--navy);
    flex: 1;
}
.bookmark-preview {
    width: 100%;
    font-size: 0.76rem;
    color: var(--text-light);
    line-height: 1.4;
}
.bookmark-remove {
    position: absolute;
    top: 6px;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.bookmark-item:hover .bookmark-remove { opacity: 1; }
.bookmark-remove:hover { color: #e53935; }
.bookmarks-clear-btn {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid #e0dcd3;
    border-radius: 5px;
    padding: 6px;
    font-size: 0.76rem;
    color: var(--text-light);
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}
.bookmarks-clear-btn:hover {
    color: #e53935;
    border-color: #e53935;
}

/* --- Dark Mode --- */
body.dark-mode {
    background: #181c24;
    color: #d4cfc5;
}
body.dark-mode .bible-header {
    background: linear-gradient(135deg, #0e1520, #162035) !important;
}
body.dark-mode .bible-sidebar {
    background: #1a1e28;
    border-color: #2a2e38;
}
body.dark-mode .bible-page {
    background: #1e2230;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
body.dark-mode .bible-page::before,
body.dark-mode .bible-page::after {
    display: none;
}
body.dark-mode .page-text {
    color: #cdc7b8;
}
body.dark-mode .chapter-header {
    color: #b8b0a0;
}
body.dark-mode .chapter-book { color: var(--gold-light); }
body.dark-mode .chapter-number-display { color: #9a9488; }
body.dark-mode .verse-num { color: var(--gold); }
body.dark-mode .verse:hover {
    background: rgba(201, 168, 76, 0.08);
}
body.dark-mode .verse.selected {
    background: rgba(201, 168, 76, 0.15);
}
body.dark-mode .verse.hl-yellow { background: rgba(255, 245, 157, 0.18); }
body.dark-mode .verse.hl-green  { background: rgba(165, 214, 167, 0.15); }
body.dark-mode .verse.hl-blue   { background: rgba(144, 202, 249, 0.15); }
body.dark-mode .verse.hl-pink   { background: rgba(244, 143, 177, 0.15); }
body.dark-mode .chapter-controls {
    background: #1a1e28;
    border-color: #2a2e38;
}
body.dark-mode .chapter-controls select,
body.dark-mode .chapter-controls .go-btn {
    background: #262b38;
    color: #cdc7b8;
    border-color: #3a3e48;
}
body.dark-mode .chapter-nav {
    background: #1a1e28;
    border-color: #2a2e38;
}
body.dark-mode .nav-btn {
    color: #b8b0a0;
}
body.dark-mode .nav-btn:hover {
    background: rgba(255,255,255,0.06);
}
body.dark-mode .verse-popover {
    background: #252a36;
    border-color: #3a3e48;
    color: #cdc7b8;
}
body.dark-mode .popover-ref { color: var(--gold-light); }
body.dark-mode .popover-text { color: #b0a998; }
body.dark-mode .popover-btn {
    border-color: #3a3e48;
    color: #b8b0a0;
}
body.dark-mode .popover-btn:hover {
    background: rgba(255,255,255,0.06);
    border-color: #5a5e68;
}
body.dark-mode .search-overlay-inner {
    background: #1e2230;
}
body.dark-mode .search-results {
    background: #252a36;
}
body.dark-mode .search-result-item {
    border-color: #2a2e38;
}
body.dark-mode .search-result-item:hover {
    background: rgba(255,255,255,0.04);
}
body.dark-mode .search-result-ref { color: var(--gold-light); }
body.dark-mode .search-result-text { color: #b0a998; }
body.dark-mode #searchInput {
    background: #262b38;
    color: #cdc7b8;
    border-color: #3a3e48;
}
body.dark-mode .highlight-picker {
    background: #252a36;
    border-color: #3a3e48;
}
body.dark-mode .toast {
    background: var(--gold);
    color: #1a1e28;
}
body.dark-mode .sidebar-heading { color: var(--gold-light); }
body.dark-mode .book-btn {
    color: #b8b0a0;
    border-color: #2a2e38;
}
body.dark-mode .book-btn:hover,
body.dark-mode .book-btn.active {
    background: rgba(201,168,76,0.12);
    color: var(--gold-light);
}
body.dark-mode .testament-toggle {
    color: #b8b0a0;
    border-color: #2a2e38;
}
body.dark-mode .concordance-input-wrap input {
    background: #262b38;
    color: #cdc7b8;
    border-color: #3a3e48;
}
body.dark-mode .concordance-input-wrap button {
    color: #b8b0a0;
}
body.dark-mode .bookmark-ref { color: var(--gold-light); }
body.dark-mode .bookmark-preview { color: #8a8478; }
body.dark-mode .bookmark-item { border-color: #2a2e38; }
body.dark-mode .bookmarks-clear-btn {
    border-color: #3a3e48;
    color: #8a8478;
}
body.dark-mode .bible-welcome {
    color: #b8b0a0;
}
body.dark-mode .welcome-verse { color: #9a9488; }
body.dark-mode .votd-popup {
    background: #252a36;
}
body.dark-mode .votd-text { color: #cdc7b8; }
body.dark-mode .votd-ref { color: var(--gold-light); }
body.dark-mode .votd-action-btn {
    border-color: #3a3e48;
    color: #b8b0a0;
}
body.dark-mode .multiselect-toolbar {
    background: #252a36;
}
body.dark-mode .drop-cap { color: var(--gold); }
body.dark-mode .copy-all-bar {
    background: #1e2230;
    border-color: #2a2e38;
}
body.dark-mode .copy-all-btn {
    background: #262b38;
    border-color: #3a3e48;
    color: #b8b0a0;
}
body.dark-mode .compare-col {
    background: rgba(201,168,76,0.06);
    border-left-color: var(--gold);
}
body.dark-mode .compare-col-other {
    background: rgba(26,54,93,0.15);
    border-left-color: #4a7ab5;
}
body.dark-mode .search-summary-bar {
    background: #1e2230 !important;
}

    border-left-color: #4a7ab5;
}
body.dark-mode .search-summary-bar {
    background: #1e2230 !important;
}

/* --- Study Place --- */

/* FAB button */
.study-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
.study-fab:hover {
    transform: scale(1.08);
    background: #244a7a;
}

/* Overlay */
.study-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #f0ece4;
    display: none;
    flex-direction: column;
}
.study-overlay.open { display: flex; }
.study-overlay.fullscreen { z-index: 2500; }

/* Header */
.study-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    overflow-x: auto;
}
.study-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.study-title-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    color: var(--navy);
    margin: 0;
    white-space: nowrap;
}
.study-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.study-header-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.study-header-btn:hover { background: var(--parchment); border-color: var(--gold); }
.study-export-btn { color: var(--navy); }
.study-new-btn { color: #b44; }

/* Toolbar */
.study-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.study-tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.12s;
}
.study-tool-btn:hover { background: #e8e4db; }
.study-tool-btn.active { background: #d5d0c6; border-color: var(--border-light); }
.study-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}
.study-heading-select {
    padding: 4px 8px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: #fff;
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* Body & Pages */
.study-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
}
.study-pages {
    width: 100%;
    max-width: 816px; /* ~8.5in */
}
.study-page {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    padding: 60px 72px;
    min-height: 1056px; /* ~11in */
    margin-bottom: 24px;
    position: relative;
}
.study-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    padding: 0 0 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    background: transparent;
}
.study-title-input::placeholder { color: #bbb; }
.study-editor {
    outline: none;
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
    min-height: 400px;
    word-wrap: break-word;
}
.study-editor:empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
}
.study-editor h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: var(--navy);
    margin: 20px 0 10px;
}
.study-editor h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    color: var(--navy);
    margin: 16px 0 8px;
}
.study-editor h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 14px 0 6px;
}
.study-editor ul, .study-editor ol {
    margin: 8px 0;
    padding-left: 24px;
}

/* Verse block inserted from "Send to Study" */
.study-verse-block {
    background: var(--parchment);
    border-left: 3px solid var(--gold);
    padding: 12px 16px;
    margin: 14px 0;
    border-radius: 0 6px 6px 0;
    font-family: 'Lora', Georgia, serif;
}
.study-verse-ref {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--navy);
    margin-bottom: 4px;
}
.study-verse-text {
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-mid);
}
.study-verse-comment {
    margin-top: 8px;
    font-style: normal;
    font-size: 0.88rem;
    color: var(--text-dark);
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 6px;
}

/* Status bar */
.study-status-bar {
    display: flex;
    justify-content: space-between;
    padding: 6px 16px;
    font-size: 0.72rem;
    color: var(--text-light);
    background: #fff;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Send to Study dialog */
.study-send-dialog {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}
.study-send-dialog.open { display: flex; }
.study-send-dialog-inner {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    animation: popoverIn 0.15s ease;
}
.study-send-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.study-send-dialog-header h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--navy);
    margin: 0;
}
.study-send-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-mid);
    padding: 4px;
}
.study-send-verse {
    background: var(--parchment);
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-mid);
    margin-bottom: 14px;
}
.study-send-comment {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.study-send-comment:focus { border-color: var(--gold); }
.study-send-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
.study-send-cancel {
    padding: 8px 18px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-mid);
    transition: background 0.15s;
}
.study-send-cancel:hover { background: #f5f5f5; }
.study-send-confirm {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: var(--navy);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.study-send-confirm:hover { background: #244a7a; }

/* Popover study button */
.popover-study {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.popover-study:hover { background: #244a7a; border-color: #244a7a; }
.popover-study svg { width: 15px; height: 15px; }

/* Search result study button */
.search-study-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--navy);
    padding: 4px;
    border-radius: 4px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
}
.search-study-btn:hover { background: rgba(26,54,93,0.1); }

/* Dark mode study */
body.dark-mode .study-overlay { background: #1a1d2e; }
body.dark-mode .study-header { background: #23263a; border-bottom-color: #333; }
body.dark-mode .study-title-label { color: #90caf9; }
body.dark-mode .study-header-btn { background: #2a2d42; color: #ccc; border-color: #444; }
body.dark-mode .study-header-btn:hover { background: #35394f; border-color: #666; }
body.dark-mode .study-tool-btn { color: #ccc; }
body.dark-mode .study-tool-btn:hover { background: #35394f; }
body.dark-mode .study-tool-btn.active { background: #40446b; border-color: #555; }
body.dark-mode .study-heading-select { background: #2a2d42; color: #ccc; border-color: #444; }
body.dark-mode .study-page { background: #23263a; border-color: #333; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
body.dark-mode .study-title-input { color: #90caf9; border-bottom-color: #444; }
body.dark-mode .study-title-input::placeholder { color: #555; }
body.dark-mode .study-editor { color: #d0d0d0; }
body.dark-mode .study-editor:empty::before { color: #555; }
body.dark-mode .study-editor h1, body.dark-mode .study-editor h2 { color: #90caf9; }
body.dark-mode .study-verse-block { background: #2a2d42; border-left-color: #c9a84c; }
body.dark-mode .study-verse-ref { color: #90caf9; }
body.dark-mode .study-verse-text { color: #aaa; }
body.dark-mode .study-verse-comment { color: #ccc; border-top-color: #444; }
body.dark-mode .study-status-bar { background: #23263a; border-top-color: #333; color: #666; }
body.dark-mode .study-send-dialog-inner { background: #23263a; }
body.dark-mode .study-send-dialog-header h3 { color: #90caf9; }
body.dark-mode .study-send-verse { background: #2a2d42; color: #aaa; }
body.dark-mode .study-send-comment { background: #1a1d2e; color: #ccc; border-color: #444; }
body.dark-mode .study-send-cancel { background: #2a2d42; color: #aaa; border-color: #444; }
body.dark-mode .study-fab { background: #2a3f6a; }

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .page-text {
        column-count: 1;
        padding: 16px 36px 40px;
    }
    .chapter-header { padding: 30px 36px 16px; }
    .bible-main { padding: 20px 16px; }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 280px;
        --header-h: 56px;
    }

    .header-title h1 { font-size: 1.1rem; }
    .header-version { display: none; }
    .header-brand { display: none; }
    .font-size-controls { gap: 1px; }
    .font-btn { font-size: 0.65rem; padding: 2px 5px; }

    /* Sidebar slides in from left on mobile */
    .bible-sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        height: calc(100vh - var(--header-h));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
        z-index: 50;
    }
    .bible-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar-toggle { display: flex !important; }

    .page-text {
        column-count: 1;
        padding: 16px 20px 36px;
        font-size: 1rem;
        line-height: 1.8;
    }
    .chapter-header { padding: 24px 20px 12px; }
    .chapter-book { font-size: 1.4rem; }
    .chapter-number-display { font-size: 0.9rem; }

    .bible-main { padding: 16px 10px; }

    .controls-inner { flex-wrap: wrap; }
    #bookSelect { flex: 1 1 100%; }
    #chapterSelect { flex: 1; }
    .go-btn { flex: 0 0 auto; }

    .chapter-nav { padding: 10px 0; }
    .nav-btn { padding: 8px 14px; font-size: 0.82rem; }

    /* Popover at bottom on mobile */
    .verse-popover {
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-width: none;
        border-radius: 14px 14px 0 0;
        padding: 18px 20px 24px;
    }
    .highlight-picker {
        bottom: auto;
        top: -40px;
    }

    /* Study place mobile */
    .study-header { flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
    .study-toolbar { order: 3; width: 100%; justify-content: center; padding-top: 4px; border-top: 1px solid var(--border-light); }
    .study-page { padding: 30px 24px; min-height: auto; }
    .study-title-input { font-size: 1.2rem; }
    .study-header-btn { padding: 5px 7px; font-size: 0.7rem; }
    .study-export-btn span { display: none; }
    .study-fab { bottom: 75px; right: 14px; width: 44px; height: 44px; }
}

/* Desktop: hide sidebar toggle */
@media (min-width: 769px) {
    .sidebar-toggle { display: none !important; }
}

/* Small phone */
@media (max-width: 400px) {
    .page-text { padding: 12px 16px 30px; font-size: 0.95rem; }
    .chapter-header { padding: 20px 16px 10px; }
    .chapter-book { font-size: 1.2rem; }
    .verse-num { font-size: 0.55em; }
}

/* Copyright footer */
.bible-copyright {
    text-align: center;
    padding: 16px 12px;
    font-size: 0.72rem;
    color: var(--text-light);
    letter-spacing: 0.3px;
    opacity: 0.6;
}
.bible-copyright p { margin: 0; }
body.dark-mode .bible-copyright { color: #7a7568; }

/* --- Backup & Restore Section --- */
.backup-section, .readingplan-section {
    border-top: 1px solid var(--border-light);
}
.backup-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 10px;
}
.backup-actions, .backup-drive-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.backup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border-light);
    background: var(--parchment);
    color: var(--navy);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.backup-btn:hover {
    background: var(--parchment-dark);
    border-color: var(--gold);
}
.backup-drive-btn {
    background: #e8f0fe;
    border-color: #c2d7f5;
}
.backup-drive-btn:hover {
    background: #d2e3fc;
    border-color: #4285f4;
}
.backup-drive-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Drive connection status */
.drive-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.drive-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #bbb;
    flex-shrink: 0;
    transition: background 0.3s;
}
.drive-dot.connected {
    background: #34a853;
    box-shadow: 0 0 6px rgba(52, 168, 83, 0.5);
}
.drive-status-text {
    font-size: 0.78rem;
    color: var(--text-light);
    flex: 1;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drive-login-btn, .drive-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.drive-login-btn {
    background: #4285f4;
    color: #fff;
    border-color: #3367d6;
}
.drive-login-btn:hover { background: #3367d6; }
.drive-logout-btn {
    background: var(--parchment);
    color: var(--text-light);
}
.drive-logout-btn:hover { background: var(--parchment-dark); }
body.dark-mode .backup-desc { color: #9a9488; }
body.dark-mode .backup-btn { background: #252838; border-color: #3a3d50; color: #cdc7b8; }
body.dark-mode .backup-btn:hover { background: #30334a; border-color: var(--gold); }
body.dark-mode .backup-drive-btn { background: #1e2a44; border-color: #304a7a; }
body.dark-mode .backup-drive-btn:hover { background: #253358; border-color: #5a9cf5; }
body.dark-mode .drive-status { background: rgba(255,255,255,0.04); }
body.dark-mode .drive-status-text { color: #9a9488; }
body.dark-mode .drive-logout-btn { background: #252838; color: #9a9488; border-color: #3a3d50; }

/* --- Reading Plan Overlay --- */
.rp-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #f0ece4;
    display: none;
    flex-direction: column;
}
.rp-overlay.open { display: flex; }
.rp-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.rp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.rp-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.rp-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.rp-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
/* Generator form */
.rp-form {
    max-width: 440px;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.rp-form-row {
    margin-bottom: 18px;
}
.rp-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--navy);
    margin-bottom: 6px;
}
.rp-label-inline {
    font-size: 0.85rem;
    color: var(--text-light);
}
.rp-duration-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rp-input {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--navy);
    background: var(--parchment);
    width: 80px;
}
.rp-date-input { width: 180px; }
.rp-input:focus {
    outline: none;
    border-color: var(--gold);
}
.rp-scope-options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.rp-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--navy);
    cursor: pointer;
}
.rp-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
}
.rp-generate-btn:hover { background: #243b6a; }

/* Plan result */
.rp-result {
    max-width: 700px;
    margin: 0 auto;
}
.rp-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.rp-result-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--navy);
    margin: 0;
}
.rp-reset-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--navy);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.rp-reset-btn:hover { background: var(--parchment-dark); }

.rp-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.rp-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.85rem;
}
.rp-table thead th {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}
.rp-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: var(--navy);
}
.rp-table tbody tr:nth-child(even) { background: var(--parchment); }
.rp-table tbody tr:hover { background: rgba(201,168,76,0.08); }
.rp-td-day { width: 50px; font-weight: 600; color: var(--gold-dark, #8a7230); }
.rp-td-date { width: 120px; white-space: nowrap; }
.rp-td-reading { min-width: 200px; }
.rp-td-check { width: 40px; text-align: center; }
.rp-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--gold);
}
tr.rp-done td { opacity: 0.5; text-decoration: line-through; }
tr.rp-done .rp-td-check { opacity: 1; text-decoration: none; }

/* Dark mode reading plan */
body.dark-mode .rp-overlay { background: #1a1d2e; }
body.dark-mode .rp-header { background: #252838; border-color: #3a3d50; }
body.dark-mode .rp-form { background: #252838; box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
body.dark-mode .rp-label, body.dark-mode .rp-result-title { color: var(--gold-light); }
body.dark-mode .rp-input { background: #1e2230; border-color: #3a3d50; color: #cdc7b8; }
body.dark-mode .rp-radio { color: #cdc7b8; }
body.dark-mode .rp-table { background: #252838; }
body.dark-mode .rp-table thead th { background: #1a365d; }
body.dark-mode .rp-table tbody td { border-color: #3a3d50; color: #cdc7b8; }
body.dark-mode .rp-table tbody tr:nth-child(even) { background: #1e2230; }
body.dark-mode .rp-table tbody tr:hover { background: rgba(201,168,76,0.1); }
body.dark-mode .rp-reset-btn { background: #1e2230; border-color: #3a3d50; color: #cdc7b8; }
body.dark-mode .rp-generate-btn { background: #2d4a8a; }

/* Reading plan responsive */
@media (max-width: 768px) {
    .rp-body { padding: 16px 12px; }
    .rp-form { padding: 20px 16px; }
    .rp-header { flex-wrap: wrap; padding: 6px 10px; }
    .rp-header-right { flex-wrap: wrap; }
}

/* Print styles */
@media print {
    .bible-header, .bible-sidebar, .chapter-controls, .chapter-nav,
    .verse-popover, .search-overlay, .toast, .study-fab,
    .study-header, .study-status-bar, .rp-overlay { display: none !important; }
    .bible-main { padding: 0; max-width: 100%; }
    .bible-page {
        box-shadow: none;
        border: none;
    }
    .page-text {
        column-count: 2;
        font-size: 10pt;
        line-height: 1.6;
    }
    /* Study print */
    .study-overlay.open {
        position: static;
        display: block !important;
        background: #fff;
    }
    .study-body { padding: 0; overflow: visible; }
    .study-page {
        box-shadow: none;
        border: none;
        padding: 0;
        min-height: auto;
        page-break-after: always;
    }
    .study-verse-block {
        break-inside: avoid;
    }
}
