/*
  iGo — trang hướng dẫn sử dụng. Dùng lại bảng màu của landing page (../style.css)
  để đồng bộ thương hiệu; thêm layout riêng cho trang tài liệu nhiều mục.
*/

:root {
  --bg: #f7f3ec;
  --bg-soft: #f1ebe0;
  --surface: #ffffff;
  --fg: #201b16;
  --muted: #6b6155;
  --border: #e6dccb;
  --accent: #a3271f;
  --accent-fg: #fff8f4;
  --accent-soft: #f3e1dc;
  --gold: #a97a2e;
  --shadow: 0 1px 2px rgba(32, 27, 22, 0.04), 0 8px 24px rgba(32, 27, 22, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo,
    Consolas, monospace;
}

/* Tối theo hệ điều hành — trừ khi người dùng ép Sáng.
   LƯU Ý: 11 biến dưới đây lặp lại ở khối :root[data-theme="dark"] ngay bên dưới
   (CSS không có mixin, dự án không có build step) — SỬA CẢ HAI khi đổi màu. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1512;
    --bg-soft: #221b16;
    --surface: #241d18;
    --fg: #f3ece1;
    --muted: #b0a496;
    --border: #3a2f26;
    --accent: #e2564a;
    --accent-fg: #201008;
    --accent-soft: #3a1f1a;
    --gold: #d9a94f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

/* Người dùng ép Tối, bất kể hệ điều hành (bản sao của khối trên) */
:root[data-theme="dark"] {
  --bg: #1a1512;
  --bg-soft: #221b16;
  --surface: #241d18;
  --fg: #f3ece1;
  --muted: #b0a496;
  --border: #3a2f26;
  --accent: #e2564a;
  --accent-fg: #201008;
  --accent-soft: #3a1f1a;
  --gold: #d9a94f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.docs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 24px 4px;
}

.docs-brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--accent);
  text-decoration: none;
}

.docs-header-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.docs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 24px 24px;
}

.docs-nav a {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
}

.docs-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.docs-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.docs-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 24px 56px;
}

.docs-main h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  text-wrap: balance;
}

.docs-lead {
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  margin: 0 0 28px;
  max-width: 60ch;
}

.docs-shot {
  display: block;
  max-width: 340px;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 0 0 32px;
}

.docs-section {
  margin: 0 0 40px;
}

.docs-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 0 0 14px;
}

.docs-item h3 {
  margin: 0 0 10px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.docs-item dl {
  margin: 0;
}

.docs-item dt {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin: 10px 0 4px;
}

.docs-item dt:first-of-type {
  margin-top: 0;
}

.docs-item dd {
  margin: 0 0 4px;
  color: var(--fg);
  line-height: 1.6;
}

.docs-item dd.docs-example {
  font-family: var(--font-mono);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-block;
  font-size: 0.9em;
}

.docs-note {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--fg);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.docs-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.docs-toc a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
}

.docs-toc a:hover {
  border-color: var(--accent);
}

.docs-toc strong {
  color: var(--accent);
}

.docs-toc span {
  display: block;
  color: var(--muted);
  font-size: 0.9375rem;
  margin-top: 2px;
}

.docs-footer {
  max-width: 760px;
  margin: 24px auto 48px;
  padding: 24px 24px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.docs-footer a {
  color: var(--muted);
}

.docs-footer a:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .docs-header, .docs-nav, .docs-main, .docs-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ---------- công tắc Sáng/Tối ---------- */
/* LƯU Ý: khối này nhân bản ở style.css và guide/docs.css (mỗi trang chỉ nạp một
   file) — SỬA CẢ HAI khi đổi. */

.theme-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  display: none;
  width: 18px;
  height: 18px;
}

/* Chưa có JS (hoặc JS tắt) → coi như Tự động */
:root:not([data-theme]) .theme-icon-auto,
:root[data-theme="auto"] .theme-icon-auto,
:root[data-theme="light"] .theme-icon-light,
:root[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* ---------- header: thêm dropdown ngôn ngữ ---------- */

.docs-header {
  position: relative;
}

/* Nút theme ở góc phải header tài liệu; ô ngôn ngữ dịch sang trái nhường chỗ.
   Bề rộng nút cố định (34px) nên khoảng cách tính được, không phụ thuộc độ dài
   tên ngôn ngữ. */
.docs-header .theme-toggle {
  position: absolute;
  right: 24px;
  top: 20px;
}

.docs-lang-select {
  position: absolute;
  right: 66px;
  top: 20px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- bố cục 2 cột: sidebar trái + nội dung ---------- */

.docs-body {
  display: flex;
  max-width: 960px;
  margin: 0 auto;
  gap: 32px;
  padding: 0 24px;
  align-items: flex-start;
}

.docs-sidebar {
  flex: none;
  width: 160px;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-sidebar a {
  padding: 6px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.docs-sidebar a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.docs-body .docs-main {
  flex: 1;
  max-width: 720px;
  margin: 0;
  padding: 8px 0 56px;
  min-width: 0;
}

/* ---------- responsive: sidebar xếp lại thành hàng ngang trên màn hình hẹp ---------- */

@media (max-width: 720px) {
  .docs-body {
    flex-direction: column;
    padding: 0 20px;
  }

  .docs-sidebar {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .docs-lang-select {
    position: static;
    margin-top: 8px;
  }

  .docs-header .theme-toggle {
    position: static;
    margin-top: 8px;
  }
}

/* ---------- bảng phím (trang Gõ tiếng Việt) ---------- */

.docs-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.docs-table th {
  color: var(--muted);
  font-weight: 600;
}

.docs-table tbody tr:nth-child(even) {
  background: var(--bg-soft);
}

.docs-table kbd,
.docs-table code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
