/* ===== Forum styles ===== */
.forum-main { padding: 130px 0 80px; min-height: 100vh; }
.forum-header { text-align: center; max-width: 720px; margin: 0 auto 44px; }
.forum-header .section-title { margin: 12px 0 10px; }
.forum-stats { display: flex; justify-content: center; gap: 40px; margin-top: 26px; }
.fstat { display: flex; flex-direction: column; align-items: center; }
.fstat strong { font-family: "Space Grotesk"; font-size: 1.8rem; color: var(--primary-2); }
.fstat span { color: var(--muted); font-size: 0.85rem; }

.forum-layout { display: grid; grid-template-columns: 340px 1fr; gap: 30px; align-items: start; }

/* New post card */
.forum-side { position: sticky; top: 100px; }
.new-post-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.new-post-card h3 { font-size: 1.2rem; margin-bottom: 18px; }
.new-post-card .field { margin-bottom: 14px; }
.new-post-card select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 15px; color: var(--text); font-family: inherit; font-size: 0.95rem; cursor: pointer;
}
.new-post-card select:focus { outline: none; border-color: var(--primary); }
.form-error { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; background: rgba(255,95,87,0.12); border: 1px solid rgba(255,95,87,0.4); color: #ff8a82; }

/* Toolbar */
.forum-toolbar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.search-wrap { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; flex: 1; min-width: 220px; }
.search-wrap input { flex: 1; background: none; border: 0; color: var(--text); padding: 12px 0; font-family: inherit; font-size: 0.95rem; }
.search-wrap input:focus { outline: none; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--bg-card); border: 1px solid var(--border); color: var(--muted); padding: 9px 16px; border-radius: 100px; cursor: pointer; font-size: 0.85rem; font-family: inherit; transition: all 0.2s; }
.chip:hover { color: var(--text); border-color: rgba(108,92,231,0.5); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }

/* Thread list */
.thread-list { display: flex; flex-direction: column; gap: 14px; }
.thread-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; cursor: pointer; transition: transform 0.2s, border-color 0.2s; animation: fadeUp 0.4s ease both; }
.thread-card:hover { transform: translateY(-3px); border-color: rgba(0,210,255,0.4); }
.thread-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-family: "Space Grotesk"; flex-shrink: 0; }
.thread-meta { display: flex; flex-direction: column; }
.thread-meta .who { font-weight: 600; font-size: 0.92rem; }
.thread-meta .when { color: var(--muted); font-size: 0.78rem; }
.cat-badge { margin-left: auto; font-size: 0.72rem; padding: 5px 12px; border-radius: 100px; font-weight: 600; border: 1px solid var(--border); }
.cat-General { color: #9aa0b5; }
.cat-WebDev { color: #00d2ff; border-color: rgba(0,210,255,0.3); }
.cat-AI { color: #ff6bcb; border-color: rgba(255,107,203,0.3); }
.cat-MCP { color: #7ee787; border-color: rgba(126,231,135,0.3); }
.cat-Help { color: #ffab70; border-color: rgba(255,171,112,0.3); }
.thread-card h3 { font-size: 1.12rem; margin-bottom: 6px; }
.thread-card p { color: var(--muted); font-size: 0.92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-footer { display: flex; gap: 18px; margin-top: 14px; color: var(--muted); font-size: 0.84rem; }
.thread-footer span { display: flex; align-items: center; gap: 6px; }

.empty-state { text-align: center; color: var(--muted); padding: 50px 0; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,5,12,0.75); backdrop-filter: blur(6px); }
.modal-card { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 680px; max-height: 86vh; overflow-y: auto; padding: 32px; box-shadow: var(--shadow); animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 1rem; transition: background 0.2s; }
.modal-close:hover { background: rgba(255,255,255,0.12); }

.modal-thread-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-right: 40px; }
.modal-card h2 { font-size: 1.5rem; margin-bottom: 12px; }
.modal-body-text { color: var(--text); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 26px; white-space: pre-wrap; line-height: 1.7; }

.replies-head { font-size: 1.05rem; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.reply { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.reply .avatar { width: 36px; height: 36px; font-size: 0.85rem; }
.reply-content .who { font-weight: 600; font-size: 0.9rem; }
.reply-content .when { color: var(--muted); font-size: 0.76rem; margin-left: 8px; }
.reply-content p { margin-top: 4px; color: var(--muted); font-size: 0.94rem; white-space: pre-wrap; }
.no-replies { color: var(--muted); font-size: 0.92rem; padding: 8px 0 18px; }

.reply-form { margin-top: 22px; }
.reply-form .field { margin-bottom: 12px; }
.reply-row { display: grid; grid-template-columns: 1fr; gap: 12px; }

@media (max-width: 900px) {
  .forum-layout { grid-template-columns: 1fr; }
  .forum-side { position: static; }
}
@media (max-width: 520px) {
  .forum-stats { gap: 26px; }
  .modal-card { padding: 24px 20px; }
}
