/* Q&A — trang câu hỏi /hoi-dap/{slug}.
   Token canonical từ tokens.css (DESIGN.md). KHÔNG hardcode hex/spacing/radius.
   Brand = xanh lá #00B86B (var(--accent)). Mobile-first → 2 cột từ lg. */

/* ===== Lưới tổng: 1 cột mobile → [nội dung | sidebar 320px] từ lg ===== */
.qa-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg, 16px);
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}
.qa-col { min-width: 0; }

@media (min-width: 1024px) {
  .qa-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
}

/* ===== Breadcrumb ===== */
.qa-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-lg, 16px);
}
.qa-crumb a { color: var(--muted); text-decoration: none; }
.qa-crumb a:hover { color: var(--text); }
.qa-crumb-sep { width: .85em; height: .85em; color: var(--faint); }
.qa-crumb-cur { color: var(--text); font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }

/* ===== Khối câu hỏi ===== */
.qa-q {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 22px;
  margin-bottom: var(--space-xl, 24px);
}
.qa-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.qa-model {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.qa-model:hover { background: var(--accent); color: var(--on-accent); }
.qa-model .fa-icon { width: 13px; height: 13px; }
.qa-chip {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--surface-3); color: var(--muted);
  font-size: 12px; font-weight: 500; text-decoration: none;
  white-space: nowrap;
}
.qa-chip:hover { color: var(--accent); }

.qa-q-title {
  font-size: 1.5rem; font-weight: 700; line-height: 1.3;
  letter-spacing: -.01em; margin: 0 0 14px;
}
.qa-q-body { font-size: 15.5px; line-height: 1.7; color: var(--text); }
.qa-q-body :where(p):last-child { margin-bottom: 0; }
.qa-q-body img, .qa-q-body picture { max-width: 100%; height: auto; }

.qa-q-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
  margin-top: 18px;
}

/* Tác giả (dùng chung câu hỏi + câu trả lời) */
.qa-author { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.qa-avatar {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  object-fit: cover; flex-shrink: 0; background: var(--surface-3);
}
.qa-avatar-fb {
  display: grid; place-items: center; color: var(--faint);
}
.qa-avatar-fb .fa-icon { width: 55%; height: 55%; }
.qa-author-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.qa-author-name { font-size: 13px; font-weight: 600; color: var(--text); }
.qa-author-meta { font-size: 12px; color: var(--muted); }

.qa-q-stats { display: inline-flex; align-items: center; gap: 16px; margin-left: auto; }
.qa-stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: default;
}
.qa-stat .fa-icon { width: 15px; height: 15px; }
.qa-stat-act { cursor: pointer; text-decoration: none; }
.qa-stat-act:hover { color: var(--text); }

/* ===== Header danh sách câu trả lời ===== */
.qa-ans-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.qa-ans-count { font-size: 17px; font-weight: 600; margin: 0; }
.qa-sort {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 13px; text-decoration: none;
}
.qa-sort:hover { background: var(--surface-2); }
.qa-sort .fa-icon { width: 14px; height: 14px; }

/* ===== Câu trả lời ===== */
.qa-ans-list { display: flex; flex-direction: column; gap: 12px; }
.qa-ans {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 18px;
}
.qa-ans-accepted {
  border-color: var(--accent);
  border-left-width: 4px;
  background: var(--accent-soft);
}
.qa-accepted-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; margin-bottom: 14px;
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.qa-accepted-badge .fa-icon { width: 14px; height: 14px; }

.qa-ans-row { display: flex; gap: 14px; }
.qa-ans-main { min-width: 0; flex: 1; }
.qa-ans-body { font-size: 15px; line-height: 1.7; color: var(--text); }
.qa-ans-body :where(p):last-child { margin-bottom: 0; }
.qa-ans-body img, .qa-ans-body picture { max-width: 100%; height: auto; }
.qa-ans-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 14px;
}

/* Cột upvote */
.qa-vote { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.qa-vote-form { display: contents; }
.qa-vote-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--muted);
  cursor: pointer;
  transition: color var(--duration-fast, 150ms), background var(--duration-fast, 150ms);
}
.qa-vote-btn:hover { background: var(--surface-2); color: var(--accent); }
.qa-vote-btn .fa-icon { width: 18px; height: 18px; }
.qa-vote-btn.voted { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.qa-vote-count { font-size: 14px; font-weight: 700; color: var(--text); }

/* Nút "Chọn câu trả lời này" (tác giả câu hỏi) */
.qa-accept-form { margin-left: auto; }
.qa-accept-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--accent); border-radius: var(--r-md);
  background: transparent; color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.qa-accept-btn:hover { background: var(--accent); color: var(--on-accent); }
.qa-accept-btn .fa-icon { width: 14px; height: 14px; }

/* Empty-state câu trả lời */
.qa-empty {
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 32px 20px;
}
.qa-empty-ico {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px; margin-bottom: 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
}
.qa-empty-ico .fa-icon { width: 22px; height: 22px; }
.qa-empty-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.qa-empty-text { font-size: 14px; color: var(--muted); margin: 0; }

/* ===== Ô soạn trả lời ===== */
.qa-compose {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 18px;
  margin-top: var(--space-xl, 24px);
}
.qa-compose-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.qa-compose-input {
  display: block; width: 100%;
  padding: 12px 14px;
  font: inherit; font-size: 15px; line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  resize: vertical;
}
.qa-compose-input::placeholder { color: var(--faint); }
.qa-compose-input:focus-visible { outline: none; border-color: var(--accent); }
.qa-compose-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.qa-compose-suggest {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.qa-compose-suggest:hover { background: var(--surface-2); }
.qa-compose-suggest .fa-icon { width: 16px; height: 16px; color: var(--accent); }
.qa-compose-go {
  width: auto; min-height: 40px;
  padding: 0 18px; border-radius: 9px;
  font-weight: 600; margin-left: auto;
}
.qa-compose-guest { margin: 0; }

/* ===== Sidebar ===== */
.qa-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 1024px) {
  .qa-side { position: sticky; top: 76px; }
}
.qa-side-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 18px;
}
.qa-side-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; margin-bottom: 6px;
}
.qa-side-head-ico { width: 16px; height: 16px; color: var(--accent); }
.qa-side-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.qa-side-sub { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }

.qa-similar { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 14px; }
.qa-similar-item a { display: block; text-decoration: none; }
.qa-similar-title {
  display: block; font-size: 13.5px; font-weight: 500; line-height: 1.4;
  color: var(--text);
}
.qa-similar-item a:hover .qa-similar-title { color: var(--accent); }
.qa-similar-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.qa-side-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; text-decoration: none;
}
.qa-side-link:hover { background: var(--surface-2); }
.qa-side-link .fa-icon { width: 15px; height: 15px; }

/* ── Shell rộng cho trang câu hỏi Q&A ─────────────────────────────────────────
   Trang Q&A tự quản sidebar riêng (.qa-grid) nên dùng ShellPageWide (không rail
   phải). Ở desktop mở rộng cột giữa chiếm phần còn lại. .shell.shell-wide có độ
   ưu tiên cao hơn .shell (2 class) → thắng quy tắc 3 cột của home.css. */
@media (min-width: 1024px) {
  .shell.shell-wide {
    grid-template-columns: 240px minmax(0, 1fr);
    max-width: 1180px;
  }
}

/* H-3: ghi đè h1 căn giữa toàn cục (base.css) — tiêu đề câu hỏi căn trái. */
.qa-q h1, .qa-q-title { text-align: left; }
