/* ============================================================
   Bible Word Study — Community (Covenant theme)
   Self-contained CSS — zero coupling to main app
   ============================================================ */

/* --- Design Tokens --- */
:root {
    --bg:             #F7F3ED;   /* warm parchment */
    --surface:        #FFFFFF;   /* white cards */
    --surface-2:      #EFE9DF;   /* light parchment hover */
    --border:         #E0D8CC;   /* warm hairline */
    --gold:           #A8720A;   /* amber gold — readable on light */
    --gold-dim:       #7F5608;
    --gold-glow:      rgba(168, 114, 10, 0.12);
    --white:          #FFFFFF;
    --text:           #1C1810;   /* warm near-black */
    --text-secondary: #6E6050;   /* warm medium brown */
    --danger:         #C0392B;
    --success:        #2E7D52;
    --radius:         12px;
    --radius-sm:      8px;
    --shadow:         0 4px 24px rgba(0,0,0,0.08);
    --shadow-gold:    0 0 20px rgba(168, 114, 10, 0.18);
    --transition:     0.2s ease;
    --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Nav uses its own dark palette — keeps authority without ominous body */
    --nav-bg:         #1E1B4B;   /* deep indigo */
    --nav-border:     #2D2870;
    --nav-text:       #E8E6F5;
    --nav-text-dim:   #9B96C8;
}

/* --- Loading Overlay --- */
.community-loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg, #F7F3ED);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}
.community-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}
.community-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, #E0D8CC);
    border-top-color: var(--gold, #A8720A);
    border-radius: 50%;
    animation: communityLoadSpin 0.8s linear infinite;
}
@keyframes communityLoadSpin {
    to { transform: rotate(360deg); }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-dim); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }

/* --- Layout --- */
.community-app {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    grid-template-rows: 64px 1fr;
    min-height: 100dvh;
}

/* --- Top Nav --- */
.community-nav {
    grid-column: 1 / -1;
    grid-row: 1;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.community-nav .nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 0.02em;
    margin-right: auto;
}

.community-nav .nav-logo span {
    color: var(--nav-text-dim);
    font-weight: 400;
    font-size: 0.85rem;
}

.nav-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.nav-search input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--nav-text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition);
}

.nav-search input:focus { border-color: var(--gold); }
.nav-search input::placeholder { color: var(--nav-text-dim); }

.nav-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nav-text-dim);
    display: flex;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon-btn {
    background: none;
    border: none;
    color: var(--nav-text-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.nav-icon-btn svg { flex-shrink: 0; }

.nav-icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--nav-text); }

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}

.nav-avatar:hover { border-color: rgba(255,255,255,0.5); }
.nav-avatar svg { width: 18px; height: 18px; }

/* Back to Scripture link */
.back-to-scripture {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all var(--transition);
    white-space: nowrap;
}

.back-to-scripture:hover {
    border-color: var(--gold-dim);
    color: var(--gold);
}

/* --- Left Sidebar --- */
.community-sidebar {
    grid-column: 1;
    grid-row: 2;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100dvh - 64px);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    margin: 2px 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: var(--surface-2);
    color: var(--gold);
    border-color: rgba(168, 114, 10, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(168, 114, 10, 0.1), rgba(168, 114, 10, 0.04));
    color: var(--gold);
    border-color: rgba(168, 114, 10, 0.3);
    box-shadow: 0 2px 8px rgba(168, 114, 10, 0.15);
}

