/* ══════════════════════════════════════════════
   community.css  –  iGurus Community Forums
   Minimal decoration, colorful accent cards, content-first.
   Same visual language as community-guidelines.css (cgp-*) and the
   shared .igaf-lhdr / .ig-sec-* hero pattern used across the site.
   Namespaces: cm-* (index)  ft-* (thread page)
   ══════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────── */
:root {
    --cm-brand:       #A41034;
    --cm-brand-dark:  #7D0C27;
    --cm-brand-light: #FDE8ED;
    --cm-red:         #ef4444;
    --cm-amber:       #f59e0b;
    --cm-green:       #10b981;
    --cm-blue:        #3b82f6;
    --cm-cream:       #F5F1EA;
    --cm-paper:       #FFFFFF;
    --cm-ink:         #111827;
    --cm-ink-2:       #3F3F46;
    --cm-ink-3:       #6B7280;
    --cm-ink-4:       #9CA3AF;
    --cm-line:        #E5E7EB;
    --cm-line-dark:   #D4D4D8;
    --cm-radius-sm:   8px;
    --cm-radius-md:   10px;
    --cm-radius-lg:   12px;
    --cm-serif:       'Fraunces', Georgia, serif;
    --cm-sans:        'Inter', system-ui, -apple-system, sans-serif;
    --cm-transition:  all 0.16s ease;
}

/* ─── Base ───────────────────────────────────── */
.cm-page-wrap, .cm-cta, .ft-layout {
    font-family: var(--cm-sans);
}
body:has(.cm-page-wrap) { background: var(--cm-cream) !important; }

/* ════════════════════════════════════════════════
   HERO — uses the shared .igaf-lhdr / .ig-sec-* classes
   (same markup as the Affiliate page hero) for the eyebrow,
   Fraunces title, underline, and subtitle. Only the CTA row
   below the subtitle is page-specific.
   ════════════════════════════════════════════════ */
.igaf-hero-btns .cm-btn { margin: 0; }

/* ════════════════════════════════════════════════
   STATS STRIP — 4 colored top-bar cards directly under the
   hero, replacing the old 2x2 stat block baked into the hero
   itself. Same technique as the Affiliate trust strip
   (.igaf-metric) and Guidelines space cards (.cgp-space-card).
   ════════════════════════════════════════════════ */
.cm-stats {
    background: var(--cm-cream);
    padding: 20px 0 0;
}
.cm-stats__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.cm-stat {
    position: relative;
    overflow: hidden;
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--cm-transition);
}
.cm-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
}
.cm-stat:hover { box-shadow: 0 6px 18px rgba(17,24,39,.08); transform: translateY(-2px); }
.cm-stat--red::before   { background: var(--cm-brand); }
.cm-stat--amber::before { background: var(--cm-amber); }
.cm-stat--green::before { background: var(--cm-green); }
.cm-stat--blue::before  { background: var(--cm-blue); }

.cm-stat__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.cm-stat--red .cm-stat__icon   { background: rgba(164,16,52,.08);  color: var(--cm-brand); }
.cm-stat--amber .cm-stat__icon { background: rgba(245,158,11,.10); color: #b45309; }
.cm-stat--green .cm-stat__icon { background: rgba(16,185,129,.10); color: #047857; }
.cm-stat--blue .cm-stat__icon  { background: rgba(59,130,246,.10); color: #1d4ed8; }

.cm-stat__num {
    font-family: var(--cm-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cm-ink);
    line-height: 1.1;
}
.cm-stat__lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--cm-ink-3);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 2px;
}

/* ════════════════════════════════════════════════
   FILTER ROW  (inside feed, above thread cards)
   ════════════════════════════════════════════════ */
.cm-filter {
    margin-bottom: 16px;
}

.cm-filter__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1.5px solid var(--cm-line);
    flex-wrap: wrap;
}

/* ─ Sort tabs ─ */
.cm-ftabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.cm-ftabs::-webkit-scrollbar { display: none; }

.cm-ftab {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cm-ink-3);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1.5px;
    transition: color .15s, border-color .15s;
}
.cm-ftab:hover { color: var(--cm-brand); text-decoration: none; }
.cm-ftab--active {
    color: var(--cm-brand) !important;
    border-bottom-color: var(--cm-brand);
    font-weight: 700;
}

/* ─ Search + course controls ─ */
.cm-filter__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: 8px;
}

