/* ============================================================
   Martiqo Documentation — documentation/assets/docs.css
   Neutral reading layout, Martiqo blue accents. No external dependencies.
   ============================================================ */

:root {
  --docs-blue: #2563eb;
  --docs-blue-dark: #1d4ed8;
  --docs-blue-soft: #eff6ff;
  --docs-text: #1f2937;
  --docs-muted: #6b7280;
  --docs-border: #e5e7eb;
  --docs-bg: #ffffff;
  --docs-bg-soft: #f9fafb;
  --docs-code-bg: #0f172a;
  --docs-code-text: #e2e8f0;
  --docs-topbar-h: 60px;
  --docs-footer-h: 44px;
  --docs-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --docs-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-padding-top: calc(var(--docs-topbar-h) + 16px); }

body.docs-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--docs-font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--docs-text);
  background: var(--docs-bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ── Top bar ─────────────────────────────────────────────── */
.docs-topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--docs-topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--docs-border);
}
.docs-topbar-inner {
  max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
}
.docs-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--docs-text); }
.docs-brand:hover { text-decoration: none; }
.docs-brand img { display: block; border-radius: 6px; }
.docs-brand-name { font-size: 20px; font-weight: 800; color: var(--docs-blue); letter-spacing: .01em; }
.docs-brand-sep { width: 1px; height: 22px; background: var(--docs-border); margin: 0 4px; }
.docs-brand-sub { font-size: 17px; font-weight: 600; }
.docs-back { margin-left: auto; font-size: 14px; font-weight: 500; white-space: nowrap; }
.docs-menu-btn {
  display: none; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--docs-border); border-radius: 8px;
  background: #fff; color: var(--docs-text); font: inherit; font-size: 14px; cursor: pointer;
}

/* ── Shell (3 columns) ───────────────────────────────────── */
.docs-shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 0 40px;
  padding: 0 20px;
}

/* ── Left navigation ─────────────────────────────────────── */
.docs-sidebar {
  position: sticky; top: var(--docs-topbar-h);
  height: calc(100vh - var(--docs-topbar-h) - var(--docs-footer-h));
  overflow-y: auto;
  padding: 20px 8px 40px 0;
  border-right: 1px solid var(--docs-border);
}
.docs-filter { padding: 0 8px 12px 0; }
.docs-filter input {
  width: 100%; padding: 8px 12px;
  border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--docs-text); background: #fff;
}
.docs-filter input:focus { outline: 2px solid var(--docs-blue); outline-offset: 0; border-color: var(--docs-blue); }
.docs-nav { font-size: 14px; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--docs-text); }
.docs-nav a:hover { background: var(--docs-bg-soft); text-decoration: none; }
.docs-nav a.is-active { background: var(--docs-blue-soft); color: var(--docs-blue-dark); font-weight: 600; }
.docs-nav-home { margin-bottom: 6px; font-weight: 500; }
.docs-nav-section { margin: 2px 0; }
.docs-nav-section summary {
  list-style: none; cursor: pointer;
  padding: 6px 10px; border-radius: 6px;
  font-weight: 600; color: var(--docs-text);
  display: flex; align-items: center; gap: 6px;
}
.docs-nav-section summary::-webkit-details-marker { display: none; }
.docs-nav-section summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 2px solid var(--docs-muted); border-bottom: 2px solid var(--docs-muted);
  transform: rotate(-45deg); transition: transform .15s ease; margin-right: 2px;
}
.docs-nav-section[open] summary::before { transform: rotate(45deg); }
.docs-nav-section summary:hover { background: var(--docs-bg-soft); }
.docs-nav-section ul { list-style: none; margin: 2px 0 6px; padding: 0 0 0 14px; }
.docs-filter-empty { color: var(--docs-muted); padding: 6px 10px; margin: 0; }

