/* ============================================================
   N.G.O 2026 — Forum & Auth styles
   Reuses design tokens from styles.css
   ============================================================ */

.forum-shell{ min-height:100vh; background:var(--paper-2); padding-bottom:60px; }
.wrap{ width:min(var(--maxw), 100%); margin-inline:auto; padding-inline:20px; }

/* ---------- Topbar (solid variant) ----------
   Layout/spacing intentionally mirrors `.topbar` in styles.css so the
   nav is identical across all pages — only the page chrome (sticky,
   solid white bar, border) differs here. Nav link + user-chip styling
   is shared from styles.css; do NOT re-style `.nav a` here. */
.topbar--solid{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:24px;
  padding:14px clamp(18px,4vw,48px);
  background:rgba(255,255,255,.96);
  border-bottom:3px solid var(--ink);
  box-shadow:0 6px 0 rgba(36,21,68,.08);
}
.topbar--solid .brand img{ height:46px; width:auto; }

.btn-block{ width:100%; display:block; text-align:center; }
.link-btn{ background:none; border:0; color:var(--pink); font-weight:800; cursor:pointer; padding:0 4px; }

/* ---------- Forum hero ---------- */
.forum-hero{
  background:linear-gradient(120deg,var(--purple-deep),var(--purple) 60%,var(--cyan));
  color:#fff; padding:46px 0 40px; border-bottom:4px solid var(--ink);
}
.forum-hero .kicker{
  display:inline-block; padding:5px 14px; border-radius:999px;
  background:var(--yellow); color:var(--ink); font-weight:800;
  text-transform:uppercase; font-size:.74rem; border:2.5px solid var(--ink);
}
.forum-hero h1{ font-family:var(--f-display); font-size:clamp(2.2rem,5vw,3.4rem); margin:12px 0 6px; }
.forum-hero p{ opacity:.92; max-width:60ch; }
.forum-search{ display:flex; gap:10px; margin-top:20px; max-width:520px; }
.forum-search input{
  flex:1; min-height:48px; padding:0 16px; border:3px solid var(--ink); border-radius:14px;
  font:600 .98rem var(--f-body); background:#fff; color:var(--ink);
}

/* ---------- Forum body layout ---------- */
.forum-body{ display:grid; grid-template-columns:280px 1fr; gap:26px; margin-top:28px; align-items:start; }

