/* ========================================================
   CDMPOOL Forum — professional refinements
   Loaded via <link> in base.html
   ======================================================== */

/* -------- layout -------- */
.forum-wrap { max-width: 1080px; margin: 0 auto; }

.forum-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.forum-header h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -.2px;
  color: var(--fg); margin: 0;
}
.forum-header .subtitle {
  color: var(--muted); font-size: 13px; margin-top: 4px;
}
.forum-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.forum-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.6px; color: var(--muted);
  margin: 28px 0 12px;
}

/* -------- category cards -------- */
.forum-cats { display: flex; flex-direction: column; gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; }
.forum-cat {
  display: grid; grid-template-columns: 44px 1fr auto;
  gap: 16px; align-items: center;
  padding: 18px 20px;
  background: var(--bg2);
  text-decoration: none; color: inherit;
  transition: background .12s;
}
.forum-cat:hover { background: var(--bg3); }
.forum-cat .cat-icon {
  width: 44px; height: 44px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}
.forum-cat .cat-icon svg { width: 20px; height: 20px; }
.forum-cat .cat-name {
  font-weight: 600; font-size: 15px; color: var(--fg);
  letter-spacing: -.1px;
}
.forum-cat .cat-desc {
  color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.4;
}
.forum-cat .cat-stats {
  text-align: right; font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.forum-cat .cat-stats b { color: var(--fg); font-weight: 600; }

/* -------- topics list -------- */
.forum-topics {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.forum-topic-row {
  display: grid;
  grid-template-columns: 40px 1fr 90px 90px 130px;
  gap: 16px; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.forum-topic-row:last-child { border-bottom: 0; }
.forum-topic-row:hover { background: var(--bg3); }
.forum-topic-row .t-avatar { grid-row: span 1; }
.forum-topic-row .t-title { color: var(--fg); text-decoration: none;
  font-weight: 500; font-size: 14px; letter-spacing: -.1px; }
.forum-topic-row .t-title:hover { color: var(--accent); }
.forum-topic-row .t-meta {
  color: var(--muted); font-size: 12px; margin-top: 3px;
}
.forum-topic-row .t-count,
.forum-topic-row .t-views,
.forum-topic-row .t-updated {
  color: var(--muted); font-size: 12px; text-align: right;
}
.forum-topic-row .t-count b { color: var(--fg); font-weight: 600; }

/* -------- avatars -------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; color: #001;
  flex-shrink: 0;
  font-family: inherit;
  letter-spacing: -.5px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }

/* -------- posts -------- */
.forum-thread { display: flex; flex-direction: column; gap: 16px; }

.forum-post {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color .12s;
}
.forum-post:hover { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.forum-post.op { border-left: 3px solid var(--accent); }
.forum-post.deleted { opacity: .55; }

.forum-post .post-avatar-col { display: flex; justify-content: flex-start; }

.forum-post header.post-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.forum-post .post-author {
  font-weight: 600; color: var(--fg); font-size: 14px;
}
.forum-post .post-date {
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.forum-post .post-body {
  white-space: pre-wrap; line-height: 1.65;
  word-break: break-word; color: var(--fg);
  font-size: 14px;
}

/* -------- badges -------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase;
  background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border);
  line-height: 1.5;
}
.badge.role-admin  { background: rgba(255,85,119,0.14); color: #ff7d94; border-color: rgba(255,85,119,0.35); }
.badge.role-vip    { background: var(--accent-dim); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.tier-bronze  { background: rgba(201,138,82,0.14); color: #d4a06a; border-color: rgba(201,138,82,0.4); }
.badge.tier-silver  { background: rgba(216,222,233,0.10); color: #d8dee9; border-color: rgba(216,222,233,0.3); }
.badge.tier-gold    { background: rgba(255,216,90,0.14); color: #ffd85a; border-color: rgba(255,216,90,0.4); }
.badge.tier-diamond { background: rgba(126,232,255,0.12); color: #7ee8ff; border-color: rgba(126,232,255,0.4); }
.badge.activity     { background: rgba(139,125,252,0.14); color: #b7adff; border-color: rgba(139,125,252,0.35); }
.badge.warn         { background: rgba(255,85,119,0.14); color: #ff7d94; border-color: rgba(255,85,119,0.4); }
.badge.muted        { background: var(--bg3); color: var(--muted); }

.icon { display: inline-block; vertical-align: middle; width: 14px; height: 14px; }
.icon-sm { width: 12px; height: 12px; }
.icon-lg { width: 18px; height: 18px; }

/* -------- state chips (pinned/locked) -------- */
.topic-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
  background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border);
  margin-right: 6px; vertical-align: middle;
}
.topic-chip.pinned { color: var(--warn); border-color: rgba(255,184,77,0.35); background: rgba(255,184,77,0.08); }
.topic-chip.locked { color: var(--muted); }

/* -------- reply form -------- */
.reply-form {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
}
.reply-form label {
  display: block; font-weight: 600; font-size: 12px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.reply-form textarea, .reply-form input[type=text] {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--fg); border-radius: 6px;
  font-family: inherit; font-size: 14px; line-height: 1.55;
  transition: border-color .12s;
}
.reply-form textarea:focus, .reply-form input:focus {
  outline: none; border-color: var(--accent);
}

/* -------- mod actions row -------- */
.mod-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* -------- breadcrumb -------- */
.crumbs {
  font-size: 12px; color: var(--muted); margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }

/* -------- warning banner -------- */
.warn-banner {
  background: rgba(255,85,119,0.09);
  border: 1px solid rgba(255,85,119,0.35);
  border-radius: 8px; padding: 14px 16px;
  color: #ffb0bf; display: flex; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.warn-banner .icon { color: var(--danger); flex-shrink: 0; margin-top: 2px; }

/* -------- responsive -------- */
@media (max-width: 780px) {
  .forum-topic-row {
    grid-template-columns: 36px 1fr auto;
    grid-template-areas: "av tt tt" "av mt mt";
  }
  .forum-topic-row .t-count,
  .forum-topic-row .t-views,
  .forum-topic-row .t-updated { display: none; }
  .forum-cat { grid-template-columns: 40px 1fr; }
  .forum-cat .cat-stats { display: none; }
}

/* ===== v3.0 forum features ===== */
.post-toolbar{display:flex;align-items:center;justify-content:space-between;
  gap:12px;flex-wrap:wrap;margin-top:12px;padding-top:10px;
  border-top:1px solid var(--border)}
.reactions{display:flex;gap:6px;flex-wrap:wrap}
.react-btn{background:var(--bg3);border:1px solid var(--border);border-radius:20px;
  padding:3px 10px;font-size:14px;cursor:pointer;color:var(--fg);
  transition:transform .08s ease,background-color .15s ease,border-color .15s ease;
  display:inline-flex;align-items:center;gap:5px;line-height:1.4}
.react-btn:hover{transform:translateY(-1px);border-color:var(--accent,#ffb84d)}
.react-btn.mine{background:rgba(255,184,77,0.16);border-color:rgba(255,184,77,0.55)}
.react-btn.zero{opacity:.72}
.react-btn .rc{font-size:12px;font-weight:700;opacity:.9}
.post-tools{display:flex;gap:8px;flex-wrap:wrap}
.btn-mini.ghost{background:transparent}
.badge.postcount{background:var(--bg3);color:var(--muted);border:1px solid var(--border)}
.forum-post.best-answer{border:1px solid rgba(64,200,120,0.55);
  box-shadow:0 0 0 1px rgba(64,200,120,0.25) inset}
.best-badge{display:inline-flex;align-items:center;gap:6px;
  color:#40c878;font-weight:700;font-size:12.5px;letter-spacing:.4px;
  text-transform:uppercase;margin-bottom:8px}
.topic-chip.solved{background:rgba(64,200,120,0.16);color:#40c878;
  border:1px solid rgba(64,200,120,0.45)}
.forum-pagination{display:flex;align-items:center;justify-content:center;gap:16px;
  margin:22px 0}
.forum-pagination .page-link{background:var(--bg3);border:1px solid var(--border);
  border-radius:6px;padding:7px 14px;color:var(--fg);text-decoration:none}
.forum-pagination .page-link:hover{border-color:var(--accent,#ffb84d)}
.forum-pagination .page-info{color:var(--muted);font-size:13px}
/* search box */
.forum-search{display:flex;gap:8px;align-items:center}
.forum-search input{background:var(--bg3);border:1px solid var(--border);
  border-radius:6px;padding:8px 12px;color:var(--fg);min-width:180px}
.forum-search.big{margin:8px 0 4px}
.forum-search.big input{flex:1;min-width:260px;font-size:15px;padding:11px 14px}
/* notifications bell */
.forum-bell{position:relative;padding-left:14px;padding-right:14px}
.bell-badge{position:absolute;top:-6px;right:-6px;background:#ff5577;color:#fff;
  border-radius:20px;font-size:11px;font-weight:700;min-width:18px;height:18px;
  display:inline-flex;align-items:center;justify-content:center;padding:0 5px}
.notif-list{display:flex;flex-direction:column;gap:8px}
.notif-row{display:flex;gap:14px;align-items:flex-start;padding:14px 16px;
  background:var(--bg2,#14161c);border:1px solid var(--border);border-radius:8px;
  text-decoration:none;color:var(--fg);transition:border-color .15s ease}
.notif-row:hover{border-color:var(--accent,#ffb84d)}
.notif-row.unread{background:rgba(255,184,77,0.06);border-color:rgba(255,184,77,0.3)}
.notif-ico{font-size:18px;flex-shrink:0;margin-top:1px}
.notif-topic{color:var(--accent,#ffb84d)}
.notif-time{color:var(--muted);font-size:12px;margin-top:3px}

/* ---- light-theme contrast overrides (2026-07-29) ---- */
[data-theme="light"] .badge.tier-silver  { background:rgba(100,116,139,.14); color:#475569; border-color:rgba(100,116,139,.4); }
[data-theme="light"] .badge.tier-diamond { background:rgba(14,116,144,.12); color:#0e7490; border-color:rgba(14,116,144,.4); }
[data-theme="light"] .badge.tier-gold    { background:rgba(202,138,4,.16); color:#854d0e; border-color:rgba(202,138,4,.45); }
[data-theme="light"] .badge.tier-bronze  { background:rgba(180,120,60,.16); color:#8a4b1e; border-color:rgba(180,120,60,.45); }
[data-theme="light"] .badge.activity     { background:rgba(109,40,217,.12); color:#6d28d9; border-color:rgba(109,40,217,.35); }
[data-theme="light"] .badge.role-admin,
[data-theme="light"] .badge.warn         { background:rgba(220,38,38,.10); color:#b91c1c; border-color:rgba(220,38,38,.35); }
[data-theme="light"] .warn-banner        { background:rgba(220,38,38,.08); border-color:rgba(220,38,38,.35); color:#b91c1c; }
[data-theme="light"] .topic-chip.pinned  { color:#854d0e; border-color:rgba(202,138,4,.4); background:rgba(202,138,4,.12); }