/* ── Article ─────────────────────────────────────────────── */
.docs-main { min-width: 0; padding: 24px 0 64px; }
.docs-breadcrumb { font-size: 14px; color: var(--docs-muted); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.docs-article { max-width: 780px; }
.docs-article h1 { font-size: 36px; line-height: 1.2; font-weight: 700; margin: 8px 0 8px; letter-spacing: -.01em; }
.docs-updated { color: var(--docs-muted); font-size: 14px; margin: 0 0 24px; }
.docs-article h2 { font-size: 26px; line-height: 1.3; font-weight: 700; margin: 40px 0 12px; }
.docs-article h3 { font-size: 20px; line-height: 1.35; font-weight: 600; margin: 28px 0 8px; }
.docs-article p, .docs-article ul, .docs-article ol { margin: 0 0 16px; }
.docs-article ul, .docs-article ol { padding-left: 24px; }
.docs-article li { margin: 4px 0; }
.docs-article .docs-lead { font-size: 18px; color: #374151; }
.docs-article :not(pre) > code {
  font-family: var(--docs-mono); font-size: .88em;
  background: #f3f4f6; border: 1px solid var(--docs-border); border-radius: 4px; padding: 1px 5px;
  word-break: break-word;
}
.docs-article table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 15px; }
.docs-article th, .docs-article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--docs-border); vertical-align: top; }
.docs-article th { background: var(--docs-bg-soft); font-weight: 600; }
.docs-table-wrap { overflow-x: auto; }

/* Steps (numbered how-to) */
.docs-steps { counter-reset: docs-step; list-style: none; padding-left: 0 !important; }
.docs-steps > li { counter-increment: docs-step; position: relative; padding-left: 44px; margin: 0 0 16px; }
.docs-steps > li::before {
  content: counter(docs-step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--docs-blue-soft); color: var(--docs-blue-dark);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
}

/* Code samples */
.docs-code { margin: 0 0 20px; border-radius: 10px; overflow: hidden; border: 1px solid #1e293b; }
.docs-code-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: #1e293b; color: #94a3b8; font-size: 12px; font-weight: 600; letter-spacing: .03em;
}
.docs-copy {
  border: 1px solid #334155; border-radius: 6px; background: transparent; color: #e2e8f0;
  font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer;
}
.docs-copy:hover { background: #334155; }
.docs-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--docs-code-bg); }
.docs-code code { font-family: var(--docs-mono); font-size: 13.5px; line-height: 1.6; color: var(--docs-code-text); white-space: pre; }

