/* =====================================================================
   freshbored - default frontend theme for bulletinbored
   Bootstrap 5 based, sidebar driven discussion layout
   ===================================================================== */

:root {
    --fb-brand:        #550296;
    --fb-brand-dark:   #7a04d4;
    --fb-brand-soft:   #f3e5f5;
    --fb-bg:           #f6f7f9;
    --fb-surface:      #ffffff;
    --fb-border:       #e2e2f0;
    --fb-border-soft:  #f0f1f4;
    --fb-text:         #1a1a2e;
    --fb-muted:        #6b6b8a;
    --fb-muted-soft:   #9b9bb8;
    --fb-radius:       12px;
    --fb-radius-sm:    8px;
    --fb-shadow:       0 1px 2px rgba(16, 24, 40, .05);
    --fb-shadow-lg:    0 8px 24px rgba(16, 24, 40, .08);
    --fb-navbar-h:     68px;
}

/* ---------- base ---------- */
body {
    background-color: var(--fb-bg);
    color: var(--fb-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .95rem;
    padding-top: var(--fb-navbar-h);
}

a { color: var(--fb-brand); text-decoration: none; }
a:hover { color: var(--fb-brand-dark); }

hr { border-color: var(--fb-border); opacity: 1; }

.dot { color: var(--fb-muted-soft); margin: 0 .1rem; }

.page-shell { padding: 1.75rem 0 3rem; }

/* ---------- buttons ---------- */
.btn { border-radius: var(--fb-radius); font-weight: 600; }
.btn-sm { border-radius: 7px; }

.btn-brand {
    background: linear-gradient(135deg, var(--fb-brand), var(--fb-brand-dark));
    border: 1px solid transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(85, 2, 150, 0.3);
}
.btn-brand:hover, .btn-brand:focus {
    background: linear-gradient(135deg, var(--fb-brand), #9a3bf6);
    border-color: transparent;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(85, 2, 150, 0.4);
}

.btn-outline-soft {
    background-color: var(--fb-surface);
    border: 1px solid var(--fb-border);
    color: var(--fb-text);
}
.btn-outline-soft:hover {
    background-color: transparent;
    border-color: #550296;
    color: #550296;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--fb-muted);
}
.btn-ghost:hover { background: var(--fb-border-soft); color: var(--fb-text); }

/* Legacy alias kept for plugins/older templates */
.btn-forum { background-color: var(--fb-brand); border-color: var(--fb-brand); color: #fff; }
.btn-forum:hover { background-color: var(--fb-brand-dark); border-color: var(--fb-brand-dark); color: #fff; }

/* ---------- avatars ---------- */
.avatar {
    display: inline-block;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--fb-border-soft);
}
.avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .2px;
}

/* ---------- top bar ---------- */
.navbar-forum {
    height: var(--fb-navbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}
.navbar-forum.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.navbar-forum .navbar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--fb-text);
    text-decoration: none;
}
.navbar-forum .brand-mark {
    font-size: 24px;
    color: var(--fb-brand);
    line-height: 1;
    background: none;
    width: auto;
    height: auto;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.navbar-forum .brand-text b {
    color: var(--fb-brand);
}
.navbar-forum .nav-link {
    color: #4a4a6a;
    font-weight: 500;
    padding: .4rem .75rem;
    border-radius: var(--fb-radius-sm);
    transition: color 0.2s ease;
}
.navbar-forum .nav-link:hover {
    color: #550296;
    background-color: transparent;
}
.navbar-forum .nav-link.active {
    color: #550296;
    background-color: var(--fb-brand-soft);
}
.navbar-forum .nav-icon { font-size: 1rem; }
/* Icon dropdowns (bellbored / textmebored) inject their panel into the <li>;
   give it a positioning context so Bootstrap aligns the menu correctly. */
.navbar-forum .topbar-user { display: flex; align-items: center; }
.navbar-forum .topbar-user > li.nav-item { position: relative; display: flex; align-items: center; }
/* Hide a badge that has no number (e.g. zero unread) so it doesn't show as a
   red dot. bellbored / textmebored clear the text when the count is 0. */
.navbar-forum .nav-badge:empty { display: none; }

.navbar-forum .nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: .62rem;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
}
.navbar-forum .dropdown-menu {
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow-lg);
    padding: .35rem;
}
.navbar-forum .dropdown-item { border-radius: var(--fb-radius-sm); padding: .5rem .65rem; font-size: .9rem; }
.navbar-forum .navbar-toggler { border: none; padding: .25rem .5rem; }
.navbar-forum .navbar-toggler:focus { box-shadow: none; }