.cm-search-wrap {
    position: relative;
}
.cm-search-ico {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cm-ink-4);
    font-size: 12px;
    pointer-events: none;
}
.cm-search {
    width: 190px;
    padding: 7px 12px 7px 32px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: var(--cm-radius-sm);
    font-family: var(--cm-sans);
    font-size: 13px;
    color: var(--cm-ink);
    background: var(--cm-paper);
    outline: none;
    transition: var(--cm-transition);
}
.cm-search:focus {
    border-color: var(--cm-brand);
    box-shadow: 0 0 0 3px rgba(164,16,52,.08);
}
.cm-search::placeholder { color: var(--cm-ink-4); }

.cm-fselect {
    padding: 7px 12px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: var(--cm-radius-sm);
    font-family: var(--cm-sans);
    font-size: 13px;
    color: var(--cm-ink);
    background: var(--cm-paper);
    outline: none;
    cursor: pointer;
    width: 150px;
    transition: var(--cm-transition);
}
.cm-fselect:focus { border-color: var(--cm-brand); }

.cm-search-btn {
    width: 32px;
    height: 32px;
    background: var(--cm-brand);
    color: #fff;
    border: none;
    border-radius: var(--cm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 12px;
    transition: var(--cm-transition);
}
.cm-search-btn:hover { background: var(--cm-brand-dark); }

/* ════════════════════════════════════════════════
   PAGE LAYOUT (feed + sidebar) — contained by the shared
   .container edges (see ig-theme.css "SHARED SITE CONTAINER"),
   not a bespoke full-bleed -10vw section.
   ════════════════════════════════════════════════ */
.cm-page-wrap {
    background: var(--cm-cream);
    padding: 28px 0 48px;
}
.cm-page__inner {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* ════════════════════════════════════════════════
   FEED + THREADS
   ════════════════════════════════════════════════ */
.cm-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── Thread Card — thin border, no shadow by default; a slim
   left accent only appears for pinned/solved to keep the list
   content-first instead of every row competing for attention. ── */
.cm-thread {
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-left: 3px solid var(--cm-line);
    border-radius: var(--cm-radius-md);
    margin-bottom: 10px;
    display: flex;
    align-items: stretch;
    gap: 0;
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
}
.cm-thread:hover {
    border-color: var(--cm-line-dark);
    box-shadow: 0 4px 14px rgba(17,24,39,.06);
}
.cm-thread--pinned { border-left-color: var(--cm-brand) !important; }
.cm-thread--solved { border-left-color: var(--cm-green) !important; }

/* ─── Vote ─────────────────────────────────────── */
.cm-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 14px;
    background: var(--cm-cream);
    border-right: 1px solid var(--cm-line);
    min-width: 56px;
    flex-shrink: 0;
}

.cm-vote__btn {
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: 6px;
    background: var(--cm-paper);
    color: var(--cm-ink-4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: var(--cm-transition);
}
.cm-vote__btn:hover { border-color: var(--cm-brand); color: var(--cm-brand); }
.cm-vote__btn.is-up   { background: var(--cm-brand); border-color: var(--cm-brand); color: #fff; }
.cm-vote__btn.is-down { background: var(--cm-ink-2); border-color: var(--cm-ink-2); color: #fff; }

.cm-vote__score {
    font-size: 14px;
    font-weight: 700;
    color: var(--cm-ink-2);
    line-height: 1;
    min-width: 18px;
    text-align: center;
}

/* ─── Thread Body ────────────────────────────── */
.cm-thread__body {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cm-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cm-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: .02em;
}
.cm-badge--pin    { background: #F3F4F6; color: #6B7280; }
.cm-badge--solved { background: #D1FAE5; color: #065F46; }
.cm-badge--hot    { background: #FEF3C7; color: #92400E; }
.cm-badge--new    { background: var(--cm-brand-light); color: var(--cm-brand); }
.cm-badge--instr  { background: #FBEEF0; color: #7A0D27; }

.cm-thread__title {
    font-family: var(--cm-sans);
    font-size: 15.5px;
    font-weight: 700;
    color: var(--cm-ink);
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}
.cm-thread__title:hover { color: var(--cm-brand); text-decoration: none; }

.cm-thread__excerpt {
    font-size: 13px;
    color: var(--cm-ink-3);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cm-thread__foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--cm-line);
}

.cm-thread__author {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.cm-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--cm-line);
    flex-shrink: 0;
}

.cm-thread__name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cm-ink-2);
}
.cm-thread__sep { color: var(--cm-ink-4); font-size: 11px; }
.cm-thread__time {
    font-size: 11.5px;
    color: var(--cm-ink-4);
}

.cm-thread__tags, .cm-thread__meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-thread__course {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--cm-brand);
    background: var(--cm-brand-light);
    padding: 3px 9px;
    border-radius: 100px;
    text-decoration: none;
    transition: var(--cm-transition);
}
.cm-thread__course:hover { background: var(--cm-brand); color: #fff; text-decoration: none; }
.cm-thread__course--gen { color: var(--cm-ink-3); background: var(--cm-cream); text-decoration: none; }

.cm-meta, .cm-meta--answered {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--cm-ink-4);
}
.cm-meta--answered { color: #065F46; font-weight: 600; }

/* ─── Empty State ────────────────────────────── */
.cm-empty {
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-lg);
    padding: 48px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.cm-empty__ico {
    width: 60px;
    height: 60px;
    background: var(--cm-brand-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--cm-brand);
    margin-bottom: 4px;
}
.cm-empty h3 { font-size: 18px; font-weight: 700; color: var(--cm-ink); margin: 0; }
.cm-empty p  { color: var(--cm-ink-3); margin: 0; font-size: 13.5px; }

/* ─── Pagination ─────────────────────────────── */
.cm-pagination {
    padding-top: 20px;
}
.cm-pagination .pagination {
    gap: 4px;
    flex-wrap: wrap;
}
.cm-pagination .page-link {
    border-radius: var(--cm-radius-sm) !important;
    border: 1.5px solid var(--cm-line) !important;
    color: var(--cm-ink-2) !important;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    transition: var(--cm-transition);
}
.cm-pagination .page-item.active .page-link {
    background: var(--cm-brand) !important;
    border-color: var(--cm-brand) !important;
    color: #fff !important;
}
.cm-pagination .page-link:hover {
    background: var(--cm-brand-light) !important;
    border-color: var(--cm-brand) !important;
    color: var(--cm-brand) !important;
}

/* ════════════════════════════════════════════════
   SIDEBAR — each box gets its own colored top bar
   (same technique as .cgp-report-card on the Guidelines
   page) so the sidebar reads as distinct destinations at a
   glance instead of four identical gray boxes.
   ════════════════════════════════════════════════ */
.cm-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 20px;
}

.cm-side-cta {
    background: var(--cm-brand);
    border-radius: var(--cm-radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: rgba(255,255,255,.9);
    font-size: 13px;
    line-height: 1.6;
}
.cm-side-cta p { margin: 0; }

.cm-side-box {
    position: relative;
    overflow: hidden;
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
}
.cm-side-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: var(--cm-ink-4);
}
.cm-side-box--topics::before      { background: var(--cm-blue); }
.cm-side-box--stats::before       { background: var(--cm-blue); }
.cm-side-box--contributors::before { background: var(--cm-amber); }
.cm-side-box--trending::before    { background: var(--cm-green); }
.cm-side-box--guidelines::before  { background: var(--cm-brand); }

/* Each box gets a faint full-card tint of its own color, fading to plain
   white toward the bottom, instead of just a top accent bar — reads as a
   properly colored card rather than a gray box with a stripe. */
.cm-side-box--topics        { background: linear-gradient(180deg, rgba(59,130,246,.06), var(--cm-paper) 140px); border-color: rgba(59,130,246,.22); }
.cm-side-box--stats         { background: linear-gradient(180deg, rgba(59,130,246,.06), var(--cm-paper) 140px); border-color: rgba(59,130,246,.22); }
.cm-side-box--contributors  { background: linear-gradient(180deg, rgba(245,158,11,.06), var(--cm-paper) 140px); border-color: rgba(245,158,11,.22); }
.cm-side-box--trending      { background: linear-gradient(180deg, rgba(16,185,129,.06), var(--cm-paper) 140px); border-color: rgba(16,185,129,.22); }
.cm-side-box--guidelines    { background: linear-gradient(180deg, rgba(164,16,52,.06), var(--cm-paper) 140px); border-color: rgba(164,16,52,.22); }

.cm-side-box__title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--cm-ink-3);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px 12px;
    border-bottom: 1px solid var(--cm-line);
}
.cm-side-box__title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 21px;
    height: 21px;
    border-radius: 6px;
    color: var(--cm-brand);
    background: rgba(164,16,52,.1);
    font-size: 10.5px;
    flex-shrink: 0;
}
.cm-side-box--topics .cm-side-box__title i       { color: #1d4ed8; background: rgba(59,130,246,.12); }
.cm-side-box--stats .cm-side-box__title i        { color: #1d4ed8; background: rgba(59,130,246,.12); }
.cm-side-box--contributors .cm-side-box__title i { color: #b45309; background: rgba(245,158,11,.12); }
.cm-side-box--trending .cm-side-box__title i     { color: #047857; background: rgba(16,185,129,.12); }

.cm-side-box > *:not(.cm-side-box__title) {
    padding: 12px 16px;
}
.cm-side-box > *:not(.cm-side-box__title):last-child {
    padding-bottom: 16px;
}

.cm-tags {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cm-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: #1d4ed8;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 7px;
    background: rgba(59,130,246,.07);
    border: 1px solid rgba(59,130,246,.18);
    transition: var(--cm-transition);
}
.cm-tag:hover { border-color: #1d4ed8; background: rgba(59,130,246,.14); color: #1d4ed8; text-decoration: none; }

.cm-tag__count {
    font-size: 10.5px;
    font-weight: 700;
    background: #1d4ed8;
    color: #fff;
    padding: 2px 7px;
    border-radius: 100px;
}

.cm-contribs {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.cm-contrib {
    display: flex;
    align-items: center;
    gap: 9px;
}
.cm-contrib__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 9.5px;
    font-weight: 800;
    color: #fff;
    background: var(--cm-ink-4);
    flex-shrink: 0;
}
.cm-contrib:nth-child(1) .cm-contrib__rank { background: linear-gradient(135deg,#FBBF24,#D97706); }
.cm-contrib:nth-child(2) .cm-contrib__rank { background: linear-gradient(135deg,#CBD5E1,#6B7280); }
.cm-contrib:nth-child(3) .cm-contrib__rank { background: linear-gradient(135deg,#D97706,#92400E); }
.cm-contrib__name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--cm-ink-2);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cm-contrib__score {
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    background: rgba(245,158,11,.12);
    padding: 2px 7px;
    border-radius: 100px;
    flex-shrink: 0;
}

.cm-trending {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.cm-trend-item {
    display: flex;
    align-items: baseline;
    gap: 9px;
    text-decoration: none;
    padding: 6px 8px;
    margin: 0 -8px;
    border-radius: 7px;
    border-bottom: 1px solid rgba(16,185,129,.14);
    transition: background .15s, color .15s;
}
.cm-trend-item:last-child { border-bottom: none; }
.cm-trend-item:hover { text-decoration: none; background: rgba(16,185,129,.08); }

.cm-trend-item__score {
    font-size: 11px;
    font-weight: 700;
    color: #047857;
    background: rgba(16,185,129,.12);
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.cm-trend-item__title {
    font-size: 12.5px;
    color: var(--cm-ink-2);
    line-height: 1.4;
    transition: color .15s;
}
.cm-trend-item:hover .cm-trend-item__title { color: var(--cm-brand); }

.cm-rules {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cm-rules li {
    font-size: 12.5px;
    color: var(--cm-ink-2);
    padding-left: 18px;
    position: relative;
    line-height: 1.5;
}
.cm-rules li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--cm-brand);
    font-weight: 700;
    font-size: 11px;
    line-height: 1.6;
}

/* ════════════════════════════════════════════════
   CTA BAND — flat, borderless, on the shared cream page
   background (same treatment as the Guidelines page's closing
   CTA / .cgp-cta-footer), instead of a padded crimson block.
   ════════════════════════════════════════════════ */
.cm-cta {
    background: var(--cm-cream);
    padding: 40px 0 4px;
    text-align: center;
}
.cm-cta__inner {
    max-width: 560px;
    margin: 0 auto;
}
.cm-cta__title {
    font-family: var(--cm-serif);
    font-size: clamp(1.375rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--cm-ink);
    margin: 0 0 8px;
    line-height: 1.25;
}
.cm-cta__sub {
    font-size: 14px;
    color: var(--cm-ink-3);
    margin: 0 0 18px;
    line-height: 1.6;
}
.cm-cta__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ════════════════════════════════════════════════
   BUTTONS — same shape/weight as the shared .igaf-btn-primary
   used on the Affiliate/Guidelines pages.
   ════════════════════════════════════════════════ */
.cm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--cm-radius-sm);
    font-family: var(--cm-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--cm-transition);
    border: 1.5px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.cm-btn:hover { text-decoration: none; }

.cm-btn--primary {
    background: var(--cm-brand);
    color: #fff !important;
    border-color: var(--cm-brand);
    box-shadow: 0 6px 16px rgba(164,16,52,.22);
}
.cm-btn--primary:hover { background: var(--cm-brand-dark); border-color: var(--cm-brand-dark); }

.cm-btn--ghost {
    background: transparent;
    color: var(--cm-brand) !important;
    border-color: rgba(164,16,52,.4);
}
.cm-btn--ghost:hover { border-color: var(--cm-brand); background: rgba(164,16,52,.06); }

.cm-btn--white {
    background: #fff;
    color: var(--cm-brand) !important;
    border-color: var(--cm-line);
}
.cm-btn--white:hover { background: var(--cm-cream); }

.cm-btn--white-outline {
    background: transparent;
    color: var(--cm-ink-2) !important;
    border-color: var(--cm-line-dark);
}
.cm-btn--white-outline:hover { border-color: var(--cm-brand); color: var(--cm-brand) !important; }

.cm-btn--full { width: 100%; justify-content: center; }

/* ════════════════════════════════════════════════
   FAB
   ════════════════════════════════════════════════ */
.cm-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    background: var(--cm-brand);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(164,16,52,.35);
    z-index: 200;
    transition: var(--cm-transition);
}
.cm-fab:hover { transform: scale(1.06); background: var(--cm-brand-dark); }

/* ════════════════════════════════════════════════
   MODAL — thin border instead of a heavy shadow, matching the
   minimal-decoration cards used elsewhere on the page.
   ════════════════════════════════════════════════ */
.cm-modal {
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius-lg);
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(17,24,39,.14);
}

.cm-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--cm-line);
    background: var(--cm-cream);
}
.cm-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cm-ink);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}
.cm-modal__title i { color: var(--cm-brand); }
.cm-modal__close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--cm-ink-3);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color .15s;
}
.cm-modal__close:hover { color: var(--cm-ink); }

.cm-modal__body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--cm-paper);
}

