/* ==========================================================================
   MikroTik Manager — Documentation styles
   Shared by every page under /docs/.

   Theme model: three states.
     - no data-theme attribute  -> follow the operating system (auto, default)
     - data-theme="light"       -> forced light
     - data-theme="dark"        -> forced dark
   Light is the base palette on bare :root. Dark is redefined twice: once
   under prefers-color-scheme (guarded so a forced light wins) and once under
   an explicit data-theme="dark" (so the toggle wins in both directions).
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Light palette — the reading default */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-card: #f9fafc;
  --bg-code: #f4f5f8;
  --border-color: #e2e5ec;
  --text-primary: #161924;
  --text-secondary: #4c5468;
  --text-muted: #79819a;
  --nav-bg: rgba(255, 255, 255, 0.85);

  --accent-primary: #2563eb;
  --accent-success: #16a34a;
  --accent-warning: #d97706;
  --accent-danger: #dc2626;

  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-md: 0 4px 12px rgba(15, 20, 40, 0.08);

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition-fast: 150ms ease;
}

/* Dark — lighter than the landing page (#0a0b0f) on purpose: docs are read
   for minutes at a time, not glanced at. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #12141c;
    --bg-secondary: #171a24;
    --bg-card: #191c26;
    --bg-code: #1d212c;
    --border-color: #2b3040;
    --text-primary: #dfe3ee;
    --text-secondary: #a2aac0;
    --text-muted: #737c94;
    --nav-bg: rgba(18, 20, 28, 0.85);

    --accent-primary: #60a5fa;
    --accent-success: #4ade80;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg-primary: #12141c;
  --bg-secondary: #171a24;
  --bg-card: #191c26;
  --bg-code: #1d212c;
  --border-color: #2b3040;
  --text-primary: #dfe3ee;
  --text-secondary: #a2aac0;
  --text-muted: #737c94;
  --nav-bg: rgba(18, 20, 28, 0.85);

  --accent-primary: #60a5fa;
  --accent-success: #4ade80;
  --accent-warning: #fbbf24;
  --accent-danger: #f87171;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

::selection { background: var(--accent-primary); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* --------------------------------------------------------------------------
   Navbar — matches the rest of mikr.app
   -------------------------------------------------------------------------- */

.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 14px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.navbar.scrolled { border-bottom-color: var(--border-color); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; }

.nav-brand { display: flex; align-items: center; gap: 10px; color: var(--text-primary); }
.nav-brand:hover { text-decoration: none; }
.nav-logo { width: 34px; height: 34px; background: var(--accent-primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-brand-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link { padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); border-radius: 10px; transition: color 0.15s, background 0.15s; }
.nav-link:hover { color: var(--text-primary); background: var(--bg-card); text-decoration: none; }
.nav-link.active { color: var(--accent-primary); }
.nav-cta { margin-left: 8px; padding: 7px 18px; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent-primary); border-radius: 10px; transition: background 0.15s; }
.nav-cta:hover { background: #1d4ed8; text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 4px; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px; gap: 8px;
  }
  .nav-links.open .nav-link, .nav-links.open .nav-cta { display: block; text-align: center; }
  .nav-links.open .nav-cta { margin-left: 0; margin-top: 4px; }
}

/* --------------------------------------------------------------------------
   Theme switch (auto / light / dark)
   -------------------------------------------------------------------------- */

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 10px;
  padding: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.theme-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 24px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.theme-switch button:hover { color: var(--text-primary); }