.sidebar-nav-item .item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav-item .item-icon svg {
    width: 20px;
    height: 20px;
}
.sidebar-nav-item .item-badge {
    margin-left: auto;
    background: var(--gold);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Group list in sidebar */
.sidebar-group-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    margin: 2px 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.sidebar-group-item:hover {
    background: var(--surface-2);
    color: var(--gold);
    border-color: rgba(168, 114, 10, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.group-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

/* --- Main Content --- */
.community-main {
    grid-column: 2;
    grid-row: 2;
    padding: 1.5rem;
    overflow-y: auto;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
}

/* --- Right Panel --- */
.community-panel {
    grid-column: 3;
    grid-row: 2;
    padding: 1.5rem;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100dvh - 64px);
}

/* --- Cards --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}

.card:hover { border-color: var(--gold-dim); }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold-glow);
    border: 1px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--gold);
    flex-shrink: 0;
}

.card-avatar svg { width: 20px; height: 20px; }

#profileAvatarPreview svg { width: 30px; height: 30px; }
.profile-icon-btn svg { width: 22px; height: 22px; }

.card-meta { flex: 1; }
.card-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.card-subtitle { font-size: 0.78rem; color: var(--text-secondary); }

/* --- Study Share Card --- */
.study-share-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.study-share-card:hover {
    border-color: var(--gold-dim);
    box-shadow: var(--shadow-gold);
}

.study-share-card .study-banner {
    background: linear-gradient(135deg, var(--nav-bg) 0%, #2D2870 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem;
    position: relative;
}

.study-share-card .study-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.study-share-card .study-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.3rem;
}

.study-share-card .study-ref {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.study-share-card .study-body {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.study-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-gold {
    background: var(--gold);
    color: var(--bg);
}

.btn-gold:hover {
    background: #E8C840;
    box-shadow: var(--shadow-gold);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--gold-dim);
    color: var(--gold);
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
}

.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn svg { flex-shrink: 0; vertical-align: middle; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* --- Post Composer --- */
.composer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.composer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.composer-header textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
    resize: none;
    outline: none;
    min-height: 52px;
    line-height: 1.5;
}

.composer-header textarea::placeholder { color: var(--text-secondary); }

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.composer-tools {
    display: flex;
    gap: 0.25rem;
}

.composer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── Post destination menu ── */
.post-dest-wrapper {
    position: relative;
}
.post-dest-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 220px;
    z-index: 50;
    overflow: hidden;
}
.post-dest-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition);
}
.post-dest-option:hover {
    background: var(--surface-2);
}
.post-dest-option + .post-dest-option {
    border-top: 1px solid var(--border);
}
.post-dest-list-panel {
    border-top: 1px solid var(--border);
    padding: 0.5rem;
}
.post-dest-search {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    outline: none;
    margin-bottom: 0.4rem;
}
.post-dest-list {
    max-height: 216px;
    overflow-y: auto;
}
.post-dest-list-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--text);
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition);
}
.post-dest-list-item:hover {
    background: var(--surface-2);
}
.post-dest-empty {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.post-empty-tip {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.4rem;
    background: var(--text);
    color: var(--surface);
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    animation: tipFade 2s ease forwards;
    pointer-events: none;
}
@keyframes tipFade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- Group Header --- */
.group-header {
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.group-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--gold-glow);
    border: 1px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    color: var(--gold);
}

.group-icon svg { width: 28px; height: 28px; }
.group-avatar svg { width: 18px; height: 18px; }
.group-svg-icon svg { width: 100%; height: 100%; }

.icon-pick-btn svg { width: 22px; height: 22px; }

.group-info { flex: 1; }
.group-name { font-size: 1.25rem; font-weight: 700; color: var(--white); }
.group-type {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.3rem;
}
.group-description { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.3rem; }
.group-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.group-stats strong { color: var(--text); }

/* --- Disciple Card --- */
.disciple-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    cursor: pointer;
}

.disciple-card:hover { background: var(--surface-2); }

.disciple-info { flex: 1; }
.disciple-name { font-size: 0.875rem; font-weight: 600; }
.disciple-meta { font-size: 0.75rem; color: var(--text-secondary); }

/* --- Feed item reactions --- */
.feed-reactions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.reaction-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all var(--transition);
    cursor: pointer;
}
.reaction-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.reaction-btn:hover, .reaction-btn.active {
    border-color: var(--gold-dim);
    color: var(--gold);
    background: var(--gold-glow);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.25rem; }

/* --- Section Title --- */
.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge-gold { background: var(--gold-glow); color: var(--gold); border: 1px solid var(--gold-dim); }
.badge-green { background: rgba(76,175,125,0.15); color: var(--success); border: 1px solid rgba(76,175,125,0.3); }
.badge-grey { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }

/* ============================================================
   Shared Component Classes — OOP single source of truth
   Replaces all inline styles in JS templates
   ============================================================ */

