/* Bible Study Site — Shared Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #faf8f5;
    --bg-secondary: #f5f0e8;
    --bg-sidebar: #ece5da;
    --bg-card: #ffffff;
    --text-primary: #2c2420;
    --text-secondary: #3d342e;
    --text-muted: #5c5248;
    --accent-gold: #8b6914;
    --accent-gold-light: #c49a2a;
    --accent-brown: #6b4c3b;
    --border-light: #e8e0d6;
    --border-medium: #d4c9bc;
    --shadow-sm: 0 1px 3px rgba(44,36,32,0.06);
    --shadow-md: 0 4px 12px rgba(44,36,32,0.08);
    --shadow-lg: 0 8px 24px rgba(44,36,32,0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --sidebar-width: 260px;
    --right-panel-width: 280px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* TOP NAV BAR */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-brown);
    text-decoration: none;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.nav-book-select, .nav-chapter-select {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    padding: 6px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.nav-translation {
    font-size: 0.85rem;
    padding: 7px 14px;
    border: 2px solid #8b3a2a;
    border-radius: var(--radius-sm);
    background: #8b3a2a;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.nav-home-btn {
    display: none;
    font-size: 1.1rem;
    color: var(--accent-brown);
    padding: 8px;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-home-btn:hover {
    color: var(--accent-gold);
}

.sidebar-home {
    font-weight: 600;
    color: var(--accent-brown);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

/* LEFT SIDEBAR */
.left-sidebar {
    position: fixed;
    top: 56px; left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 56px);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    padding: 16px 0;
    z-index: 900;
    transition: transform 0.3s ease;
}

.sidebar-section { margin-bottom: 8px; }

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 20px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: #efe8dc;
    color: var(--accent-brown);
    font-weight: 500;
    border-right: 3px solid var(--accent-gold);
}

.sidebar-item i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-gold-light);
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px 20px;
}

.chapter-btn {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid #d4c4a8;
    border-radius: var(--radius-sm);
    background: #faf5ed;
    color: var(--accent-brown);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-weight: 500;
}

.chapter-btn:hover { background: #f0e4d4; color: var(--text-primary); border-color: #c9a96e; }
.chapter-btn.active {
    background: #8b3a2a;
    color: #faf5ed;
    border-color: #8b3a2a;
    font-weight: 700;
}

/* RIGHT PANEL */
.right-panel {
    position: fixed;
    top: 56px; right: 0;
    width: var(--right-panel-width);
    height: calc(100vh - 56px);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-light);
    overflow-y: auto;
    padding: 16px;
    z-index: 900;
    transition: transform 0.3s ease;
}

.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    text-decoration: none;
    display: block;
}

.topic-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.topic-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.topic-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.topic-card-icon {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--accent-gold-light);
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    margin-top: 56px;
    padding: 32px 40px;
    max-width: 100%;
}

.book-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.book-header h1 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-brown);
    margin-bottom: 4px;
}

.book-header .subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* SCRIPTURE */
.scripture-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
    color: #8b3a2a;
}

.verse {
    font-family: 'Merriweather', serif;
    font-size: 1.05rem;
    line-height: 2;
    color: inherit;
    margin-bottom: 4px;
}

.verse-num {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-gold);
    vertical-align: super;
    margin-right: 4px;
}

/* STUDY NOTES TABS */
.study-section { margin-top: 32px; }

.study-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.study-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7a6b5f;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    transition: color 0.2s, background 0.2s;
    border-radius: var(--radius-sm);
    flex: 1 1 auto;
    text-align: center;
}

.study-tab:hover { color: #3d2b1f; background: var(--bg-secondary); border-color: var(--border-medium); }
.study-tab.active {
    color: #fff;
    background: #8b3a2a;
    border-color: #8b3a2a;
}

.tab-content {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
}

.tab-content.active { display: block; }

.tab-content h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--accent-brown);
    margin-bottom: 16px;
}