/* Callouts */
.docs-callout { margin: 0 0 20px; padding: 12px 16px; border-radius: 8px; border-left: 4px solid; }
.docs-callout > div > :last-child { margin-bottom: 0; }
.docs-callout-title { font-weight: 700; font-size: 14px; margin: 0 0 4px !important; }
.docs-callout-note    { background: var(--docs-blue-soft); border-color: var(--docs-blue); }
.docs-callout-tip     { background: #f0fdf4; border-color: #16a34a; }
.docs-callout-warning { background: #fffbeb; border-color: #d97706; }

/* Live preview box */
.docs-preview {
  margin: 0 0 12px; padding: 24px; border: 1px dashed #d1d5db; border-radius: 10px;
  background: var(--docs-bg-soft); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px;
}
.docs-preview-label { font-size: 12px; font-weight: 600; color: var(--docs-muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 6px !important; }

/* Buttons */
.docs-btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  background: var(--docs-blue); color: #fff; font-weight: 600; font-size: 15px;
}
.docs-btn:hover { background: var(--docs-blue-dark); text-decoration: none; }

/* Previous / next */
.docs-pager {
  max-width: 780px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--docs-border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.docs-pager a { display: block; padding: 14px 16px; border: 1px solid var(--docs-border); border-radius: 10px; color: var(--docs-text); }
.docs-pager a:hover { border-color: var(--docs-blue); text-decoration: none; }
.docs-pager span { display: block; font-size: 13px; color: var(--docs-muted); }
.docs-pager strong { color: var(--docs-blue); font-weight: 600; }
.docs-pager-next { text-align: right; grid-column: 2; }

/* ── Home ────────────────────────────────────────────────── */
.docs-home { max-width: 980px; }
.docs-home h1 { font-size: 40px; margin-top: 16px; }
.docs-home-search { margin: 8px 0 32px; max-width: 560px; }
.docs-home-search input {
  width: 100%; padding: 12px 16px; border: 1px solid #d1d5db; border-radius: 10px; font: inherit; font-size: 16px;
}
.docs-home-search input:focus { outline: 2px solid var(--docs-blue); border-color: var(--docs-blue); }
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.docs-card { border: 1px solid var(--docs-border); border-radius: 12px; padding: 20px; background: #fff; }
.docs-card h2 { font-size: 19px !important; margin: 0 0 6px !important; }
.docs-card p { color: var(--docs-muted); font-size: 15px; margin: 0 0 12px !important; }
.docs-card ul { list-style: none; padding: 0 !important; margin: 0 !important; }
.docs-card li { margin: 6px 0; font-size: 15px; }

/* ── In this article ─────────────────────────────────────── */
.docs-toc {
  position: sticky; top: var(--docs-topbar-h);
  max-height: calc(100vh - var(--docs-topbar-h) - var(--docs-footer-h)); overflow-y: auto;
  padding: 28px 0 40px; font-size: 14px;
}
.docs-toc-title { font-weight: 700; margin: 0 0 10px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--docs-border); }
.docs-toc li a { display: block; padding: 4px 0 4px 12px; margin-left: -2px; border-left: 2px solid transparent; color: #4b5563; }
.docs-toc li.docs-toc-h3 a { padding-left: 24px; }
.docs-toc li a:hover { color: var(--docs-blue); text-decoration: none; }
.docs-toc li a.is-active { color: var(--docs-blue-dark); border-left-color: var(--docs-blue); font-weight: 600; }

/* ── Footer ──────────────────────────────────────────────── */
.docs-footer {
  /* Always visible, like the Martiqo footer (footer.php: sticky bottom-0) */
  position: sticky; bottom: 0; z-index: 30;
  min-height: var(--docs-footer-h);
  background: #fff;
  border-top: 1px solid var(--docs-border); padding: 0 20px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 18px;
  font-size: 13px; color: var(--docs-muted);
}
.docs-footer a { color: var(--docs-muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .docs-shell { grid-template-columns: 260px minmax(0, 1fr); }
  .docs-toc { display: none !important; }
}
@media (max-width: 1024px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .docs-menu-btn { display: inline-flex; }
  .docs-sidebar {
    position: fixed; top: var(--docs-topbar-h); left: 0; bottom: var(--docs-footer-h); z-index: 45;
    width: 300px; max-width: 85vw; height: auto;
    background: #fff; padding: 16px; border-right: 1px solid var(--docs-border);
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .docs-sidebar.is-open { transform: translateX(0); box-shadow: 0 10px 30px rgba(0,0,0,.15); }
  .docs-sidebar-backdrop { position: fixed; inset: var(--docs-topbar-h) 0 var(--docs-footer-h) 0; z-index: 40; background: rgba(17,24,39,.35); }
}
@media (max-width: 640px) {
  .docs-topbar-inner { padding: 0 16px; gap: 10px; }
  .docs-brand-name { font-size: 17px; }
  .docs-brand-sep { margin: 0 2px; }
  .docs-brand-sub { font-size: 15px; }
  .docs-menu-btn span { display: none; }
  .docs-back { font-size: 13px; }
  .docs-back-long { display: none; }
  .docs-footer { gap: 2px 12px; font-size: 12px; padding: 6px 12px; }
  .docs-brand img { display: none; }
  .docs-article h1 { font-size: 28px; }
  .docs-home h1 { font-size: 30px; }
  .docs-article h2 { font-size: 22px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { grid-column: 1; }
}