.forum-side{
  position:sticky; top:84px;
  background:#fff; border:3px solid var(--ink); border-radius:var(--r-md);
  box-shadow:var(--shadow-hard); padding:18px;
}
.forum-side h3{ font-family:var(--f-display); margin-bottom:12px; }
.forum-cat-list{ display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.forum-cat-list a{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:12px;
  font-weight:700; color:var(--ink-soft); transition:.12s;
}
.forum-cat-list a:hover{ background:var(--paper-2); }
.forum-cat-list a.active{ background:var(--purple); color:#fff; }
.forum-cat-list .ic{ font-size:1.1rem; }
.forum-cat-list .cat-meta{ display:flex; flex-direction:column; line-height:1.2; }
.forum-cat-list .cat-meta small{ opacity:.7; font-weight:600; font-size:.74rem; }

.forum-main{ min-width:0; }
.forum-toolbar{ margin-bottom:16px; }
.forum-toolbar h2{ font-family:var(--f-display); }
.forum-toolbar .muted{ color:var(--muted); }

.card{
  background:#fff; border:3px solid var(--ink); border-radius:var(--r-md);
  box-shadow:var(--shadow-card); padding:20px; margin-bottom:18px;
}

/* ---------- Thread list ---------- */
.forum-thread-list{ display:flex; flex-direction:column; gap:10px; }
.forum-thread-row{
  display:flex; align-items:center; gap:14px;
  background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:14px 18px;
  transition:.12s; box-shadow:3px 3px 0 rgba(36,21,68,.12);
}
.forum-thread-row:hover{ transform:translateY(-2px); box-shadow:5px 5px 0 var(--ink); }
.forum-thread-row .t-pin{ font-size:1rem; }
.forum-thread-row .t-main{ flex:1; min-width:0; }
.forum-thread-row h3{ font-size:1.06rem; color:var(--ink); margin-bottom:4px; }
.t-meta{ display:flex; flex-wrap:wrap; gap:12px; color:var(--muted); font-size:.84rem; }
.t-cat{ color:var(--purple); font-weight:700; }
.t-stats{ display:flex; flex-direction:column; gap:2px; text-align:right; color:var(--muted); font-size:.82rem; white-space:nowrap; }
.t-stats b{ color:var(--ink); }

.forum-empty{ color:var(--muted); padding:24px; text-align:center; }

.forum-pager{ display:flex; align-items:center; justify-content:center; gap:16px; margin-top:22px; font-weight:700; }

/* ---------- New thread / forms ---------- */
.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.field label{ font-weight:800; font-size:.82rem; text-transform:uppercase; color:var(--purple); letter-spacing:.03em; }
.field input, .field select, .field textarea,
.forum-newthread textarea, .thread-replybox textarea{
  width:100%; padding:11px 14px; border:2.5px solid var(--ink); border-radius:12px;
  font:600 .96rem var(--f-body); background:var(--paper-2); color:var(--ink); resize:vertical;
}
.field input:focus, .field select:focus, .field textarea:focus,
.thread-replybox textarea:focus{ outline:0; border-color:var(--cyan); background:#fff; }
.forum-form-actions{ display:flex; gap:10px; }
.forum-form-error{ color:#fff; background:var(--pink); border:2px solid var(--ink); border-radius:10px; padding:7px 11px; font-weight:700; margin-bottom:10px; }
.forum-form-ok{ color:#fff; background:#2fab66; border:2px solid var(--ink); border-radius:10px; padding:7px 11px; font-weight:700; margin-bottom:10px; }
.alert{ background:var(--paper-2); border:2px dashed var(--ink); border-radius:12px; padding:12px 16px; font-weight:600; }
.alert a{ color:var(--purple); font-weight:800; }

/* ---------- Profile page ---------- */
.profile-grid{
  display:grid; gap:20px; margin-top:24px;
  grid-template-columns:repeat(2, minmax(0,1fr));
}
@media (max-width:760px){ .profile-grid{ grid-template-columns:1fr; } }
.profile-card{
  background:#fff; border:3px solid var(--ink); border-radius:16px;
  padding:20px 22px; box-shadow:0 6px 0 rgba(36,21,68,.08);
}
.profile-card-title{ font-family:var(--f-display); font-size:1.15rem; margin:0 0 14px; }
.profile-card .btn{ margin-top:4px; }
.profile-summary{ text-align:center; grid-column:1 / -1; }
.profile-ava{ width:88px; height:88px; margin:0 auto 12px; border-radius:50%; overflow:hidden; border:3px solid var(--ink); }
.profile-ava img{ width:100%; height:100%; object-fit:cover; }
.profile-ava--letter{ display:flex; align-items:center; justify-content:center; font-family:var(--f-display); font-size:2.2rem; color:#fff; background:var(--purple); }
.profile-summary h3{ font-family:var(--f-display); margin:0 0 2px; }
.profile-muted{ color:var(--muted); margin:2px 0; font-size:.9rem; }
.profile-stat{ margin-top:8px; font-weight:600; }

/* Avatar upload */
.avatar-upload{ display:flex; align-items:center; gap:16px; }
.avatar-upload-preview{ width:72px; height:72px; border-radius:50%; overflow:hidden; border:3px solid var(--ink); flex:0 0 auto; }
.avatar-upload-preview img{ width:100%; height:100%; object-fit:cover; }
.avatar-upload-preview--letter{ display:flex; align-items:center; justify-content:center; font-family:var(--f-display); font-size:1.8rem; color:#fff; background:var(--purple); }
.avatar-upload-actions{ display:flex; flex-direction:column; gap:4px; }
.avatar-upload-btn{ position:relative; overflow:hidden; cursor:pointer; display:inline-block; }
.avatar-upload-btn input[type=file]{ position:absolute; inset:0; opacity:0; cursor:pointer; font-size:0; }
.avatar-upload-btn.is-busy{ opacity:.6; pointer-events:none; }

/* Discord block */
.profile-discord .discord-linked{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.discord-ava{ width:48px; height:48px; border-radius:50%; overflow:hidden; border:2px solid var(--ink); }
.discord-ava img{ width:100%; height:100%; object-fit:cover; }
.discord-info{ display:flex; flex-direction:column; gap:2px; margin-right:auto; }
.discord-badge{ font-size:.72rem; font-weight:800; text-transform:uppercase; color:#2fab66; letter-spacing:.04em; }
.btn-discord{ background:#5865F2; color:#fff; border:2px solid var(--ink); border-radius:10px; padding:9px 16px; font-weight:800; cursor:pointer; }
.btn-discord:hover{ filter:brightness(1.05); }

/* ---------- Thread detail ---------- */
.forum-thread-detail{ margin-top:24px; }
.forum-back{ display:inline-block; margin-bottom:16px; font-weight:800; color:var(--purple); }
.thread-op-head h1{ font-family:var(--f-display); font-size:clamp(1.5rem,3.4vw,2.2rem); margin:8px 0; }
.thread-op-body, .tp-body{ line-height:1.7; color:var(--ink-soft); margin-top:10px; word-wrap:break-word; }
.thread-reply-title{ font-family:var(--f-display); margin:24px 0 14px; }

.thread-posts{ display:flex; flex-direction:column; gap:14px; }
.thread-post{
  display:grid; grid-template-columns:120px 1fr; gap:16px;
  background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:16px;
}
.thread-post .tp-side{ display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center; }
.thread-post .tp-side .avatar{ width:48px; height:48px; font-size:1.2rem; }
/* Avatar tròn tác giả (dùng chung cho post, có ảnh hoặc fallback chữ cái) */
.thread-post .tp-side .avatar{
  display:grid; place-items:center; border-radius:50%; overflow:hidden; flex:0 0 auto;
  background:linear-gradient(135deg,var(--pink),var(--cyan));
  color:#fff; font-family:var(--f-display); font-weight:800;
}
.thread-post .tp-side .avatar img{ width:100%; height:100%; object-fit:cover; }

/* Avatar nhỏ cạnh tên tác giả (danh sách thread + tiêu đề thread) */
.t-author{ display:inline-flex; align-items:center; gap:5px; }
.author-ava{ display:inline-grid; place-items:center; border-radius:50%; overflow:hidden; flex:0 0 auto; vertical-align:middle; }
.author-ava img{ width:100%; height:100%; object-fit:cover; display:block; }
.author-ava--letter{ background:linear-gradient(135deg,var(--pink),var(--cyan)); color:#fff; font-family:var(--f-display); font-weight:800; }
.author-ava--xs{ width:20px; height:20px; font-size:.66rem; }
.thread-post .tp-side b{ font-size:.86rem; word-break:break-word; }
.tp-main time{ color:var(--muted); font-size:.8rem; }
.thread-replybox{ margin-top:18px; }
.thread-replybox textarea{ margin-bottom:10px; }

/* ---------- Auth pages ---------- */
.forum-auth-page{
  min-height:100vh; display:grid; place-items:center; padding:32px 18px;
  background:linear-gradient(120deg,var(--purple-deep),var(--purple) 55%,var(--cyan));
}
.forum-auth-home{ position:fixed; top:20px; left:22px; color:#fff; font-weight:800; opacity:.9; }
.forum-auth-card{
  width:min(440px,100%); background:#fff; border:3px solid var(--ink); border-radius:22px;
  box-shadow:10px 10px 0 var(--ink); padding:32px 28px; position:relative; overflow:hidden;
}
.forum-auth-card::before{
  content:""; position:absolute; inset:0 0 auto 0; height:9px;
  background:linear-gradient(90deg,var(--pink),var(--yellow),var(--cyan-bright),var(--purple));
}
.forum-auth-head{ display:flex; align-items:center; gap:14px; margin:6px 0 22px; }
.forum-auth-head .mark{
  width:52px; height:52px; display:grid; place-items:center; flex-shrink:0;
  border:3px solid var(--ink); border-radius:15px; background:var(--cyan-bright);
  box-shadow:4px 4px 0 var(--ink); font-size:1.4rem; font-weight:800;
}
.forum-auth-head h2{ font-family:var(--f-display); font-size:1.8rem; text-transform:uppercase; }
.forum-auth-head p{ color:var(--muted); font-weight:600; font-size:.86rem; }
.forum-auth-foot{ text-align:center; margin-top:18px; color:var(--ink-soft); font-weight:600; }
.forum-auth-foot a{ color:var(--purple); font-weight:800; }
.forum-auth-note{ text-align:center; margin-top:8px; font-size:.78rem; color:var(--muted); }

/* ---------- Toolbar + page size ---------- */
.forum-toolbar{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.forum-pagesize{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:.86rem; color:var(--ink-soft); }
.forum-pagesize select{
  padding:8px 12px; border:2.5px solid var(--ink); border-radius:10px;
  font:700 .86rem var(--f-body); background:#fff; color:var(--ink); cursor:pointer;
}
.t-score{ color:var(--muted); font-size:.8rem; }

/* ---------- Vote buttons (up/down) ---------- */
.post-actions{ display:flex; align-items:center; gap:14px; margin-top:14px; flex-wrap:wrap; }
.votebox{
  display:inline-flex; align-items:center; gap:4px;
  border:2.5px solid var(--ink); border-radius:999px; padding:2px; background:#fff;
  box-shadow:2px 2px 0 rgba(36,21,68,.15);
}
.vote-btn{
  width:30px; height:30px; border-radius:50%; display:grid; place-items:center;
  font-size:.9rem; font-weight:900; color:var(--muted); transition:.12s; line-height:1;
}
.vote-btn:hover{ background:var(--paper-2); }
.vote-btn.up.active{ background:var(--green); color:#fff; }
.vote-btn.down.active{ background:var(--red); color:#fff; }
.vote-score{ min-width:26px; text-align:center; font-weight:800; font-family:var(--f-display); }
.vote-score.pos{ color:var(--green); }
.vote-score.neg{ color:var(--red); }
.link-btn.danger{ color:var(--red); }

/* ---------- Edit / reply context ---------- */
.tp-replyto{ font-size:.82rem; color:var(--purple); margin-bottom:4px; font-weight:600; }
.reply-context{
  display:flex; align-items:center; gap:8px; margin-bottom:10px; padding:8px 12px;
  background:var(--paper-2); border-radius:10px; font-weight:600; font-size:.88rem;
}
.thread-edit-form, .tp-edit-form{ margin-top:12px; }
.t-meta .edited, .edited{ color:var(--muted); font-style:italic; }

/* ---------- Rich content rendering ---------- */
.rich-content{ overflow-wrap:break-word; }
.rich-content img{ max-width:100%; height:auto; border-radius:8px; margin:8px 0; }
.rich-content h1, .rich-content h2, .rich-content h3{ font-family:var(--f-display); margin:12px 0 6px; }
.rich-content ul, .rich-content ol{ padding-left:22px; margin:8px 0; }
.rich-content ul{ list-style:disc; }
.rich-content ol{ list-style:decimal; }
.rich-content blockquote{ border-left:4px solid var(--purple); padding:4px 14px; margin:10px 0; background:var(--paper-2); border-radius:0 8px 8px 0; color:var(--ink-soft); }
.rich-content pre, .rich-content code{ background:var(--paper-3); border-radius:6px; padding:2px 6px; font-family:monospace; }
.rich-content pre{ padding:12px; overflow-x:auto; }
.rich-content a{ color:var(--purple); text-decoration:underline; }
.rich-content table{ border-collapse:collapse; margin:10px 0; }
.rich-content td, .rich-content th{ border:1px solid var(--skyline); padding:6px 10px; }

/* Summernote inside forum */
.forum-shell .note-editor.note-frame{ border:2.5px solid var(--ink); border-radius:12px; }

/* ---------- Responsive ---------- */
@media (max-width:860px){
  .forum-body{ grid-template-columns:1fr; }
  .forum-side{ position:static; }
  .topbar--solid .nav{ display:none; }
}
@media (max-width:520px){
  .thread-post{ grid-template-columns:1fr; }
  .thread-post .tp-side{ flex-direction:row; justify-content:flex-start; }
  .t-stats{ display:none; }
}