.cm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cm-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cm-ink-2);
}
.cm-req { color: var(--cm-brand); }
.cm-opt { color: var(--cm-ink-4); font-weight: 400; }

.cm-input, .cm-textarea, .cm-select-full {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: var(--cm-radius-sm);
    font-family: var(--cm-sans);
    font-size: 13.5px;
    color: var(--cm-ink);
    background: var(--cm-paper);
    outline: none;
    transition: var(--cm-transition);
}
.cm-input:focus, .cm-textarea:focus, .cm-select-full:focus {
    border-color: var(--cm-brand);
    box-shadow: 0 0 0 3px rgba(164,16,52,.1);
}
.cm-textarea { resize: vertical; line-height: 1.6; }

.cm-modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--cm-line);
    background: var(--cm-cream);
}

/* ════════════════════════════════════════════════
   THREAD PAGE  (ft-*) — contained by the shared .container
   edges rather than a bespoke full-bleed -10vw section.
   ════════════════════════════════════════════════ */
.ft-page-wrap {
    background: var(--cm-cream);
    padding: 24px 0 64px;
    min-height: 60vh;
}

.ft-layout__inner {
    min-width: 0;
}

/* ─ Breadcrumb ─ */
.ft-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--cm-ink-4);
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.ft-breadcrumb a {
    color: var(--cm-brand);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.ft-breadcrumb a:hover { text-decoration: underline; }
.ft-breadcrumb > i { font-size: 9px; }
.ft-breadcrumb > span {
    color: var(--cm-ink-3);
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─ Question Block — flat card, consistent with every other page
   header on the site (no gradient wash). ─ */
.ft-question {
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-left: 3px solid var(--cm-brand);
    border-radius: var(--cm-radius-lg);
    display: flex;
    gap: 0;
    overflow: hidden;
    margin-bottom: 8px;
}

.ft-vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 18px 14px;
    background: var(--cm-cream);
    border-right: 1px solid var(--cm-line);
    min-width: 56px;
    flex-shrink: 0;
}

.ft-vote-btn {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: 7px;
    background: var(--cm-paper);
    color: var(--cm-ink-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: var(--cm-transition);
}
.ft-vote-btn:hover { border-color: var(--cm-line-dark); color: var(--cm-ink); }
.ft-vote-btn--active { background: var(--cm-brand); border-color: var(--cm-brand); color: #fff; }

.ft-vote-score {
    font-size: 15px;
    font-weight: 700;
    color: var(--cm-ink);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ft-best-btn {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: 7px;
    background: transparent;
    color: var(--cm-ink-4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    margin-top: 3px;
    transition: var(--cm-transition);
}
.ft-best-btn:hover { border-color: var(--cm-green); color: #047857; }
.ft-best-btn--active { background: var(--cm-green); border-color: var(--cm-green); color: #fff; }
.ft-best-icon { font-size: 15px; color: #047857; margin-top: 3px; }

.ft-question-body {
    flex: 1;
    min-width: 0;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ft-question-title {
    font-family: var(--cm-serif);
    font-size: 27px;
    font-weight: 700;
    color: var(--cm-ink);
    line-height: 1.25;
    margin: 0;
}

.ft-question-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    color: var(--cm-ink-3);
}

.ft-meta-course {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--cm-brand);
    background: var(--cm-brand-light);
    padding: 3px 9px;
    border-radius: 100px;
    text-decoration: none;
}
.ft-meta-course:hover { text-decoration: none; opacity: .85; }

.ft-meta-lesson { display: flex; align-items: center; gap: 5px; }
.ft-meta-time   { display: flex; align-items: center; gap: 5px; }
.ft-meta-views  { display: flex; align-items: center; gap: 5px; }

.ft-question-desc {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--cm-ink-2);
    white-space: pre-wrap;
}

/* ─ Author Row ─ */
.ft-author-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-top: 12px;
    border-top: 1px solid var(--cm-line);
    margin-top: 2px;
}

.ft-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--cm-line);
    flex-shrink: 0;
}

.ft-author-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--cm-ink-2);
}

.ft-author-label {
    font-size: 11.5px;
    color: var(--cm-ink-4);
}

.ft-delete-btn {
    margin-left: auto;
    background: none;
    border: 1.5px solid var(--cm-line-dark);
    color: var(--cm-ink-4);
    font-size: 11.5px;
    padding: 5px 11px;
    border-radius: var(--cm-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--cm-transition);
}
.ft-delete-btn:hover { border-color: #dc2626; color: #dc2626; }

.ft-report-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--cm-ink-4);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 4px;
    cursor: pointer;
    transition: var(--cm-transition);
}
.ft-report-btn:hover { color: var(--cm-ink-2); text-decoration: underline; }
.ft-report-btn--done {
    cursor: default;
    color: var(--cm-ink-4);
}
.ft-report-btn--done:hover { color: var(--cm-ink-4); text-decoration: none; }