.theme-switch button[aria-pressed="true"] {
  background: var(--bg-primary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}
.theme-switch svg { width: 15px; height: 15px; }

@media (max-width: 900px) {
  .nav-links.open .theme-switch { align-self: center; margin-left: 0; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { text-align: center; padding: 100px 24px 32px; }
.hero h1 { font-size: 36px; font-weight: 700; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.5px; }
.hero h1 span { color: var(--accent-primary); }
.hero p { font-size: 16px; color: var(--text-secondary); max-width: 620px; margin: 0 auto; }

/* Docs sub-navigation, sits under the hero on every docs page */
.docs-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 40px;
}
.docs-nav a {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.docs-nav a:hover { color: var(--text-primary); border-color: var(--text-muted); text-decoration: none; }
.docs-nav a.active { color: var(--accent-primary); border-color: var(--accent-primary); }

/* --------------------------------------------------------------------------
   Table of contents
   -------------------------------------------------------------------------- */

.toc {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 48px;
}
.toc-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 6px; }
.toc li::before { content: counter(toc) "."; color: var(--text-muted); font-weight: 600; font-size: 13px; margin-right: 8px; }
.toc a { font-size: 14px; font-weight: 500; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { margin-bottom: 48px; }
.section h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); letter-spacing: -0.3px; }
.section h3 { font-size: 16px; font-weight: 600; margin: 26px 0 12px; }
.section p { color: var(--text-secondary); margin-bottom: 12px; }
.section ul, .section ol { color: var(--text-secondary); margin-bottom: 16px; padding-left: 24px; }
.section li { margin-bottom: 6px; }

/* Anchor affordance on headings */
.section h2 a.anchor, .section h3 a.anchor {
  margin-left: 8px;
  color: var(--text-muted);
  opacity: 0;
  font-weight: 400;
  transition: opacity var(--transition-fast);
}
.section h2:hover a.anchor, .section h3:hover a.anchor { opacity: 1; }

/* Numbered walkthrough steps, for Getting Started */
.steps { list-style: none; counter-reset: step; padding-left: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 28px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-primary);
  color: #fff;
  font-size: 13px; font-weight: 700;
  border-radius: 50%;
}
.steps > li > h3 { margin-top: 2px; }

/* --------------------------------------------------------------------------
   Code
   -------------------------------------------------------------------------- */

pre {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
  position: relative;
}
code { font-family: var(--font-mono); font-size: 13px; line-height: 1.6; }
pre code { color: var(--text-primary); }
:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  color: var(--accent-primary);
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  opacity: 0;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.c { color: var(--text-muted); }

/* Aside under a code block. Carried over from install.html, where it only ever
   had an inline style. */
.note { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-icon { flex-shrink: 0; margin-top: 3px; }
.alert-warning { background: rgba(217, 119, 6, 0.08); border: 1px solid rgba(217, 119, 6, 0.25); color: var(--accent-warning); }
.alert-info    { background: rgba(37, 99, 235, 0.08); border: 1px solid rgba(37, 99, 235, 0.25); color: var(--accent-primary); }
.alert-success { background: rgba(22, 163, 74, 0.08); border: 1px solid rgba(22, 163, 74, 0.25); color: var(--accent-success); }
.alert-danger  { background: rgba(220, 38, 38, 0.08); border: 1px solid rgba(220, 38, 38, 0.25); color: var(--accent-danger); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 14px; }
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
.table-wrap table { margin-bottom: 0; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-color); }
th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
td { color: var(--text-secondary); }
td code { font-size: 12px; }

/* --------------------------------------------------------------------------
   Docs hub cards (/docs/ index)
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.doc-card {
  display: block;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: inherit;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.doc-card:hover { border-color: var(--accent-primary); text-decoration: none; transform: translateY(-2px); }
.doc-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.doc-card p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.doc-card .card-tag { display: inline-block; margin-bottom: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Q&A blocks for Troubleshooting
   -------------------------------------------------------------------------- */

.symptom {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  background: var(--bg-card);
}
.symptom > h3 { margin-top: 0; font-size: 15px; }
.symptom > h3::before { content: "▸ "; color: var(--accent-primary); }
.symptom p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 48px;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--text-secondary); }
footer .footer-links { margin-bottom: 10px; }
footer .footer-links a { margin: 0 12px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .hero { padding-top: 88px; }
  .hero h1 { font-size: 26px; }
  pre { font-size: 12px; padding: 12px 14px; }
  .steps > li { padding-left: 38px; }
}