.tab-content p, .tab-content li {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.tab-content ul { padding-left: 20px; list-style: none; }
.tab-content li::before { content: "✦ "; color: var(--accent-gold-light); }
.tab-content a { color: var(--accent-brown); text-decoration: underline; text-decoration-color: var(--border-medium); }
.tab-content a:hover { color: var(--accent-gold); }

.video-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.video-card:hover { box-shadow: var(--shadow-md); }

.video-card-icon {
    width: 44px; height: 44px;
    background: #fee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-card-icon i { color: #c0392b; font-size: 1.1rem; }

.video-card-info h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.video-card-info p { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* KEY VERSE HIGHLIGHT */
.key-verse {
    background: linear-gradient(135deg, #fdf8ee, #faf3e0);
    border-left: 3px solid var(--accent-gold);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 12px;
}

.key-verse .ref { font-weight: 600; color: var(--accent-brown); font-size: 0.82rem; }
.key-verse .text { font-family: 'Merriweather', serif; font-size: 0.9rem; font-style: italic; color: var(--text-primary); margin-top: 4px; }

/* MOBILE RESPONSIVE */
@media (max-width: 1024px) {
    .main-content { max-width: 900px; }
}

@media (max-width: 768px) {
    .left-sidebar { transform: translateX(-100%); }
    .left-sidebar.open { transform: translateX(0); }
    .right-panel { display: none; }
    .main-content { margin-left: 0; margin-right: 0; padding: 20px 16px; }
    .hamburger { display: block; }
    .nav-home-btn { display: block; }
    .nav-brand { display: none; }
    .top-nav { padding: 0 10px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
    .nav-center { gap: 4px; justify-content: flex-start; flex-wrap: wrap; }
    .nav-book-select, .nav-chapter-select { font-size: 0.8rem; padding: 5px 6px; max-width: 110px; }
    .nav-translation { font-size: 0.75rem; padding: 5px 8px; }
    .scripture-container { padding: 20px 18px; }
    .verse { font-size: 0.95rem; line-height: 1.85; }
    .book-header h1 { font-size: 1.5rem; }
    .study-tabs { gap: 4px; }
    .study-tab { padding: 8px 10px; font-size: 0.75rem; }
    .tab-content { padding: 20px 18px; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 850;
}

.sidebar-overlay.show { display: block; }

/* TRANSLATION SWITCHER */
.translation-block { display: none; }
.translation-block.active { display: block; }

/* TRANSLATION INFO POPUP */
.trans-info-btn {
    background: none;
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.trans-info-btn:hover { background: var(--accent-brown); color: #fff; border-color: var(--accent-brown); }

.trans-popup {
    display: none;
    position: fixed;
    top: 60px;
    right: 20px;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    z-index: 2000;
    font-size: 0.82rem;
    line-height: 1.6;
}
.trans-popup.show { display: block; }
.trans-popup h4 { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--accent-brown); margin-bottom: 12px; }
.trans-popup .trans-item { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-light); }
.trans-popup .trans-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.trans-popup .trans-name { font-weight: 700; color: var(--text-primary); }
.trans-popup .trans-desc { color: var(--text-muted); font-size: 0.78rem; }
.trans-popup .close-btn { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; }
@media (max-width: 768px) { .trans-popup { width: calc(100% - 40px); right: 20px; } }

/* AUTHORSHIP & BACKGROUND — Enhanced styling */
.auth-item {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-left: 12px;
    border-left: 3px solid transparent;
}

.auth-label {
    font-weight: 700;
    color: #8b3a2a;
    font-size: 0.95rem;
}

.auth-sublist {
    list-style: none;
    padding-left: 16px;
    margin: 8px 0 14px;
    border-left: 3px solid var(--accent-gold-light);
}

.auth-sublist li {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 4px 0 4px 12px;
    position: relative;
}

.auth-sublist li::before {
    content: ">";
    color: var(--accent-gold);
    font-weight: 700;
    position: absolute;
    left: -4px;
}


/* ===== PWA APP MODE — Bottom Navigation (standalone only) ===== */
@media all and (display-mode: standalone) {
    body {
        padding-bottom: 64px;
    }
    .hamburger { display: none !important; }
}

/* Also support JS-detected standalone via body class */
body.pwa-standalone {
    padding-bottom: 64px;
}
body.pwa-standalone .hamburger { display: none !important; }

.pwa-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    border-top: 1px solid #e0d6c8;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 9999;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.pwa-standalone .pwa-bottom-nav {
    display: flex;
}

.pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    min-width: 60px;
}

.pwa-nav-item i {
    font-size: 1.2rem;
    color: #8a7e74;
    margin-bottom: 3px;
    transition: color 0.15s;
}

.pwa-nav-item span {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: #8a7e74;
    transition: color 0.15s;
}

.pwa-nav-item.active i,
.pwa-nav-item.active span {
    color: #8b3a2a;
}

.pwa-nav-item:hover i,
.pwa-nav-item:hover span {
    color: #6b4c3b;
}


/* ===== PWA Splash Screen ===== */
.pwa-splash {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #1a1410 0%, #2a1f14 20%, #3d2b1f 50%, #6b5040 75%, #d4bea0 92%, #faf5ed 100%);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 32px;
    text-align: center;
    opacity: 1;
    transition: opacity 0.6s ease;
}
body.pwa-standalone .pwa-splash {
    display: flex;
}
.pwa-splash.fade-out {
    opacity: 0;
    pointer-events: none;
}
.pwa-splash .splash-icon {
    font-size: 2.4rem;
    color: #f0c865;
    margin-bottom: 20px;
}
.pwa-splash .splash-label {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: #c9a96e;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.pwa-splash .splash-prayer {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    line-height: 2;
    color: #f0e4d4;
    font-style: italic;
    max-width: 600px;
    font-weight: 500;
}
.pwa-splash .splash-tap {
    margin-top: 32px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: #8a7e74;
    letter-spacing: 1px;
}

/* ===== PWA Info Button & Popup ===== */
.pwa-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #f0c865;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}
.pwa-info-btn:hover {
    background: rgba(255,255,255,0.3);
}

.pwa-info-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    padding: 24px 24px 28px;
    max-width: 360px;
    width: 90%;
    max-height: 75vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    z-index: 10000;
}
.pwa-info-popup.show {
    display: block;
}
.pwa-info-popup h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #6b4c3b;
    margin-bottom: 12px;
}
.pwa-info-item {
    font-size: 0.82rem;
    line-height: 1.6;
    color: #3d342e;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0e8e0;
}
.pwa-info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.pwa-info-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #8a7e74;
    cursor: pointer;
}


/* ===== Collapsible Video Toggle ===== */
.video-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 10px 14px;
    background: #faf5ed;
    border: 1px solid #e0d6c8;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b4c3b;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.video-toggle-btn:hover {
    background: #f0e4d4;
}
.video-toggle-btn i {
    color: #c0392b;
    font-size: 1rem;
}
.video-toggle-btn.open {
    background: #f0e4d4;
    border-color: #c9a96e;
}