.topbar-search {
    position: relative;
    flex: 0 1 280px;
}
.topbar-search i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fb-muted-soft);
    font-size: .8rem;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    border: 1px solid var(--fb-border);
    background: var(--fb-bg);
    border-radius: 999px;
    padding: .4rem .9rem .4rem 2.1rem;
    font-size: .875rem;
    color: var(--fb-text);
    outline: none;
}
.topbar-search input:focus {
    border-color: #d4b3e8;
    background: var(--fb-surface);
    box-shadow: 0 0 0 3px rgba(85, 2, 150, .1);
}

/* ---------- sidebar ---------- */
.sidebar-col { position: relative; }
.sidebar { position: sticky; top: calc(var(--fb-navbar-h) + 1.75rem); }

.btn-new-thread { padding: .6rem 1rem; font-weight: 600; margin-bottom: 1rem; }
.sidebar-toggle { margin-bottom: 1rem; }

.sidebar-block {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: .85rem;
    margin-bottom: 1rem;
    box-shadow: var(--fb-shadow);
}
.sidebar-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--fb-muted-soft);
    font-weight: 700;
    margin: .15rem .35rem .6rem;
}
.sidebar-empty { color: var(--fb-muted); font-size: .85rem; margin: 0 .35rem; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: var(--fb-radius-sm);
    color: var(--fb-text);
    font-size: .9rem;
    font-weight: 500;
}
.sidebar-nav a:hover { background: var(--fb-border-soft); }
.sidebar-nav a.active { background: var(--fb-brand-soft); color: var(--fb-brand-dark); }
.sidebar-nav a i { width: 16px; text-align: center; color: var(--fb-muted-soft); font-size: .8rem; }
.sidebar-nav a.active i { color: var(--fb-brand); }
.sidebar-nav a span:not(.sidebar-count) {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-count {
    font-size: .72rem;
    color: var(--fb-muted);
    background: var(--fb-bg);
    border-radius: 999px;
    padding: .1rem .45rem;
    font-weight: 600;
}
.sidebar-nav a.active .sidebar-count { background: #fff; color: var(--fb-brand-dark); }

.sidebar-info { list-style: none; margin: 0; padding: 0; }
.sidebar-info li {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    padding: .35rem .35rem;
    font-size: .85rem;
    border-bottom: 1px solid var(--fb-border-soft);
}
.sidebar-info li:last-child { border-bottom: none; }
.sidebar-info span { color: var(--fb-muted); }
.sidebar-info strong { font-weight: 600; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
}
.stat {
    background: var(--fb-bg);
    border-radius: var(--fb-radius-sm);
    padding: .6rem .5rem;
    text-align: center;
}
.stat-value { display: block; font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.stat-label { display: block; font-size: .72rem; color: var(--fb-muted); text-transform: lowercase; }

.stat-newest {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--fb-border-soft);
}
.stat-newest small { display: block; font-size: .7rem; color: var(--fb-muted-soft); }
.stat-newest a { font-size: .85rem; font-weight: 600; }

.sidebar-cta { background: linear-gradient(160deg, #ffffff, var(--fb-brand-soft)); }

/* ---------- page head ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}
.page-title { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-subtitle { color: var(--fb-muted); font-size: .875rem; margin: .3rem 0 0; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 .85rem; }

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: .85rem;
    font-size: .8rem;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--fb-muted-soft); }
.breadcrumb-item a { color: var(--fb-muted); }
.breadcrumb-item a:hover { color: var(--fb-brand); }
.breadcrumb-item.active {
    color: var(--fb-muted-soft);
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- sort bar ---------- */
.sort-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .3rem;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    margin-bottom: 1rem;
    box-shadow: var(--fb-shadow);
}
.sort-link {
    padding: .38rem .8rem;
    border-radius: var(--fb-radius-sm);
    font-size: .84rem;
    font-weight: 500;
    color: var(--fb-muted);
}
.sort-link:hover { background: var(--fb-border-soft); color: var(--fb-text); }
.sort-link.active { background: var(--fb-brand); color: #fff; }
.sort-link.active:hover { background: var(--fb-brand-dark); color: #fff; }

.search-inline {
    display: flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: .5rem .6rem .5rem 2.2rem;
    margin-bottom: 1rem;
}
.search-inline i { position: absolute; left: .85rem; color: var(--fb-muted-soft); font-size: .85rem; }
.search-inline input { flex: 1; border: none; outline: none; font-size: .9rem; background: transparent; }

/* ---------- discussion list ---------- */
.discussion-list {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
    overflow: hidden;
}
.discussion {
    display: flex;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--fb-border-soft);
    transition: background-color .12s ease;
}
.discussion:last-child { border-bottom: none; }
.discussion:hover { background: #fbfbfd; }

.discussion-avatar { flex-shrink: 0; }
.discussion-main { flex: 1; min-width: 0; }

.discussion-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-bottom: .3rem;
}

.pill-cat {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .18rem .55rem;
    border-radius: 999px;
    background: var(--fb-brand-soft);
    color: var(--fb-brand-dark);
}
.pill-cat:hover { background: #e2e7ff; color: var(--fb-brand-dark); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .68rem;
    font-weight: 600;
    padding: .18rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.pill-sticky { background: #e6f4ff; color: #0b62a4; }
.pill-locked { background: #fff4e5; color: #a35b00; }
.pill-hidden { background: #f1f2f4; color: #4b5563; }

.discussion-title {
    font-size: 1.02rem;
    font-weight: 650;
    line-height: 1.35;
    margin: 0 0 .2rem;
}
.discussion-title a { color: var(--fb-text); }
.discussion-title a:hover { color: var(--fb-brand); }

.discussion-meta { font-size: .8rem; color: var(--fb-muted); margin: 0; }
.discussion-meta a { color: var(--fb-muted); font-weight: 600; }
.discussion-meta a:hover { color: var(--fb-brand); }

.last-activity {
    margin-top: .6rem;
    padding-top: .55rem;
    border-top: 1px dashed var(--fb-border);
}
.last-activity-label {
    display: block;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--fb-muted-soft);
    font-weight: 700;
    margin-bottom: .25rem;
}
.last-activity-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    font-size: .8rem;
    color: var(--fb-muted);
}
.last-activity-user { font-weight: 600; color: var(--fb-text); }
.last-activity-excerpt {
    flex: 1 1 100%;
    color: var(--fb-muted);
    font-size: .82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.last-activity-excerpt:hover { color: var(--fb-brand); }

.discussion-stats {
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    flex-shrink: 0;
    padding-left: .5rem;
}
.dstat { text-align: center; min-width: 42px; }
.dstat-value { display: block; font-size: 1rem; font-weight: 700; line-height: 1.2; }
.dstat-label { display: block; font-size: .68rem; color: var(--fb-muted-soft); text-transform: lowercase; }

.discussion-compact { padding: .85rem 1.1rem; }

/* ---------- empty state ---------- */
.empty-state {
    background: var(--fb-surface);
    border: 1px dashed var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--fb-muted);
}
.empty-state i { font-size: 1.75rem; color: var(--fb-muted-soft); margin-bottom: .75rem; display: block; }
.empty-state p { margin-bottom: .75rem; }
.empty-state-sm { padding: 1.75rem 1rem; }

/* ---------- pagination ---------- */
.pager { margin-top: 1.25rem; }
.pagination { gap: .25rem; margin: 0; }
.pagination .page-link {
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-sm) !important;
    color: var(--fb-text);
    font-size: .85rem;
    padding: .4rem .75rem;
}
.pagination .page-link:hover { background: var(--fb-brand-soft); color: var(--fb-brand-dark); }
.pagination .page-item.active .page-link {
    background: var(--fb-brand);
    border-color: var(--fb-brand);
    color: #fff;
}
.pagination .page-item.disabled .page-link { color: var(--fb-muted-soft); background: var(--fb-surface); }

/* ---------- single discussion ---------- */
.thread-head { padding-bottom: .4rem; margin-bottom: .4rem; }
.thread-head-top { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .55rem; }
.thread-heading {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.02em;
    margin: 0 0 .6rem;
    word-break: break-word;
}
.thread-head-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--fb-muted);
}
.thread-head-meta a { font-weight: 600; color: var(--fb-text); }
.thread-head-meta a:hover { color: var(--fb-brand); }
.thread-head-actions { margin-left: auto; display: flex; gap: .4rem; }

.count-label { text-transform: lowercase; }

.mod-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .9rem;
    padding-top: .8rem;
    border-top: 1px solid var(--fb-border-soft);
}
.mod-bar-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    color: var(--fb-muted-soft);
    margin-right: .35rem;
}

.post-stream { display: flex; flex-direction: column; gap: .85rem; }

.stream-jump {
    display: block;
    text-align: center;
    padding: .7rem;
    background: var(--fb-surface);
    border: 1px dashed var(--fb-border);
    border-radius: var(--fb-radius);
    font-size: .85rem;
    color: var(--fb-muted);
}
.stream-jump:hover { color: var(--fb-brand); border-color: #d4b3e8; }

.post {
    display: flex;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
}
.post-op { border-color: #d4b3e8; }

.post-side {
    flex: 0 0 148px;
    padding: 1.15rem .85rem;
    background: #fbfbfd;
    border-right: 1px solid var(--fb-border-soft);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
}
.post-side-avatar { display: block; margin-bottom: .2rem; }
.post-author { font-weight: 650; color: var(--fb-text); font-size: .9rem; word-break: break-word; }
.post-author:hover { color: var(--fb-brand); }
.post-side-meta { font-size: .72rem; color: var(--fb-muted-soft); }

.role-badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .12rem .45rem;
    border-radius: 999px;
    background: var(--fb-border-soft);
    color: var(--fb-muted);
}
.role-admin { background: #ffe8e8; color: #b42318; }
.role-mod   { background: #e6f4ff; color: #0b62a4; }

.post-main { flex: 1; min-width: 0; padding: 1.05rem 1.25rem 1.15rem; }
.post-head {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--fb-muted-soft);
    padding-bottom: .6rem;
    margin-bottom: .75rem;
    border-bottom: 1px solid var(--fb-border-soft);
}
.post-number { font-weight: 700; color: var(--fb-muted); }
.post-actions { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.post-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--fb-muted-soft);
    font-size: .78rem;
    padding: 0;
}
.post-action:hover { background: var(--fb-border-soft); color: var(--fb-text); }
.post-action-danger:hover { background: #ffe8e8; color: #b42318; }

.post-body { font-size: .95rem; line-height: 1.65; color: var(--fb-text); word-wrap: break-word; }
.post-body p:last-child { margin-bottom: 0; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--fb-radius-sm); }
.post-body pre {
    background: #1a1a2e;
    color: #e0e0ff;
    padding: .9rem 1rem;
    border-radius: var(--fb-radius-sm);
    overflow-x: auto;
    font-size: .85rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}
.post-body code {
    background: rgba(85, 2, 150, 0.1);
    color: #550296;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85em;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}
.post-body pre code { background: transparent; color: inherit; padding: 0; }
.post-body blockquote {
    border-left: 3px solid var(--fb-brand);
    background: var(--fb-brand-soft);
    padding: .6rem .9rem;
    margin: .75rem 0;
    border-radius: 0 var(--fb-radius-sm) var(--fb-radius-sm) 0;
    color: #384152;
}
.post-body table { width: 100%; margin: .75rem 0; border-collapse: collapse; }
.post-body th, .post-body td { border: 1px solid var(--fb-border); padding: .45rem .6rem; }

.post-attachments {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--fb-border-soft);
}
.post-attachments h6 { font-size: .75rem; text-transform: uppercase; color: var(--fb-muted-soft); letter-spacing: .05em; }
.attachment {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-sm);
    padding: .35rem .6rem;
    margin: .25rem .35rem 0 0;
    font-size: .82rem;
    color: var(--fb-text);
    background: var(--fb-surface);
}
.attachment:hover { border-color: #d4b3e8; background: var(--fb-brand-soft); }
.attachment span { color: var(--fb-muted-soft); font-size: .72rem; }

/* ---------- reply box ---------- */
.reply-box {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 1.15rem 1.25rem;
    margin-top: 1.25rem;
    box-shadow: var(--fb-shadow);
}
.reply-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .85rem; }
.reply-box-locked {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--fb-muted);
    background: #fffaf2;
    border-color: #f3e3c9;
}
.reply-box-locked i { font-size: 1.1rem; color: #a35b00; }
.reply-box-cta { background: linear-gradient(160deg, #ffffff, var(--fb-brand-soft)); text-align: center; }
.reply-box-cta .btn { margin: 0 .2rem; }

/* ---------- panels & forms ---------- */
.panel {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 1.25rem;
    box-shadow: var(--fb-shadow);
}
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.form-actions {
    display: flex;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fb-border-soft);
}
.form-label { font-size: .82rem; font-weight: 600; color: var(--fb-text); margin-bottom: .3rem; }
.form-control, .form-select {
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-sm);
    font-size: .9rem;
    padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
    border-color: #d4b3e8;
    box-shadow: 0 0 0 3px rgba(85, 2, 150, .1);
}
.form-text { font-size: .78rem; color: var(--fb-muted-soft); }

.alert { border: 1px solid transparent; border-radius: var(--fb-radius-sm); font-size: .88rem; }

/* ---------- profile ---------- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 1.25rem;
    box-shadow: var(--fb-shadow);
    margin-bottom: 1rem;
}
.profile-head-main { flex: 1; min-width: 0; }
.profile-head-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--fb-muted);
}
.profile-head-actions { margin-left: auto; }

/* ---------- auth pages ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 1.5rem 0 2rem; }
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 1.75rem;
    box-shadow: var(--fb-shadow-lg);
}
.auth-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.auth-subtitle { color: var(--fb-muted); font-size: .875rem; margin-bottom: 1.25rem; }
.auth-foot {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fb-border-soft);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-size: .85rem;
    color: var(--fb-muted);
    text-align: center;
}

/* ---------- generic cards used by plugin views ---------- */
.card {
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
    margin-bottom: 1rem;
}
.card-header {
    background-color: var(--fb-surface);
    border-bottom: 1px solid var(--fb-border-soft);
    font-weight: 600;
    border-radius: var(--fb-radius) var(--fb-radius) 0 0 !important;
}
.list-group-item { border-color: var(--fb-border-soft); }

/* ---------- footer ---------- */
.site-footer {
    background: var(--fb-surface);
    border-top: 1px solid var(--fb-border);
    padding: 2.25rem 0 1.25rem;
    margin-top: 2rem;
    color: var(--fb-muted);
    font-size: .875rem;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
    color: var(--fb-text);
    margin-bottom: .5rem;
}
.footer-brand .brand-mark {
    font-size: 20px;
    color: var(--fb-brand);
    line-height: 1;
    background: none;
}
.footer-brand .brand-text b {
    color: var(--fb-brand);
}
.footer-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--fb-text);
    margin-bottom: .65rem;
}
.footer-text { color: var(--fb-muted); max-width: 34ch; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: .35rem; }
.footer-list a { color: var(--fb-muted-soft); }
.footer-list a:hover { color: var(--fb-brand); }
.footer-bottom {
    margin-top: 1.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fb-border-soft);
    text-align: center;
    font-size: .8rem;
    color: var(--fb-muted-soft);
}

