/* tips.css — trang đọc tips. Dùng chung biến màu (--bg, --card, --ink…) từ landing.css. */

.tips-layout { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
@media (min-width: 1000px) {
  .wrap { max-width: 1120px; }
  .tips-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 34px; }
}
/* Trang danh sách không có mục lục → 1 cột, tránh nội dung bị nhồi vào cột sidebar 232px */
.tips-layout.no-toc { grid-template-columns: minmax(0, 1fr) !important; }

/* ---- Danh sách tips: lưới ngang, tự xếp số cột theo bề rộng ---- */
.tips-index-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px; margin: 16px 0 20px;
}
.tips-index-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 15px 16px 13px; text-decoration: none;
  transition: box-shadow .15s, border-color .15s, background .2s;
}
.tips-index-card:hover { border-color: var(--blue); box-shadow: 0 2px 12px rgba(51, 122, 183, .13); }
.tic-name { color: var(--blue); font-size: 16px; font-weight: 500; line-height: 1.3; }
.tic-sub { color: var(--muted); font-size: 12.5px; }
.tic-go {
  align-self: flex-start; margin-top: 8px; color: var(--muted); font-weight: 700; font-size: 13px;
  background: var(--chip); border-radius: 20px; padding: 2px 12px; white-space: nowrap;
}
.tips-index-card:hover .tic-go { color: var(--blue); }

/* ---- Mục lục ---- */
.tips-toc {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 4px 12px 0; font-size: 13.5px; order: -1;
}
@media (min-width: 1000px) { .tips-toc { position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow-y: auto; } }
.toc-head {
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; padding: 0 14px 8px;
}
.tips-toc nav { display: flex; flex-direction: column; }
.tips-toc a {
  color: var(--muted); text-decoration: none; padding: 5px 14px;
  border-left: 2px solid transparent; line-height: 1.35;
}
.tips-toc a:hover { color: var(--blue); background: var(--chip); }
.tips-toc a.on { color: var(--blue); font-weight: 700; border-left-color: var(--blue); background: var(--chip); }

/* ---- Thanh điều hướng trên đầu bài ---- */
.tips-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 6px; }
.tips-bar a { font-size: 14px; font-weight: 500; text-decoration: none; color: var(--blue); }
.tips-bar a:hover { text-decoration: underline; }
.tips-practice {
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 13px;
}
.tips-practice:hover { border-color: var(--blue); background: var(--chip); text-decoration: none !important; }

/* ---- Thân bài ---- */
.tips-doc { min-width: 0; font-size: 15.5px; line-height: 1.62; }
.tips-doc h1 { font-size: 26px; font-weight: 700; margin: 10px 0 6px; line-height: 1.25; }
.tips-doc h2 {
  font-size: 20px; font-weight: 700; margin: 30px 0 10px; padding-top: 8px;
  scroll-margin-top: 72px;      /* để heading không bị header sticky che khi nhảy anchor */
}
.tips-doc h3 { font-size: 16.5px; font-weight: 700; margin: 22px 0 8px; color: var(--ink); }
.tips-doc h4 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; }
.tips-doc p { margin: 10px 0; }
.tips-doc ul, .tips-doc ol { margin: 10px 0 10px 22px; }
.tips-doc li { margin: 5px 0; }
.tips-doc hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }
.tips-doc a { color: var(--blue); overflow-wrap: anywhere; }
.tips-doc strong { font-weight: 700; color: var(--ink); }
.tips-note { color: var(--muted); font-size: 14px; }

.tips-doc code {
  background: var(--chip); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; overflow-wrap: anywhere;
}
.tips-doc .md-code {
  background: var(--chip); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin: 14px 0; overflow-x: auto;
}
.tips-doc .md-code code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.55; }

.tips-doc blockquote {
  border-left: 3px solid var(--blue); background: var(--chip);
  padding: 4px 14px; margin: 14px 0; border-radius: 0 6px 6px 0; color: var(--ink);
}
.tips-doc blockquote p { margin: 8px 0; }

/* ---- Bảng: luôn cuộn ngang trong khung riêng, không đẩy giãn cả trang ---- */
.tips-doc .md-tbl {
  overflow-x: auto; margin: 14px 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
}
.tips-doc table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.tips-doc th, .tips-doc td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.tips-doc thead th { background: var(--chip); font-weight: 700; white-space: nowrap; }
.tips-doc tbody tr:last-child td { border-bottom: 0; }
.tips-doc tbody tr:hover { background: var(--chip); }
.tips-doc td:first-child { min-width: 130px; }