/* ─ Replies Section ─ */
.ft-replies-header {
    margin: 24px 0 14px;
}
.ft-replies-title {
    font-family: var(--cm-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--cm-ink);
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--cm-line);
}

.ft-replies-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.ft-reply {
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-md);
    display: flex;
    overflow: hidden;
}
.ft-reply--best {
    border-color: var(--cm-green);
    border-left-width: 3px;
}

.ft-reply-body {
    flex: 1;
    min-width: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ft-best-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #065F46;
    background: #D1FAE5;
    padding: 3px 10px;
    border-radius: 100px;
    width: fit-content;
}

.ft-reply-text {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--cm-ink-2);
    white-space: pre-wrap;
}

.ft-no-replies {
    background: var(--cm-paper);
    border: 1.5px dashed var(--cm-line-dark);
    border-radius: var(--cm-radius-md);
    padding: 18px 20px;
    text-align: left;
    color: var(--cm-ink-4);
}
.ft-no-replies p { margin: 0; font-size: 13px; }

/* ─ Reply Form ─ */
.ft-reply-form-wrap {
    margin-top: 28px;
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-lg);
    padding: 22px;
}
.ft-form-title {
    font-family: var(--cm-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--cm-ink);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cm-line);
}

.ft-reply-textarea {
    width: 100%;
    /* frontend.css has a bare `textarea{height:50px}` rule that otherwise
       wins on this property (this class never set height), squashing the
       6-row textarea down to one cramped line. */
    height: auto;
    min-height: 150px;
    border: 1.5px solid var(--cm-line-dark);
    border-radius: var(--cm-radius-sm);
    padding: 13px 15px;
    font-family: var(--cm-sans);
    font-size: 13.5px;
    color: var(--cm-ink);
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--cm-transition);
    background: var(--cm-paper);
}
.ft-reply-textarea:focus {
    border-color: var(--cm-brand);
    box-shadow: 0 0 0 3px rgba(164,16,52,.1);
}
.ft-reply-textarea::placeholder { color: var(--cm-ink-4); }

