/* Forum pages. Everything is scoped under .fq so it can't leak into the rest of the site.
   Modals render outside .fq, so they get the tokens too. */
.fq, .fq-modal {
    --fq-ink: #0d1d2d;
    --fq-text: #2b3b4e;
    --fq-muted: #66768a;
    --fq-line: #e3e8ef;
    --fq-surface: #f4f7fa;
    --fq-brand: #0861a7;
    --fq-brand-dark: #064e87;
    --fq-brand-soft: #e9f1f9;
    --fq-radius: 10px;
}
.fq {
    color-scheme: light;
    background: #fff;
    color: var(--fq-text);
    font-size: 15px;
    line-height: 1.6;
}
.fq *, .fq *::before, .fq *::after { box-sizing: border-box; }
.fq h1, .fq h2, .fq h3, .fq p { margin: 0; }
.fq a { color: inherit; text-decoration: none; }
.fq a:hover { color: var(--fq-brand); }
.fq :focus-visible { outline: 2px solid var(--fq-brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Page head ---------- */
/* Starts at the navbar's navy so the two read as one block, then opens into the brand blue. */
.fq-head {
    background: linear-gradient(115deg, #0d1d2d 0%, #0b3559 50%, var(--fq-brand) 100%);
    color: #fff;
    padding: 36px 0 36px;
}
.fq-crumbs { margin-bottom: 18px; font-size: 13px; }
.fq-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.fq-crumbs li { display: inline-flex; align-items: center; min-width: 0; color: rgba(255, 255, 255, .65); }
.fq-crumbs li + li::before {
    content: ""; width: 6px; height: 6px; margin: 0 10px;
    border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
    transform: rotate(45deg); opacity: .6;
}
.fq .fq-crumbs a { color: rgba(255, 255, 255, .7); }
.fq .fq-crumbs a:hover { color: #fff; text-decoration: underline; }
.fq-crumbs [aria-current] { color: #fff; font-weight: 500; max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fq-head__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 32px; }
.fq-head__text { max-width: 640px; }
.fq-title { font-size: 36px; line-height: 1.2; font-weight: 700; color: #fff; letter-spacing: -.01em; overflow-wrap: anywhere; }
.fq .fq-lede { margin-top: 10px; color: rgba(255, 255, 255, .78); font-size: 16px; }
.fq-head__actions { display: flex; gap: 12px; align-items: center; flex: 0 1 480px; }
.fq-head .fq-btn { background: #fff; border-color: #fff; color: var(--fq-ink) !important; border-radius: 999px; height: 48px; padding: 0 22px; }
.fq-head .fq-btn:hover { background: var(--fq-brand-soft); border-color: var(--fq-brand-soft); }
.fq-head .fq-post-meta { color: rgba(255, 255, 255, .75); }
.fq-head .fq-author__name { color: #fff; }
.fq-head .fq-role { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---------- Buttons ---------- */
.fq-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid var(--fq-brand);
    background: var(--fq-brand); color: #fff !important; font-size: 15px; font-weight: 600;
    line-height: 1.4; white-space: nowrap; cursor: pointer; transition: background .15s;
}
.fq-btn:hover { background: var(--fq-brand-dark); border-color: var(--fq-brand-dark); }
.fq-btn--ghost { background: #fff; color: var(--fq-ink) !important; border-color: var(--fq-line); }
.fq-btn--ghost:hover { background: var(--fq-surface); border-color: var(--fq-line); }
.fq-btn--sm { padding: 6px 12px; font-size: 14px; }

/* ---------- Search ---------- */
.fq-search { position: relative; flex: 1 1 auto; min-width: 0; }
.fq-search input {
    width: 100%; height: 48px; padding: 0 18px 0 46px; font-size: 15px;
    border: 0; border-radius: 999px; background: #fff; color: var(--fq-ink);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}
.fq-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .45); }
.fq-search__icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--fq-muted); pointer-events: none; }
.fq-search__results {
    position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px;
    list-style: none; background: #fff; border: 1px solid var(--fq-line); border-radius: 8px;
    box-shadow: 0 12px 32px rgba(13, 29, 45, .12); max-height: 320px; overflow-y: auto;
}
.fq-search__results li a, .fq-search__results li.no-search-result-found { display: block; padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.fq-search__results li a:hover { background: var(--fq-surface); }
.fq-search__results li.no-search-result-found { color: var(--fq-muted); }

/* ---------- Body grid ---------- */
.fq-body { padding: 40px 0 80px; }
.fq-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.fq-section-title { font-size: 18px; font-weight: 600; color: var(--fq-ink); margin-bottom: 14px; }

/* ---------- Category cards ---------- */
.fq-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 32px; }
.fq-catcard {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-width: 0;
    border: 1px solid var(--fq-line); border-radius: var(--fq-radius); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.fq-catcard:hover { border-color: var(--fq-brand); box-shadow: 0 6px 18px rgba(13, 29, 45, .08); }
.fq-catcard.is-active { border-color: var(--fq-brand); background: var(--fq-brand-soft); }
.fq-catcard__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fq-catcard__name { font-size: 15px; font-weight: 600; color: var(--fq-ink); line-height: 1.3; overflow-wrap: anywhere; }
.fq-catcard__count { font-size: 13px; color: var(--fq-muted); }
.fq-catcard__arrow { font-size: 12px; color: var(--fq-muted); }
.fq-catcard:hover .fq-catcard__arrow, .fq-catcard.is-active .fq-catcard__arrow { color: var(--fq-brand); }

/* ---------- List head (count + sort) ---------- */
.fq-listhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.fq-listhead__count { font-size: 15px; color: var(--fq-muted); }
.fq-listhead__count strong { color: var(--fq-ink); font-weight: 700; }
.fq-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fq-muted); }
.fq-sort label { margin: 0; }
.fq-sort select {
    height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--fq-line); border-radius: 8px; background-color: #fff;
    font-size: 14px; font-weight: 500; color: var(--fq-ink); cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2366768a' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.fq-sort select:focus { outline: none; border-color: var(--fq-brand); box-shadow: 0 0 0 3px var(--fq-brand-soft); }

/* ---------- Question list ---------- */
.fq-list { border: 1px solid var(--fq-line); border-radius: var(--fq-radius); background: #fff; }
.fq-row { padding: 20px 22px; transition: background .15s; }
.fq-row:hover { background: #fafcfe; }
.fq-row + .fq-row { border-top: 1px solid var(--fq-line); }
.fq-row__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fq-row__title { font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--fq-ink); overflow-wrap: anywhere; }
.fq-row__excerpt {
    margin-top: 6px; color: var(--fq-muted); font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fq-row__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; }
.fq-row__foot .fq-meta { margin-top: 0; }
.fq-row__cat { font-weight: 500; color: var(--fq-brand) !important; }
.fq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--fq-muted); }

/* Answers / views / likes. Answers turn brand blue once a question has any. */
.fq-counts { display: flex; align-items: center; gap: 4px; }
.fq-count {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
    border: 0; border-radius: 999px; background: none; font-size: 13px; font-weight: 500; color: var(--fq-muted);
}
.fq-count.is-answered { background: var(--fq-brand-soft); color: var(--fq-brand) !important; }
.fq-count--btn { cursor: pointer; }
.fq-count--btn:hover { background: var(--fq-surface); color: var(--fq-ink); }
.fq-icon-btn {
    flex-shrink: 0; width: 32px; height: 32px; margin: -4px -6px 0 0; border: 0; border-radius: 8px;
    background: none; color: var(--fq-muted); cursor: pointer;
}
.fq-icon-btn:hover { background: var(--fq-surface); color: var(--fq-brand); }
.fq-card__actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px -10px -8px; padding-top: 12px; border-top: 1px solid var(--fq-line); }

/* ---------- Author ---------- */
.fq-author { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.fq-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--fq-surface); }
.fq-author--md .fq-avatar { width: 40px; height: 40px; }
.fq-author__name { font-weight: 500; color: var(--fq-ink); }
.fq-author--md .fq-author__name { display: block; font-size: 15px; line-height: 1.3; }
.fq-author__sub { display: block; font-size: 13px; color: var(--fq-muted); }
.fq-role { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--fq-surface); color: var(--fq-muted); }
.fq-role--instructor, .fq-role--admin { background: var(--fq-brand-soft); color: var(--fq-brand); }

/* ---------- Sidebar ---------- */
.fq-aside { display: grid; gap: 20px; }
.fq-box { border: 1px solid var(--fq-line); border-radius: var(--fq-radius); padding: 20px; background: #fff; }
.fq-box h2 { font-size: 15px; font-weight: 600; color: var(--fq-ink); margin-bottom: 12px; }
.fq-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fq-stats strong { display: block; font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--fq-ink); }
.fq-stats span { font-size: 13px; color: var(--fq-muted); }
.fq-links { list-style: none; margin: 0; padding: 0; }
.fq-links li + li { margin-top: 2px; }
.fq-links a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 6px; font-size: 14px; }
.fq-links a:hover { background: var(--fq-surface); }
.fq-links a.is-active { background: var(--fq-brand-soft); color: var(--fq-brand); font-weight: 500; }
.fq-links__end { margin-left: auto; font-size: 13px; color: var(--fq-muted); }
.fq-cat-icon {
    width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fq-brand-soft); color: var(--fq-brand); font-size: 13px; font-weight: 700;
}
.fq-cat-icon[hidden] { display: none; }
.fq-cat-icon--lg { width: 40px; height: 40px; border-radius: 10px; font-size: 16px; }
.fq-tips { margin: 0; padding-left: 18px; font-size: 14px; color: var(--fq-muted); }
.fq-tips li + li { margin-top: 8px; }
.fq-box p.fq-row__excerpt { -webkit-line-clamp: unset; margin: 0; }
.fq-box__more { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--fq-brand) !important; }