/* ---------- responsive ---------- */
/* The mobile tab bar is hidden everywhere by default; only shown < 992px */
.mobile-tabbar { display: none; }

@media (max-width: 991.98px) {
    body { padding-top: calc(var(--fb-navbar-h) + 56px); }
    .sidebar { position: static; }
    .page-head { flex-direction: column; }

    /* On scroll-down the main navbar hides and the tab bar pins to the top */
    .navbar-forum.nav-hidden {
        transform: translateY(-100%);
        transition: transform .25s ease;
    }
    .mobile-tabbar.tabbar-top {
        top: 0;
        transition: top .25s ease;
    }
    body.tabbar-pinned { padding-top: 56px; }

    /* Center the brand on mobile (icons live in the tab bar below) */
    .navbar-forum .navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Navbar keeps only the brand on mobile; user icons live in the tab bar */
    .navbar-forum .topbar-user { display: none; }

    /* Mobile tab bar: 4 icons (messages / notifications / search / user)
       centered, with a background, fixed BELOW the main navbar. */
    .mobile-tabbar {
        display: flex;
        position: fixed;
        top: var(--fb-navbar-h);
        left: 0; right: 0;
        z-index: 1030;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
        gap: .3rem;
        padding: 0 .4rem;
        height: 56px;
        background: var(--fb-surface);
        border-bottom: 1px solid var(--fb-border);
        box-shadow: var(--fb-shadow);
    }
    .mobile-tabbar .mobile-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 42px; height: 42px;
        border-radius: 50%;
        color: var(--fb-text);
        font-size: 1.05rem;
        text-decoration: none;
        background: var(--fb-bg);
        border: 1px solid var(--fb-border);
    }
    .mobile-tabbar .mobile-tab:active { background: var(--fb-border-soft); }
    .mobile-tabbar .mobile-tab img,
    .mobile-tabbar .mobile-tab .avatar { width: 26px; height: 26px; border-radius: 50%; }

    /* The New thread / Browse buttons live in #forumSidebar on desktop but are
       already provided by the mobile tab bar, so hide them on mobile only. */
    .hide-on-mobile { display: none !important; }

    /* The join/CTA block in the sidebar is useless on mobile */
    .sidebar-cta { display: none !important; }
}