.ft-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.ft-char-count {
    font-size: 11.5px;
    color: var(--cm-ink-4);
}

.ft-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cm-brand);
    color: #fff;
    border: none;
    border-radius: var(--cm-radius-sm);
    padding: 10px 20px;
    font-family: var(--cm-sans);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--cm-transition);
}
.ft-submit-btn:hover { background: var(--cm-brand-dark); }
.ft-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

.ft-login-cta {
    margin-top: 28px;
    background: var(--cm-paper);
    border: 1.5px solid var(--cm-line);
    border-radius: var(--cm-radius-md);
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--cm-ink-3);
}
.ft-login-link {
    color: var(--cm-brand);
    font-weight: 700;
    text-decoration: none;
}
.ft-login-link:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════
   THREAD PAGE — ON-SYSTEM SIDEBAR OVERRIDE
   Scoped to .ft-page-wrap so the Community index page's
   colorful topic/contributor/trending cards (out of scope
   here) are left untouched — only the thread page's Thread
   Stats + Community Rules cards are flattened to the shared
   white/#E5E7EB card system, no blue theme, no gradients.
   ════════════════════════════════════════════════ */
.ft-page-wrap .cm-side-box--stats,
.ft-page-wrap .cm-side-box--guidelines {
    background: var(--cm-paper);
    border-color: var(--cm-line);
}
.ft-page-wrap .cm-side-box--stats::before,
.ft-page-wrap .cm-side-box--guidelines::before {
    display: none;
}
.ft-page-wrap .cm-side-box__title {
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
    font-weight: 700;
    color: var(--cm-ink);
    padding: 14px 16px 12px;
}
.ft-page-wrap .cm-side-box__title i {
    display: none;
}