/* ---------- Post details ---------- */
.fq-post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 12px; font-size: 14px; color: var(--fq-muted); }
.fq-card { border: 1px solid var(--fq-line); border-radius: var(--fq-radius); padding: 24px; background: #fff; }
.fq-prose { color: var(--fq-text); overflow-wrap: anywhere; }
.fq-prose p, .fq-prose ul, .fq-prose ol { margin: 0 0 12px; }
.fq-prose > :last-child { margin-bottom: 0; }
.fq-prose ul, .fq-prose ol { padding-left: 22px; }
.fq-prose img { max-width: 100%; height: auto; border-radius: 6px; }
.fq-prose a { color: var(--fq-brand); text-decoration: underline; }

.fq-answers { margin-top: 36px; }
.fq-answer { padding: 20px 0; }
.fq-answer + .fq-answer { border-top: 1px solid var(--fq-line); }
.fq-answer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.fq-answer__actions { display: flex; align-items: center; gap: 12px; margin: 12px 0 0 -10px; }
.fq-link-btn { background: none; border: 0; padding: 0; font-size: 14px; font-weight: 500; color: var(--fq-brand); cursor: pointer; }
.fq-link-btn:hover { text-decoration: underline; }
.fq-replies { margin-top: 16px; padding-left: 18px; border-left: 2px solid var(--fq-line); display: grid; gap: 16px; }
.fq-reply .fq-prose { font-size: 14px; margin-top: 8px; }

.fq-compose { margin-top: 28px; }
.fq-compose .fq-btn { margin-top: 16px; }
.fq-notice {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-radius: var(--fq-radius); background: var(--fq-surface); border: 1px solid var(--fq-line);
}
.fq-empty { padding: 48px 24px; text-align: center; color: var(--fq-muted); }

/* ---------- Infinite scroll ---------- */
.fq-more { display: flex; justify-content: center; padding-top: 24px; }
.fq-more [hidden] { display: none !important; }
.fq-loader { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--fq-muted); }
.fq-spinner { width: 18px; height: 18px; border: 2px solid var(--fq-line); border-top-color: var(--fq-brand); border-radius: 50%; animation: fq-spin .7s linear infinite; }
@keyframes fq-spin { to { transform: rotate(360deg); } }
.fq-empty p { margin-bottom: 16px; }