@media (max-width: 767.98px) {
    .discussion { flex-wrap: wrap; }
    .discussion-avatar { display: none; }
    .discussion-stats {
        width: 100%;
        padding-left: 0;
        margin-top: .6rem;
        gap: 1.25rem;
        border-top: 1px solid var(--fb-border-soft);
        padding-top: .5rem;
    }
    .dstat { display: flex; align-items: baseline; gap: .3rem; text-align: left; }

    .post { flex-direction: column; }
    .post-side {
        flex: none;
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: .55rem;
        padding: .75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--fb-border-soft);
    }
    .post-side-avatar { margin-bottom: 0; }
    .post-side-avatar .avatar { width: 36px !important; height: 36px !important; font-size: 15px !important; }
    .post-side-meta { margin-left: auto; }
    .post-main { padding: .9rem 1rem 1rem; }

    .thread-heading { font-size: 1.3rem; }
    .page-title { font-size: 1.35rem; }
    .profile-head { flex-wrap: wrap; }
    .profile-head-actions { margin-left: 0; width: 100%; }
    .sort-bar { overflow-x: auto; flex-wrap: nowrap; }
    .sort-link { white-space: nowrap; }
}

/* ---------- mobile full-screen stack (Facebook-style) ---------- */
.mobile-stack {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-stack {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: var(--fb-surface);
        transform: translateX(100%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
        visibility: hidden;
    }
    .mobile-stack.open {
        transform: translateX(0);
        visibility: visible;
    }
    .mobile-stack-bar {
        display: flex;
        align-items: center;
        gap: .5rem;
        height: var(--fb-navbar-h);
        padding: 0 .75rem;
        border-bottom: 1px solid var(--fb-border);
        background: var(--fb-surface);
        position: sticky;
        top: 0;
    }
    .mobile-stack-back {
        border: none;
        background: transparent;
        color: var(--fb-brand);
        font-size: 1.1rem;
        width: 40px; height: 40px;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-stack-back:active { background: var(--fb-border-soft); }
    .mobile-stack-tabs {
        flex: 1;
        display: flex;
        justify-content: center;
        gap: 1.25rem;
    }
    .mobile-stack-tab {
        border: none;
        background: transparent;
        color: var(--fb-muted-soft);
        font-size: 1.15rem;
        padding: .35rem .5rem;
        border-radius: 10px;
        position: relative;
    }
    .mobile-stack-tab.active { color: var(--fb-brand); }
    .mobile-stack-tab.active::after {
        content: "";
        position: absolute;
        left: 50%; bottom: -2px;
        width: 22px; height: 3px;
        border-radius: 3px;
        background: var(--fb-brand);
        transform: translateX(-50%);
    }
    .mobile-stack-title {
        width: 40px;
        text-align: right;
        font-size: .8rem;
        color: var(--fb-muted);
        visibility: hidden;
    }
    .mobile-stack-body {
        position: absolute;
        top: var(--fb-navbar-h);
        left: 0; right: 0; bottom: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-stack-pane { display: none; padding: .5rem 0; }
    .mobile-stack-pane.active { display: block; animation: stackFade .2s ease; }
    @keyframes stackFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

    .mobile-stack-loading,
    .mobile-stack-empty {
        text-align: center;
        color: var(--fb-muted-soft);
        padding: 3rem 1rem;
    }
    .mobile-stack-empty i { font-size: 1.75rem; display: block; margin-bottom: .5rem; }

    .mobile-stack-row {
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: .8rem 1rem;
        border-bottom: 1px solid var(--fb-border-soft);
        color: var(--fb-text);
        text-decoration: none;
    }
    .mobile-stack-row:active { background: var(--fb-border-soft); }
    .mobile-stack-row-icon { width: 20px; text-align: center; color: var(--fb-muted-soft); }
    .mobile-stack-row-main { flex: 1; min-width: 0; }
    .mobile-stack-row-title { font-weight: 600; font-size: .95rem; }
    .mobile-stack-row-sub {
        font-size: .82rem;
        color: var(--fb-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-stack-count {
        background: #e5484d;
        color: #fff;
        font-size: .72rem;
        font-weight: 700;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-stack-dot {
        width: 9px; height: 9px;
        border-radius: 50%;
        background: var(--fb-brand);
        flex-shrink: 0;
    }
    .mobile-stack-search {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .75rem 1rem;
        border-bottom: 1px solid var(--fb-border-soft);
        position: relative;
    }
    .mobile-stack-search i {
        color: var(--fb-muted-soft);
        font-size: .85rem;
    }
    .mobile-stack-search input {
        flex: 1;
        min-width: 0;
        border: 1px solid var(--fb-border);
        border-radius: 999px;
        padding: .5rem .9rem;
        font-size: .9rem;
        outline: none;
    }
    .mobile-stack-search input:focus {
        border-color: var(--fb-brand);
        box-shadow: 0 0 0 3px rgba(85,2,150,.12);
    }
}

/* ---------- markdown container emitted by the core ---------- */
.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child { margin-bottom: 0; }
