/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1a73e8;
  --brand-dark:  #1558b0;
  --sidebar-bg:  #1e2a3a;
  --sidebar-txt: #c8d6e5;
  --sidebar-act: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.10);
  --sidebar-w:   260px;
  --header-h:    56px;
  --bg:          #f8f9fa;
  --surface:     #ffffff;
  --border:      #e0e0e0;
  --text:        #202124;
  --text-muted:  #5f6368;
  --code-bg:     #f1f3f4;
  --link:        #1a73e8;
  --note-bg:     #e8f0fe;
  --note-border: #1a73e8;
  --warn-bg:     #fef7e0;
  --warn-border: #f9ab00;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--brand);
  color: #fff;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.menu-toggle:hover { background: rgba(255,255,255,0.15); }

.brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sep  { opacity: 0.5; }
.brand-sub  { font-size: 14px; opacity: 0.85; }
.view-badge { height: 20px; margin-left: 10px; vertical-align: middle; opacity: 0.9; border-radius: 3px; }

.lang-switch { display: flex; align-items: center; gap: 4px; }
.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.lang-btn:hover     { background: rgba(255,255,255,0.25); }
.lang-btn.active    { background: #fff; color: var(--brand); border-color: #fff; }

/* ── Layout ──────────────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 20px 0;
  transition: transform 0.25s ease;
  z-index: 90;
}

.sidebar ul { list-style: none; }
.sidebar ul li a {
  display: block;
  padding: 9px 24px;
  color: var(--sidebar-txt);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.sidebar ul li a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-act);
}
.sidebar ul li a.active {
  color: var(--sidebar-act);
  border-left-color: var(--brand);
  background: rgba(26,115,232,0.15);
  font-weight: 600;
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 900px;
}

section {
  margin-bottom: 60px;
  padding-top: 8px;
}

/* ── Typography ──────────────────────────────────────────────── */
h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand);
}
h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 8px;
}
p { margin-bottom: 12px; color: var(--text); }
em { color: var(--text-muted); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Lists ───────────────────────────────────────────────────── */
ul, ol {
  padding-left: 24px;
  margin-bottom: 12px;
}
li { margin-bottom: 6px; }
li:last-child { margin-bottom: 0; }

/* ── Code ────────────────────────────────────────────────────── */
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: #c62828;
}

/* ── Tables ──────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 14px;
}
th {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
}
td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:nth-child(even) td { background: #f8f9fa; }
tr:hover td { background: var(--note-bg); }

/* ── Note / Warning boxes ────────────────────────────────────── */
.note, .warn {
  border-left: 4px solid;
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 14px;
}
.note { background: var(--note-bg); border-color: var(--note-border); }
.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.note strong, .warn strong { font-weight: 700; }

/* ── Steps ───────────────────────────────────────────────────── */
ol.steps { padding-left: 0; list-style: none; counter-reset: step; }
ol.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  align-items: flex-start;
}
ol.steps li::before {
  content: counter(step);
  min-width: 26px; height: 26px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ── Overlay (mobile) ────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 80;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .brand-sub   { display: none; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .overlay.open { display: block; }

  .main-content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  .main-content { padding: 16px 14px 60px; }
}