.ft-page-wrap .cm-tags {
    gap: 0;
}
.ft-page-wrap .cm-tag {
    background: none;
    border: none;
    border-radius: 0;
    padding: 8px 0;
    color: var(--cm-ink-3);
    font-size: 13px;
    cursor: default;
}
.ft-page-wrap .cm-tag:not(:last-child) {
    border-bottom: 1px solid var(--cm-line);
}
.ft-page-wrap .cm-tag:hover {
    background: none;
    border-color: transparent;
    color: var(--cm-ink-3);
}
.ft-page-wrap .cm-tag:not(:last-child):hover {
    border-bottom-color: var(--cm-line);
}
.ft-page-wrap .cm-tag i {
    color: var(--cm-ink-4);
    width: 14px;
    text-align: center;
    margin-right: 2px;
}
.ft-page-wrap .cm-tag__count {
    background: none;
    color: var(--cm-ink);
    font-weight: 700;
    font-size: 13px;
    padding: 0;
    border-radius: 0;
    font-variant-numeric: tabular-nums;
}

.ft-guidelines-link {
    display: block;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid var(--cm-line);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cm-brand);
    text-decoration: none;
}
.ft-guidelines-link:hover {
    color: var(--cm-brand-dark);
    text-decoration: underline;
}

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .cm-stats__grid { grid-template-columns: repeat(2, 1fr); }
    .cm-page__inner { grid-template-columns: 1fr; }
    .cm-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .cm-filter__top { gap: 0; }
    .cm-filter__controls { padding-bottom: 8px; flex-wrap: wrap; }
    .cm-search { width: 100%; }
    .cm-fselect { width: 100%; }
    .cm-cta__actions { flex-direction: column; align-items: stretch; }
    .cm-sidebar { grid-template-columns: 1fr; }
    .cm-fab { display: flex; }
    .ft-question-title { font-size: 18px; }
}

@media (max-width: 480px) {
    .cm-stats__grid { grid-template-columns: 1fr; }
    .cm-thread__foot { gap: 8px; }
    .cm-thread__author { flex-wrap: wrap; }
}