/* ---------- Forms ---------- */
.fq-field { margin-bottom: 20px; }
.fq-field label { display: block; font-size: 14px; font-weight: 600; color: var(--fq-ink); margin-bottom: 6px; }
.fq-field__hint { display: block; margin-top: 6px; font-size: 13px; color: var(--fq-muted); }
.fq-field__error { display: block; margin-top: 6px; font-size: 13px; color: #c0392b; }
.fq .note-editor.note-frame { border-color: var(--fq-line); border-radius: 8px; }

/* ---------- Leaderboard ---------- */
.fq-board { list-style: none; margin: 0; padding: 0; }
.fq-board li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 20px; }
.fq-board li + li { border-top: 1px solid var(--fq-line); }
.fq-board__rank { font-size: 15px; font-weight: 700; color: var(--fq-muted); text-align: center; }
.fq-board li:nth-child(-n+3) .fq-board__rank { color: var(--fq-brand); }
.fq-board__count { font-size: 14px; color: var(--fq-muted); white-space: nowrap; }
.fq-board__count strong { color: var(--fq-ink); font-size: 16px; }
.fq .pagination { margin: 24px 0 0; justify-content: center; }

/* ---------- Modal ---------- */

/* ---------- Likes, saves, reports, mentions ---------- */
/* Each toggle carries an outline and a filled icon; aria-pressed picks one. */
[aria-pressed="true"] .fq-when-off, [aria-pressed="false"] .fq-when-on, :not([aria-pressed]) > .fq-when-on { display: none; }
.fq-count--btn[aria-pressed="true"], .fq-icon-btn[aria-pressed="true"] { color: var(--fq-brand); }
.fq-count--btn:disabled, .fq-icon-btn:disabled { opacity: .6; cursor: wait; }
.fq-pin {
    display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 1px 8px; vertical-align: 2px;
    border-radius: 999px; background: #fff4e0; color: #9a5b00; font-size: 12px; font-weight: 600;
}
.fq-mention { color: var(--fq-brand); font-weight: 600; background: var(--fq-brand-soft); border-radius: 4px; padding: 0 3px; }
.fq-link-btn--muted { color: var(--fq-muted); font-weight: 400; }
.fq-box--link { display: flex; align-items: center; gap: 10px; padding: 14px 20px; font-size: 15px; font-weight: 600; color: var(--fq-ink) !important; }
.fq-box--link:hover, .fq-box--link.is-active { border-color: var(--fq-brand); }
.fq-box--link .fq-catcard__arrow { margin-left: auto; }
.fq-legend { font-size: 14px; font-weight: 600; color: var(--fq-ink); margin-bottom: 8px; }
.fq-radio { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; font-weight: 400 !important; cursor: pointer; }
.fq-radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--fq-brand); }
.fq .note-hint-popover .note-hint-item.active { background: var(--fq-brand-soft); color: var(--fq-brand); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .fq-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .fq-head__actions { flex-basis: 100%; }
}
@media (max-width: 575.98px) {
    .fq-head { padding: 24px 0 24px; }
    .fq-title { font-size: 26px; }
    .fq-lede { font-size: 15px; }
    .fq-head__actions { flex-wrap: wrap; }
    .fq-head__actions .fq-btn { flex: 1 1 100%; }
    .fq-body { padding: 28px 0 56px; }
    .fq-row { padding: 16px; }
    .fq-row__foot { flex-direction: column; align-items: flex-start; }
    .fq-counts { margin-left: -10px; }
    /* Cards scroll sideways on phones instead of stacking above the list. */
    .fq-cats { grid-auto-flow: column; grid-auto-columns: 220px; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; margin-bottom: 24px; padding-bottom: 2px; }
    .fq-cats::-webkit-scrollbar { display: none; }
    .fq-card { padding: 18px; }
    .fq-board li { padding: 12px 14px; gap: 10px; }
    .fq-replies { padding-left: 12px; }
    .fq-board .fq-role { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .fq * { transition: none !important; }
    .fq-spinner { animation-duration: 2s; }
}

/* ---------- Standalone basics ----------
   These pages sit on the landing layout (Tailwind, no Bootstrap), so the few Bootstrap
   pieces they used are defined here. */
.fq .container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.fq .text-muted { color: var(--fq-muted); }
.fq-contrib { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

.fq-field .form-control, .fq-field .form-select, .fq-input {
    display: block; width: 100%; height: 44px; padding: 0 12px; font-size: 15px; color: var(--fq-ink);
    background: #fff; border: 1px solid var(--fq-line); border-radius: 8px;
}
.fq-input { height: auto; padding: 10px 12px; }
.fq-field .form-control:focus, .fq-field .form-select:focus, .fq-input:focus { outline: none; border-color: var(--fq-brand); box-shadow: 0 0 0 3px var(--fq-brand-soft); }

/* ---------- Modal (native <dialog>) ---------- */
dialog.fq-modal { color-scheme: light; background: #fff; width: min(500px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 0; border-radius: var(--fq-radius); color: var(--fq-text); box-shadow: 0 20px 50px rgba(13, 29, 45, .3); }
dialog.fq-modal--lg { width: min(800px, calc(100% - 32px)); }
dialog.fq-modal::backdrop { background: rgba(13, 29, 45, .55); }
.fq-modal__head, .fq-modal__foot { display: flex; align-items: center; padding: 14px 20px; }
.fq-modal__head { justify-content: space-between; border-bottom: 1px solid var(--fq-line); }
.fq-modal__foot { justify-content: flex-end; gap: 10px; border-top: 1px solid var(--fq-line); }
.fq-modal__body { padding: 20px; }
.fq-modal__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--fq-ink); }
.fq-modal__close { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; font-size: 22px; line-height: 1; color: var(--fq-muted); cursor: pointer; }
.fq-modal__close::before { content: "\00d7"; }
.fq-modal__close:hover { background: var(--fq-surface); color: var(--fq-ink); }

/* ---------- Pagination (leaderboard) ---------- */
.fq .pagination { display: flex; gap: 6px; list-style: none; padding: 0; }
.fq .page-link { display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--fq-line); border-radius: 8px; color: var(--fq-ink); font-size: 14px; }
.fq .page-item.active .page-link { background: var(--fq-brand); border-color: var(--fq-brand); color: #fff; }
.fq .page-item.disabled .page-link { color: var(--fq-muted); }

/* ---------- @mention suggestions (Summernote hint) ---------- */
.note-hint-popover { min-width: 180px; padding: 4px; background: #fff; border: 1px solid var(--fq-line, #e3e8ef); border-radius: 8px; box-shadow: 0 8px 24px rgba(13, 29, 45, .15); }
.note-hint-popover .popover-content { padding: 0; }
.note-hint-popover .note-hint-item { display: block; padding: 6px 10px; border-radius: 6px; font-size: 14px; color: #0d1d2d; cursor: pointer; }
.note-hint-popover .note-hint-item.active, .note-hint-popover .note-hint-item:hover { background: #e9f1f9; color: #0861a7; }

/* Lists inside posts and answers (the Tailwind reset removes their markers). */
.fq-prose ol { list-style: decimal; padding-left: 1.5em; margin: 0 0 12px; }
.fq-prose ul { list-style: disc; padding-left: 1.5em; margin: 0 0 12px; }