/* --- Page Layout --- */
.page-header         { margin-bottom: 1.5rem; }
.page-title          { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.page-subtitle       { font-size: 0.85rem; color: var(--text-secondary); }

/* --- Forms --- */
.form-group          { margin-bottom: 0.85rem; }
.form-group-lg       { margin-bottom: 1rem; }
.form-label          { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.06em; }
.form-input          { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.875rem; outline: none; }
.form-input-lg       { padding: 0.6rem 0.75rem; font-size: 0.9rem; }
.form-textarea       { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.875rem; outline: none; resize: none; font-family: inherit; }
.form-actions        { display: flex; gap: 0.5rem; }
.form-error          { color: #E05C5C; font-size: 0.8rem; margin-top: 0.5rem; display: none; }
.form-checkbox-row   { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.checkbox-label      { font-size: 0.85rem; color: var(--text); cursor: pointer; }

/* --- Search Bar --- */
.search-bar          { display: flex; gap: 0.5rem; }
.search-bar-mb       { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.search-input        { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 0.4rem 1rem; color: var(--text); font-size: 0.875rem; outline: none; }

/* --- Person Row (friends, members, search results) --- */
.person-row          { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.person-row-card     { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; padding: 0.75rem 1rem; }
.person-body         { flex: 1; min-width: 0; }
.person-name         { font-weight: 600; font-size: 0.875rem; }
.person-name-lg      { font-weight: 600; font-size: 0.9rem; }
.person-meta         { font-size: 0.75rem; color: var(--text-secondary); }
.person-meta-sm      { font-size: 0.72rem; color: var(--text-secondary); }
.person-bio          { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* --- Card Avatar Sizes --- */
.card-avatar-sm      { width: 38px; height: 38px; }
.card-avatar-xs      { width: 32px; height: 32px; font-size: 0.75rem; }
.card-avatar-36      { width: 36px; height: 36px; }

/* --- Loading / Status --- */
.loading-text        { color: var(--text-secondary); padding: 2rem; text-align: center; }
.loading-text-sm     { color: var(--text-secondary); font-size: 0.85rem; padding: 0.5rem 0; }
.empty-hint          { font-size: 0.85rem; color: var(--text-secondary); padding: 0.25rem 0; }
.empty-hint-sm       { font-size: 0.8rem; color: var(--text-secondary); padding: 0.5rem 0; }
.status-success      { font-size: 0.75rem; color: var(--gold); }
.status-error        { font-size: 0.75rem; color: var(--text-secondary); }
.save-msg            { font-size: 0.8rem; color: var(--success); display: none; }

/* --- Notification Row --- */
.notif-row           { margin-bottom: 0.5rem; padding: 0.75rem 1rem; display: flex; align-items: flex-start; gap: 0.75rem; }
.notif-unread        { border-left: 3px solid var(--gold); }
.notif-icon          { font-size: 1.1rem; }
.notif-message       { font-size: 0.875rem; }
.notif-detail        { font-size: 0.8rem; color: var(--text-secondary); }
.notif-time          { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.2rem; }

/* --- Notification Badge (bell) --- */
.notif-badge         { background: var(--gold); color: var(--bg); font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.3rem; border-radius: 8px; vertical-align: top; margin-left: -4px; }

/* --- Count Badge (section titles) --- */
.count-badge         { font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 10px; margin-left: 0.25rem; }
.count-badge-gold    { background: var(--gold); color: var(--bg); }
.count-badge-grey    { background: var(--text-secondary); color: var(--bg); }

/* --- Comment Section --- */
.comment-section     { margin-top: 0.75rem; border-top: 1px solid var(--border); padding-top: 0.75rem; }

/* --- Comment Row --- */
.comment-row         { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: flex-start; }
.comment-avatar      { width: 28px; height: 28px; border-radius: 50%; background: var(--gold-glow); border: 1px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--gold); }
.comment-bubble      { flex: 1; background: var(--surface-2); border-radius: 10px; padding: 0.4rem 0.65rem; }
.comment-author      { font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 0.15rem; }
.comment-body        { font-size: 0.85rem; color: var(--text); }
.comment-actions     { display: flex; flex-direction: column; gap: 0.15rem; }
.comment-action-btn  { background: none; border: none; color: var(--text-secondary); font-size: 0.75rem; opacity: 0.4; cursor: pointer; padding: 0.1rem 0.2rem; }
.comment-input-row   { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* --- Inline Edit --- */
.inline-edit-textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.9rem; font-family: var(--font); resize: none; outline: none; line-height: 1.5; }
.inline-edit-textarea-sm { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.5rem; color: var(--text); font-size: 0.85rem; font-family: var(--font); resize: none; outline: none; }
.inline-edit-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; justify-content: flex-end; }
.inline-edit-actions-sm { display: flex; gap: 0.3rem; margin-top: 0.3rem; justify-content: flex-end; }

/* --- Post Card Internals --- */
.post-content        { font-size: 0.9rem; line-height: 1.6; color: var(--text); margin-bottom: 0.75rem; }
.post-verse-ref      { font-size: 0.8rem; color: var(--gold); margin-top: 0.3rem; font-weight: 600; }
.post-group-badge    { font-size: 0.75rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.25rem; }
.post-group-badge-icon { display: inline-flex; width: 14px; height: 14px; color: var(--gold); }
.post-edit-btns      { display: flex; gap: 0.25rem; }
.post-action-faded   { opacity: 0.4; font-size: 0.75rem; }

/* --- Icon Picker (shared: group create + profile) --- */
.icon-picker         { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.icon-picker-btn     { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.icon-picker-btn.active { background: var(--gold-glow); border-color: rgba(168, 114, 10, 0.3); color: var(--gold); }
.icon-picker-btn > svg  { width: 22px; height: 22px; }

/* --- Group SVG Icon (inline) --- */
.group-svg-icon      { display: flex; align-items: center; justify-content: center; color: var(--gold); }

/* --- Wizard extras --- */
.wizard-label-hint   { opacity: 0.5; font-weight: 400; }
.wizard-friend-name  { display: inline-flex; align-items: center; gap: 0.35rem; }

/* --- Profile Page --- */
.profile-header-row  { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.profile-avatar-preview { width: 60px; height: 60px; border-radius: 50%; background: var(--gold-glow); border: 2px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; color: var(--gold); }
.profile-display-name { font-weight: 700; font-size: 1rem; }
.profile-bio-text    { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Post Summary Row (profile my posts) --- */
.post-summary        { margin-bottom: 0.6rem; padding: 0.75rem 1rem; cursor: pointer; }
.post-summary:hover  { border-color: var(--gold-dim); }
.post-summary-row    { display: flex; gap: 0.5rem; align-items: flex-start; }
.post-summary-icon   { display: flex; align-items: center; color: var(--text-secondary); }
.post-summary-body   { flex: 1; }
.post-summary-text   { font-size: 0.875rem; line-height: 1.5; color: var(--text); }
.post-summary-verse  { font-size: 0.75rem; color: var(--gold); margin-top: 0.2rem; }
.post-summary-time   { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.3rem; }

/* --- Explore Group Card --- */
.group-card-row      { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.group-card-icon     { width: 48px; height: 48px; border-radius: 10px; background: var(--gold-glow); border: 1px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--gold); }
.group-card-body     { flex: 1; min-width: 0; }
.group-card-name     { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.group-card-desc     { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.2rem; }
.group-card-stats    { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.35rem; }
.group-card-actions  { flex-shrink: 0; }

/* --- Group Detail Tabs --- */
.group-tab-bar       { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); margin-top: -0.25rem; }
.group-tab           { padding: 0.5rem 1rem; background: none; border: none; border-bottom: 2.5px solid transparent; color: var(--text-secondary); font-weight: 600; font-size: 0.875rem; cursor: pointer; margin-bottom: -1px; }
.group-tab.active    { border-bottom-color: var(--gold); color: var(--gold); }
.group-header-actions { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-end; }

/* --- Sidebar Extras --- */
.sidebar-group-name  { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-admin-label { font-size: 0.6rem; color: var(--gold); margin-left: auto; }
.sidebar-study-title { font-size: 0.82rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-study-meta  { font-size: 0.72rem; color: var(--text-secondary); }

/* --- Subscription Banner --- */
.subscription-banner { background: linear-gradient(135deg, #4a2d6b, #6b3fa0); color: #fff; padding: 1rem 1.25rem; border-radius: 8px; margin: 0 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.subscription-banner span { font-size: 0.9rem; }
.subscription-banner-link { background: #fff; color: #4a2d6b; padding: 0.45rem 1rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* --- Mobile (768px) --- */
@media (max-width: 768px) {
    .community-app {
        grid-template-columns: 1fr;
        grid-template-rows: 56px 1fr 56px;
    }

    .community-sidebar,
    .community-panel { display: none; }

    .community-main {
        grid-column: 1;
        padding: 1rem;
        max-width: 100%;
    }

    .community-nav { padding: 0 1rem; }
    .nav-search { display: none; }

    /* Bottom nav bar on mobile */
    .community-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 100;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.65rem;
        color: var(--text-secondary);
        gap: 0.2rem;
        border: none;
        background: none;
        transition: color var(--transition);
    }

    .bottom-nav-item.active { color: var(--gold); }
    .bottom-nav-item svg { width: 22px; height: 22px; }
}

@media (min-width: 769px) {
    .community-bottom-nav { display: none; }
}

/* --- Study Share Card — Feed Rendering --- */
.study-verses-block {
    padding: 1rem 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.study-verse-block {
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
    border-radius: 8px;
    border-left: 3px solid var(--gold-dim);
}

.study-verse-ref {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.study-verse-html {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}

/* Strong's numbers in feed — visible but not clickable */
.study-verse-html sup.strongs {
    font-size: 0.65em;
    color: var(--gold-dim);
    vertical-align: super;
    cursor: default;
    pointer-events: none;
}

.study-verse-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.study-tag-chip {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.study-verse-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.35rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border);
}

.study-text-block {
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
}

.study-text-block h1, .study-text-block h2, .study-text-block h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
    color: var(--text);
}

.study-adopt-btn {
    font-size: 0.82rem;
    padding: 0.35rem 0.85rem;
}

/* --- Study Wizard Overlay --- */
.study-wizard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.study-wizard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 32px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.wizard-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.wizard-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background var(--transition);
}

.wizard-close:hover { background: var(--surface-2); }

.wizard-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.wizard-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.65rem;
}

.wizard-select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}

.wizard-select:focus { border-color: var(--gold-dim); }

.wizard-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition);
}

.wizard-input:focus { border-color: var(--gold-dim); }

.wizard-textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    resize: none;
    box-sizing: border-box;
    transition: border-color var(--transition);
}

.wizard-textarea:focus { border-color: var(--gold-dim); }

.wizard-destinations {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wizard-dest-card {
    display: block;
    cursor: pointer;
}

.wizard-dest-card input[type="radio"] {
    display: none;
}

.wizard-dest-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all var(--transition);
}

.wizard-dest-card input:checked + .wizard-dest-inner {
    border-color: var(--gold-dim);
    background: var(--gold-glow);
}

.wizard-dest-icon { font-size: 1.2rem; }

.wizard-dest-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.wizard-dest-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.wizard-friend-results {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.wizard-friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.wizard-friend-row:last-child { border-bottom: none; }
.wizard-friend-row:hover { background: var(--surface-2); }
.wizard-friend-row.selected { background: var(--gold-glow); color: var(--gold); }

.wizard-selected-friends {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.wizard-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--gold-glow);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem 0.2rem 0.75rem;
    border-radius: 20px;
}

.wizard-chip-remove {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.wizard-chip-remove:hover { opacity: 1; }

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
}

/* ── Shared study card: compact commentary line ── */
.study-commentary-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-warm);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    margin: 0.25rem 0;
    font-size: 0.85rem;
}
.study-commentary-source {
    font-weight: 600;
    color: var(--text-primary);
}
.study-commentary-ref {
    color: var(--text-secondary);
}
.study-commentary-view {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
    margin-left: auto;
    white-space: nowrap;
}
.study-commentary-view:hover {
    text-decoration: underline;
}

/* ── Commentary popup overlay ── */
.commentary-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}
.commentary-popup {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.commentary-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e5e0d5);
    font-size: 0.95rem;
}
.commentary-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0 0.25rem;
}
.commentary-popup-close:hover {
    color: var(--text-primary);
}
.commentary-popup-body {
    padding: 1.25rem;
    overflow-y: auto;
    line-height: 1.7;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ── Study text block formatting in shared cards ── */
.study-text-block h1 { font-size: 1.3rem; margin: 0.75rem 0 0.5rem; }
.study-text-block h2 { font-size: 1.1rem; margin: 0.5rem 0 0.4rem; }
.study-text-block ul, .study-text-block ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.study-text-block li { margin-bottom: 0.25rem; }
.study-text-block p { margin-bottom: 0.5rem; }

/* ── Injected cards (commentary quotes, word studies) in shared study text ── */
.study-text-block .study-injected-block {
    display: block;
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: #f9f7f2;
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.6;
}
.study-text-block .study-injected-block strong {
    display: block;
    font-size: 0.85rem;
    color: var(--gold-dark, #8b7335);
    margin-bottom: 0.25rem;
}
.study-text-block .study-block-remove {
    display: none;
}

/* Prevent iOS auto-zoom */
@media (max-width: 768px) {
    input, textarea, select { font-size: 16px !important; }
}
