/* ============================================================
   DOCS — Trang "Hướng dẫn & Tài liệu" (#docs)
   Typography: dùng Be Vietnam Pro (đồng bộ app), cỡ nhỏ gọn, siết dòng,
   giới hạn bề rộng đọc ~68 ký tự cho dễ theo dõi.
   ============================================================ */

.docs {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 20px;
  max-width: 1040px;
  margin: 0 auto;
  align-items: start;
}

/* ---- Sidebar mục lục ---- */
.docs__nav {
  position: sticky; top: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 8px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}
.docs-cat + .docs-cat { margin-top: 4px; }
.docs-cat__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; background: none; border: 0; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 10.5px; font-weight: 800; letter-spacing: .6px;
  color: var(--faint); text-transform: uppercase;
  padding: 11px 10px 5px; border-radius: 8px;
}
.docs-cat__head:hover { color: var(--muted); }
.docs-cat__caret { font-size: 9px; opacity: .55; transition: transform .18s var(--ease), opacity .18s; }
.docs-cat__head:hover .docs-cat__caret { opacity: 1; }
.docs-cat.is-closed .docs-cat__caret { transform: rotate(-90deg); }
.docs-cat.is-closed .docs-cat__list { display: none; }
.docs-cat__art {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 13px; line-height: 1.35;
  padding: 7px 10px; border-radius: 8px;
  border-left: 2px solid transparent;
  transition: var(--ease);
}
.docs-cat__art:hover { background: var(--surface2); color: var(--ink); }
.docs-cat__art.is-active {
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  color: var(--ink); font-weight: 700;
  border-left-color: var(--cyan);
}

/* ---- Cột nội dung ---- */
.docs__main {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 24px 30px 26px;
  min-width: 0;
}
.docs__crumb { font-size: 12px; color: var(--faint); margin-bottom: 12px; }
.docs__crumb b { color: var(--muted); font-weight: 700; }
.docs__crumb-sep { margin: 0 6px; opacity: .55; }

/* Giới hạn bề rộng đọc để dễ theo dõi */
.docs__content, .docs__pager { max-width: 680px; }

/* ---- Typography bài viết ---- */
.doc-h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; line-height: 1.25; }
.docs__content { color: var(--muted); font-size: 14px; line-height: 1.65; }
.docs__content h2 {
  font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
  margin: 22px 0 8px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.docs__content h2:first-of-type { border-top: 0; padding-top: 4px; }
.doc-lead { font-size: 14.5px; color: var(--ink); line-height: 1.6; margin: 0 0 12px; }
.docs__content p { margin: 0 0 11px; }
.docs__content b { color: var(--ink); font-weight: 700; }
.docs__content ul { margin: 0 0 12px; padding-left: 20px; }
.docs__content ul li { margin-bottom: 5px; }
.docs__content code {
  font-family: var(--font-mono, monospace); font-size: 12px;
  background: var(--bg2); color: var(--cyan);
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-soft);
}

/* Các bước (ordered) */
.doc-steps { list-style: none; counter-reset: st; margin: 0 0 14px; padding: 0; }
.doc-steps > li {
  position: relative; counter-increment: st;
  padding: 2px 0 2px 34px; margin-bottom: 9px; line-height: 1.55;
}
.doc-steps > li::before {
  content: counter(st);
  position: absolute; left: 0; top: 1px;
  width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: var(--on-accent); font-weight: 800; font-size: 12px;
}
.doc-steps > li i { font-style: normal; color: var(--ink); font-weight: 600; }

/* Callout */
.doc-note {
  border-radius: 10px; padding: 10px 13px; margin: 4px 0 14px;
  font-size: 13px; line-height: 1.55;
  background: var(--surface2); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--cyan);
}
.doc-note--warn { border-left-color: var(--gold); background: color-mix(in srgb, var(--gold) 7%, var(--surface2)); }
.doc-note--ok   { border-left-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--surface2)); }

/* Hình minh hoạ */
.doc-fig {
  margin: 0 0 14px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line-soft); background: var(--bg);
}
.doc-fig img { display: block; width: 100%; height: auto; }
.doc-fig figcaption {
  padding: 8px 12px; font-size: 11.5px; color: var(--faint);
  line-height: 1.45; border-top: 1px solid var(--line-soft);
}

