:root {
    --sa-navy: #0A1628;
    --sa-blue: #2563EB;
    --sa-muted: #65676b;
    --sa-border: #dadde1;
    --sa-danger: #d93025;
}

/* ---------- Shell: sidebar + content, full width ---------- */
.forumShell {
    display: flex;
    align-items: stretch;
    width: 100%;
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--sa-navy);
}

.forumSidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--sa-border);
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

/* Desktop only: keep the sidebar's white background reaching the footer even
   when a view has too few posts/communities to fill the viewport on its own
   (the mobile drawer below is already a fixed, full-height overlay). */
@media (min-width: 992px) {
    .forumShell {
        min-height: calc(100vh - 80px);
    }
}

.forumSidebarBody {
    padding: 20px 14px;
}

.forumSidebarMobileHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sa-border);
}
.forumSidebarMobileHeader h5 { margin: 0; font-size: 16px; font-weight: 700; }
.forumSidebarCloseBtn { background: none; border: none; font-size: 24px; line-height: 1; color: var(--sa-muted); cursor: pointer; }

/* Below 992px: sidebar becomes a slide-in drawer, hidden by default and
   toggled via the .show class (plain custom JS in forum-sidebar.php) rather
   than Bootstrap's offcanvas component. */
@media (max-width: 991.98px) {
    .forumSidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-height: 100vh;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
        box-shadow: 0 0 20px rgba(0,0,0,.15);
    }
    .forumSidebar.show {
        transform: translateX(0);
    }
}

.forumSidebarBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1044;
}
.forumSidebarBackdrop.show {
    display: block;
}

.forumHamburgerBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f2f5;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sa-navy);
    margin-bottom: 16px;
}
.forumHamburgerBtn:hover { background: #e4e6eb; }

.forumSidebarNav { display: flex; flex-direction: column; gap: 2px; }
.forumSidebarLink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--sa-navy);
    text-decoration: none;
}
.forumSidebarLink i { width: 18px; text-align: center; color: var(--sa-muted); }
.forumSidebarLink:hover { background: #f0f2f5; color: var(--sa-navy); }
.forumSidebarLink.active { background: #eaf1ff; color: var(--sa-blue); }
.forumSidebarLink.active i { color: var(--sa-blue); }

.forumSidebarDivider { height: 1px; background: var(--sa-border); margin: 16px 4px; }
.forumSidebarSectionLabel { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--sa-muted); font-weight: 700; padding: 0 12px; margin-bottom: 8px; }
.forumSidebarStatic { padding: 0 12px; font-size: 13px; color: var(--sa-muted); line-height: 1.4; }

.forumContent {
    flex: 1;
    min-width: 0;
    padding: 28px 24px 64px;
    max-width: 880px;
}

/* ---------- Shared: Reddit-style action bar (vote pill + comment pill + share pill) ---------- */
.forumActionBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

.forumVotePill { display: flex; align-items: center; gap: 2px; background: #f0f2f5; border-radius: 999px; padding: 2px 4px; }
.forumVoteBtn { display: flex; align-items: center; justify-content: center; background: none; border: none; color: #878a8c; font-size: 14px; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; }
.forumVoteBtn:hover { background: #e4e6eb; }
.forumVoteBtn.forumUpvoteBtn.active { color: #ff4500; }
.forumVoteBtn.forumDownvoteBtn.active { color: #7193ff; }
.forumScore { font-size: 13px; font-weight: 700; color: var(--sa-navy); min-width: 18px; text-align: center; }

.forumPill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f2f5;
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sa-navy);
    text-decoration: none;
    cursor: pointer;
}
.forumPill:hover { background: #e4e6eb; color: var(--sa-navy); }
.forumPill i { font-size: 13px; color: var(--sa-muted); }
.forumSharePill.copied { background: #e7f6ec; color: #17692f; }
.forumPill.active { background: var(--sa-blue); color: #fff; }
.forumPill.active i { color: #fff; }

/* ---------- Shared: post list card (forum.php) ---------- */
.forumHeader { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.forumHeader h1 { font-size: 24px; font-weight: 700; margin: 0; }
.forumNewPostBtn { background: var(--sa-blue); color: #fff; border: none; border-radius: 999px; padding: 10px 22px; font-weight: 600; text-decoration: none; font-size: 14px; }
.forumNewPostBtn:hover { background: #1d4ed8; color: #fff; }

.forumPostCard { border: 1px solid var(--sa-border); border-radius: 12px; padding: 16px; margin-bottom: 12px; background: #fff; }
.forumPostTitle { font-size: 17px; font-weight: 700; margin: 2px 0 6px; text-decoration: none; color: var(--sa-navy); display: block; }
.forumPostTitle:hover { color: var(--sa-blue); }
.forumPostMeta { font-size: 13px; color: var(--sa-muted); }
.forumCommunityBadge { color: var(--sa-navy); font-weight: 700; text-decoration: none; }
.forumCommunityBadge:hover { color: var(--sa-blue); }
.forumPostSnippet { font-size: 14px; color: #3c4043; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.forumRemovedPlaceholder { font-style: italic; color: var(--sa-muted); }

/* ---------- Shared: community moderation (remove/ban) ---------- */
.forumModRemoveBtn { color: var(--sa-danger); }
.forumModRemoveBtn i { color: var(--sa-danger); }
.forumModRemoveBtn:hover { background: #fdeaea; color: var(--sa-danger); }
.forumModBanBtn { background: none; border: none; padding: 0; color: var(--sa-danger); font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.forumBannedNotice { color: var(--sa-danger); font-weight: 600; font-size: 14px; }

.forumEmpty { text-align: center; padding: 60px 16px; color: var(--sa-muted); }
.forumLoadStatus { text-align: center; padding: 20px 0; font-size: 13px; color: var(--sa-muted); }

.forumSkeletonCard { border: 1px solid var(--sa-border); border-radius: 12px; padding: 16px; margin-bottom: 12px; background: #fff; }
.forumSkeletonBar { height: 12px; border-radius: 6px; margin-bottom: 10px; background: linear-gradient(90deg, #eceef1 25%, #f5f6f7 37%, #eceef1 63%); background-size: 400% 100%; animation: forumShimmer 1.4s ease infinite; }
.forumSkeletonBar.forumSkeletonMeta { width: 140px; height: 11px; }
.forumSkeletonBar.forumSkeletonTitle { width: 65%; height: 16px; }
.forumSkeletonBar.forumSkeletonSnippet { width: 100%; }
.forumSkeletonBar.forumSkeletonSnippetShort { width: 80%; margin-bottom: 14px; }
.forumSkeletonActions { display: flex; flex-wrap: wrap; gap: 8px; }
.forumSkeletonPill { height: 28px; border-radius: 999px; background: linear-gradient(90deg, #eceef1 25%, #f5f6f7 37%, #eceef1 63%); background-size: 400% 100%; animation: forumShimmer 1.4s ease infinite; }
.forumSkeletonPill.forumSkeletonVote { width: 84px; }
.forumSkeletonPill.forumSkeletonComment { width: 96px; }
.forumSkeletonPill.forumSkeletonShare { width: 70px; }

@keyframes forumShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}
.forumPager { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.forumPager a, .forumPager span { padding: 6px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--sa-navy); border: 1px solid var(--sa-border); }
.forumPager span.current { background: var(--sa-blue); color: #fff; border-color: var(--sa-blue); }

/* ---------- Shared: single post + reply tree (forum_post.php) ---------- */
.forumBackLink { font-size: 14px; color: var(--sa-muted); text-decoration: none; display: inline-block; margin-bottom: 16px; }
.forumBackLink:hover { color: var(--sa-blue); }

.forumPostDetailCard { border: 1px solid var(--sa-border); border-radius: 12px; padding: 18px; background: #fff; margin-bottom: 20px; }
.forumReplyCard { border: 1px solid var(--sa-border); border-radius: 12px; padding: 12px 14px; background: #fff; }

.forumPostTitleLg { font-size: 22px; font-weight: 700; margin: 2px 0 8px; color: var(--sa-navy); }
.forumReplyMeta { font-size: 13px; color: var(--sa-muted); margin-bottom: 10px; }
.forumBodyContent { font-size: 15px; line-height: 1.5; color: #1c1e21; }
.forumBodyContent p { margin: 0 0 10px; }
.forumBodyContent a { color: var(--sa-blue); }

.forumReplyToBtn { background: none; border: none; color: var(--sa-muted); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; margin-top: 4px; }
.forumReplyToBtn:hover { color: var(--sa-blue); }

/* ---------- Shared: accepted answer (post author's pick) ---------- */
.forumAcceptedAnswer { background: #eafaf0; border-color: #34c77b; }
.forumAcceptedBadge { display: inline-flex; align-items: center; gap: 4px; background: #34c77b; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.forumChooseAnswerBtn { background: none; border: none; color: var(--sa-blue); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; margin-top: 4px; margin-left: 12px; }
.forumChooseAnswerBtn:hover { text-decoration: underline; }
.forumAcceptedCallout { background: #eafaf0; border: 1px solid #34c77b; border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.forumAcceptedCalloutHeading { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #1f7a4d; margin-bottom: 8px; }
.forumAcceptedJumpLink { font-size: 13px; font-weight: 600; color: #1f7a4d; text-decoration: underline; }

.forumRepliesHeading { font-size: 16px; font-weight: 700; margin: 24px 0 14px; }
.forumReplyNode { margin-top: 12px; margin-left: calc(var(--forum-reply-depth, 0) * 24px); }
.forumReplyFormSlot:empty { display: none; }

/* Narrow screens: a 24px-per-level indent on a deeply nested thread can eat
   most of a phone's width before any actual reply content shows - shrink
   the per-level indent instead of the reply content. */
@media (max-width: 575.98px) {
    .forumReplyNode { margin-left: calc(var(--forum-reply-depth, 0) * 10px); }
}

.forumReplyFormBox { margin-top: 10px; }
.forumReplyTextarea { display: block; width: 100%; min-height: 90px; padding: 10px; font-size: 14px; border: 1px solid var(--sa-border); border-radius: 8px; font-family: inherit; resize: vertical; margin-bottom: 8px; }
.forumReplySubmitBtn { background: var(--sa-blue); color: #fff; border: none; border-radius: 999px; padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; }
.forumReplySubmitBtn:hover { background: #1d4ed8; }
.forumReplyCancelBtn { background: none; border: none; color: var(--sa-muted); font-size: 13px; cursor: pointer; margin-left: 8px; }
.forumSignInPrompt { font-size: 14px; color: var(--sa-muted); margin: 16px 0; }
.forumSignInPrompt a { color: var(--sa-blue); font-weight: 600; }

/* ---------- Sidebar: Your Communities ---------- */
.forumSidebarCommunityList { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.forumSidebarCommunityLink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sa-navy);
    text-decoration: none;
}
.forumSidebarCommunityLink:hover { background: #f0f2f5; color: var(--sa-navy); }
.forumCommunityAvatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--sa-blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.forumSidebarNoCommunities { padding: 0 12px; font-size: 13px; color: var(--sa-muted); margin-bottom: 10px; }
.forumSidebarBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--sa-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin: 4px 0;
}
.forumSidebarBtn:hover { background: #1d4ed8; color: #fff; }
.forumSidebarGhostLink { display: block; text-align: center; font-size: 13px; color: var(--sa-blue); font-weight: 600; text-decoration: none; padding: 6px 12px; }
.forumSidebarGhostLink:hover { text-decoration: underline; }

/* ---------- Community pages ---------- */
.forumCommunityHeader { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.forumCommunityAvatarLg {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--sa-blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.forumCommunityHeaderText { flex: 1; min-width: 0; }
.forumCommunityHeaderText h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.forumCommunityHeaderText p { font-size: 14px; color: var(--sa-muted); margin: 0 0 4px; }
.forumCommunityMemberCount { font-size: 13px; color: var(--sa-muted); }

.forumJoinBtn { background: var(--sa-blue); color: #fff; border: none; border-radius: 999px; padding: 8px 22px; font-weight: 600; font-size: 14px; cursor: pointer; }
.forumJoinBtn:hover { background: #1d4ed8; }
.forumJoinBtn.joined { background: #fff; color: var(--sa-navy); border: 1px solid var(--sa-border); }
.forumJoinBtn.joined:hover { background: #f0f2f5; }

.forumCommunityListItem { display: flex; align-items: center; gap: 14px; border: 1px solid var(--sa-border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: #fff; }
.forumCommunityListItemBody { flex: 1; min-width: 0; }
.forumCommunityListItemBody a { font-size: 16px; font-weight: 700; color: var(--sa-navy); text-decoration: none; }
.forumCommunityListItemBody a:hover { color: var(--sa-blue); }
.forumCommunityListItemBody p { font-size: 13px; color: var(--sa-muted); margin: 2px 0 0; }