/* ===== Shared full-bleed section hero (used on index.html and standalone
   topic-index pages like topical-studies.html / life-studies.html, so the
   PWA bottom-nav tabs render a consistent hero style) ===== */
.section-hero { position: relative; width: 100%; min-height: 280px; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-top: 0; }
.section-hero img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(0.45) sepia(0.75) saturate(1.7); }
.section-hero-overlay { position: relative; z-index: 1; text-align: center; padding: 40px 28px; max-width: 800px; }
.section-hero-overlay h2 { font-family: "Cinzel", serif; font-size: 2.4rem; color: #fff; text-shadow: 2px 2px 10px rgba(0,0,0,0.8); margin-bottom: 12px; letter-spacing: 2px; }
.section-hero-overlay .section-subtitle { font-family: "Merriweather", serif; font-size: 1rem; color: #f0c865; font-style: italic; text-shadow: 1px 1px 4px rgba(0,0,0,0.6); margin-bottom: 16px; }
.section-hero-overlay .section-desc { font-family: "Cormorant Garamond", serif; font-size: 1.1rem; line-height: 1.9; color: #f5ebe0; font-style: italic; text-shadow: 1px 1px 6px rgba(0,0,0,0.7); }
@media (max-width: 768px) {
    .section-hero { min-height: 220px; }
    .section-hero-overlay h2 { font-size: 1.6rem; }
}

/* In the installed app (PWA standalone), the bottom-nav tabs show
   exactly one section-hero at a time as the very first thing on the
   page (index.html's own inline .section-hero rule hardcodes
   margin-top:48px, correct for the normal stacked homepage scroll,
   wrong here since there's nothing above it once hero-section/
   prayer-section are hidden). This selector is more specific than
   that inline rule, so it wins regardless of source order. */
body.pwa-standalone .section-hero { margin-top: 0; }

/* ===== PWA Bible tab: compact passage navigator (replaces the full
   66-book grid in the installed app) ===== */
.pwa-bible-nav { display: none; max-width: 480px; margin: 32px auto 0; padding: 28px 24px 32px; background: #fff; border: 1px solid #e8e0d6; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); text-align: center; }
body.pwa-standalone .pwa-bible-nav { display: block; }
.pwa-bible-nav h3 { font-family: 'Cinzel', serif; font-size: 1.1rem; color: #3d2b1f; margin: 0 0 18px; }
.pwa-bible-nav .bible-nav-row { display: flex; gap: 10px; margin-bottom: 12px; }
.pwa-bible-nav select { flex: 1; min-width: 0; max-width: none; width: 100%; padding: 10px 12px; border: 1px solid #d4c9bc; border-radius: 8px; font-size: 0.9rem; font-family: 'Inter', sans-serif; color: #3d2b1f; background: #faf8f5; }
.pwa-bible-nav .nav-go-btn { width: 100%; padding: 12px; background: #8b3a2a; color: #fff; border: none; border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer; margin-top: 6px; transition: background 0.15s; }
.pwa-bible-nav .nav-go-btn:hover { background: #6b2c1f; }