/* Bảng */
.doc-table { overflow-x: auto; margin: 0 0 14px; }
.doc-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td {
  text-align: left; padding: 8px 11px;
  border: 1px solid var(--line-soft); vertical-align: top;
}
.doc-table th { background: var(--surface2); color: var(--ink); font-weight: 700; }
.doc-table td:first-child { color: var(--faint); white-space: nowrap; }

/* Key-value (tham chiếu trường điền) */
.doc-kv { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.doc-kv > div {
  display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: baseline;
  padding: 9px 12px; border-radius: 9px;
  background: var(--surface2); border: 1px solid var(--line-soft);
}
.doc-kv span { color: var(--faint); font-size: 12px; }
.doc-kv b { color: var(--ink); font-size: 13px; }

/* Link nội bộ — dùng cho cả <a> (mở tab) và <button> (bài↔bài, cùng tab) */
.doc-link {
  display: inline; vertical-align: baseline;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: var(--cyan); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.doc-link:hover { text-decoration: underline; }
.doc-link--go { color: var(--gold); }

/* Prev / Next */
.docs__pager {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}
.docs-pager__btn {
  flex: 1; min-width: 0; max-width: 48%;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px 13px; cursor: pointer;
  color: var(--ink); text-align: left; transition: var(--ease);
}
.docs-pager__btn:hover { border-color: var(--cyan); transform: translateY(-1px); }
.docs-pager__btn--next { text-align: right; align-items: flex-end; }
.docs-pager__btn span { font-size: 11px; color: var(--faint); font-weight: 700; }
.docs-pager__btn b { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; }
  .docs__nav { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 3px; }
  .docs-cat { flex: 1 1 100%; }
  .docs__main { padding: 18px 16px 22px; }
  .doc-kv > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ============================================================
   NEBULA skin (gate). Neon BYTE-NGUYÊN. 1:1 mockup "Huong Dan":
   nav sidebar kính (link active pill tím) + article kính (crumb, h1,
   step cards glass badge vuông, note tint, pager cards).
   ============================================================ */
:root[data-theme="nebula"] .app.is-neb #content > #docs.screen { padding: 26px 30px 90px; }
@media (max-width: 720px) {
  :root[data-theme="nebula"] .app.is-neb #content > #docs.screen { padding: 22px 16px 60px; }
}
:root[data-theme="nebula"] .docs { max-width: 1060px; }

/* Nav sidebar */
:root[data-theme="nebula"] .docs__nav {
  background: rgba(var(--hl-rgb), .04); border: 1px solid rgba(var(--hl-rgb), .08); border-radius: 16px;
}
:root[data-theme="nebula"] .docs-cat__head { color: var(--n-label); letter-spacing: .1em; }
:root[data-theme="nebula"] .docs-cat__art {
  color: var(--ink-soft); font-size: 13px; border-left: 0; border-radius: 8px; padding: 7px 10px;
}
:root[data-theme="nebula"] .docs-cat__art:hover { background: rgba(var(--hl-rgb), .05); color: var(--ink); }
:root[data-theme="nebula"] .docs-cat__art.is-active {
  background: rgba(var(--violet-rgb), .2); color: #fff; font-weight: 600; border-left: 0;
}

/* Article card */
:root[data-theme="nebula"] .docs__main {
  background: rgba(var(--hl-rgb), .04); border: 1px solid rgba(var(--hl-rgb), .08); border-radius: 16px;
  padding: 26px 32px 30px;
}
:root[data-theme="nebula"] .docs__content,
:root[data-theme="nebula"] .docs__pager { max-width: 720px; }
:root[data-theme="nebula"] .docs__crumb { color: var(--faint); }
:root[data-theme="nebula"] .docs__crumb b { color: var(--violet-tint); font-weight: 600; }
/* Thang chữ SaaS docs: h1 24/700 · lead 14.5 · body 13.5 · b 600 (không để mọi thứ cùng "hét") */
:root[data-theme="nebula"] .doc-h1 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
:root[data-theme="nebula"] .docs__content { color: var(--ink-soft); font-size: 13.5px; line-height: 1.7; }
:root[data-theme="nebula"] .doc-lead { color: var(--ink); font-size: 14.5px; line-height: 1.65; margin-bottom: 14px; }
:root[data-theme="nebula"] .docs__content h2 {
  color: var(--ink); font-size: 14.5px; font-weight: 600;
  border-top-color: rgba(var(--hl-rgb), .08); margin: 24px 0 9px; padding-top: 18px;
}
:root[data-theme="nebula"] .docs__content b { color: var(--ink); font-weight: 600; }
:root[data-theme="nebula"] .doc-link { font-weight: 500; }
:root[data-theme="nebula"] .docs-cat__head { font-weight: 600; }
:root[data-theme="nebula"] .docs__content code {
  background: rgba(var(--hl-rgb), .06); border: 1px solid rgba(var(--hl-rgb), .1); color: var(--violet-tint);
}

/* Step cards (glass + badge vuông tím)
   ⚠️ KHÔNG dùng flex trên <li>: text node + <b>/<a> inline sẽ thành flex-item
   riêng → chữ vỡ thành cột. Badge đặt absolute để nội dung giữ inline flow. */
:root[data-theme="nebula"] .doc-steps { display: flex; flex-direction: column; gap: 9px; }
:root[data-theme="nebula"] .doc-steps > li {
  position: relative; margin: 0;
  background: rgba(var(--hl-rgb), .04); border: 1px solid rgba(var(--hl-rgb), .08);
  border-radius: 12px; padding: 12px 16px 12px 54px; line-height: 1.65;
}
:root[data-theme="nebula"] .doc-steps > li::before {
  left: 15px; top: 12px; width: 26px; height: 26px; border-radius: 8px;
  background: rgba(var(--violet-rgb), .2); color: var(--violet-tint); font-weight: 600; font-size: 12.5px;
}

/* Callout tint */
:root[data-theme="nebula"] .doc-note {
  background: rgba(var(--cyan-rgb), .08); border: 1px solid rgba(var(--cyan-rgb), .25); border-left-width: 3px;
  color: var(--ink-soft); border-radius: 12px; padding: 11px 14px; font-size: 12.5px; line-height: 1.6;
}
:root[data-theme="nebula"] .doc-note--warn { background: rgba(var(--gold-rgb), .1); border-color: rgba(var(--gold-rgb), .28); color: #f0dab0; }
:root[data-theme="nebula"] .doc-note--ok   { background: rgba(var(--green-rgb), .1); border-color: rgba(var(--green-rgb), .3); }

/* Table / KV / figure glass */
:root[data-theme="nebula"] .doc-table table { font-size: 12.5px; }
:root[data-theme="nebula"] .doc-table th { background: rgba(var(--hl-rgb), .05); color: var(--ink); font-weight: 600; }
:root[data-theme="nebula"] .doc-table th,
:root[data-theme="nebula"] .doc-table td { border-color: rgba(var(--hl-rgb), .1); }
:root[data-theme="nebula"] .doc-kv > div { background: rgba(var(--hl-rgb), .04); border: 1px solid rgba(var(--hl-rgb), .08); }
:root[data-theme="nebula"] .doc-fig { border-color: rgba(var(--hl-rgb), .1); }
:root[data-theme="nebula"] .doc-link { color: var(--cyan); }
:root[data-theme="nebula"] .doc-link--go { color: var(--gold); }

/* Pager cards */
:root[data-theme="nebula"] .docs__pager { border-top-color: rgba(var(--hl-rgb), .08); }
:root[data-theme="nebula"] .docs-pager__btn {
  background: rgba(var(--hl-rgb), .04); border: 1px solid rgba(var(--hl-rgb), .08); border-radius: 12px;
  max-width: none; padding: 14px 16px;
}
:root[data-theme="nebula"] .docs-pager__btn:hover { border-color: rgba(var(--violet-rgb), .4); }
:root[data-theme="nebula"] .docs-pager__btn span { color: var(--faint); font-weight: 400; }
