@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #0b0d14;
  --surface: #151925;
  --surface2: #20263a;
  --border: #303852;
  --text: #edf1fa;
  --text-muted: #a2acc0;
  --accent: #00e5a0;
  --accent-light: #65f2c3;
  --green: #00e5a0;
  --red: #f87171;
  --yellow: #fbbf24;
  --code-bg: #12141f;
  --font-mono: 'DM Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
}
body::before {
  content: '';
  position: fixed;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(rgba(8,10,18,.88), rgba(8,10,18,.94)),
    url('https://images.unsplash.com/photo-1486325212027-8081e485255e?auto=format&fit=crop&w=1920&q=80') center / cover no-repeat;
  pointer-events: none;
}

/* Layout */
.layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: rgba(6,8,16,.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-logo a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -.01em;
}

.sidebar-logo .dot {
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulse 2s infinite;
}
.doc-search-trigger { width: calc(100% - 40px); display: flex; align-items: center; gap: 7px; margin: 0 20px 14px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; background: rgba(255,255,255,.035); color: var(--text-muted); font: .76rem var(--font-sans); cursor: pointer; }
.doc-search-trigger:hover { color: var(--text); border-color: rgba(0,229,160,.28); }.doc-search-trigger kbd { margin-left: auto; padding: 1px 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; color: rgba(255,255,255,.35); font: .62rem var(--font-mono); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sidebar-section {
  margin-top: 13px;
  padding: 14px 20px 5px;
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo + .doc-search-trigger + .sidebar-section { margin-top: 0; }

.sidebar nav a {
  display: block;
  padding: 7px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar nav > a { color: rgba(255,255,255,.78); font-weight: 500; }

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text);
  background: rgba(255,255,255,.08);
  border-left-color: var(--accent);
  text-decoration: none;
}
.sidebar nav a.active { font-weight: 600; }

/* Accordéon sidebar */
.sidebar details { width: 100%; }

.sidebar details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 20px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  cursor: pointer;
  list-style: none;
  transition: all 0.15s;
  user-select: none;
}
.sidebar details summary::-webkit-details-marker { display: none; }

.sidebar details summary:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.sidebar details[open] > summary {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(255,255,255,.06);
}
.sidebar details > summary.active { color: var(--text); border-left-color: var(--accent); background: rgba(255,255,255,.08); }

.sidebar details[open] > summary .chevron { transform: rotate(90deg); }

.chevron {
  font-size: 10px;
  transition: transform 0.2s;
  opacity: 0.5;
  flex-shrink: 0;
}

/* Sous-liens dans l'accordéon */
.sidebar details .sub-links a {
  padding-left: 30px;
  font-size: 13px;
  color: rgba(255,255,255,.25);
}

.sidebar details .sub-links a.active {
  color: var(--accent-light);
  background: rgba(255,255,255,.08);
  border-left-color: var(--accent);
}

/* Active sur le parent (summary) */
.sidebar details summary.active { color: var(--text); border-left-color: var(--accent); background: rgba(255,255,255,.08); }

/* Main content */
.main {
  flex: 1;
  width: 0;
  padding: 0 clamp(28px, 5vw, 52px) 80px;
  max-width: none;
  overflow-x: hidden;
}

/* Typography */
h1 {
  font-size: clamp(2.25rem, 4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}

h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-light);
  margin: 28px 0 12px;
}

p {
  color: var(--text-muted);
  margin-bottom: 12px;
}

li { color: var(--text-muted); }
li + li { margin-top: 6px; }
h2, h3 { scroll-margin-top: 28px; }

p strong, li strong {
  color: var(--text);
}

a {
  color: var(--accent-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Page header */
.page-header {
  padding-top: 48px;
  margin-bottom: 40px;
  padding-bottom: 0;
  border-bottom: 0;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 8px;
}

.docs-eyebrow { color: var(--accent); font: 500 .68rem var(--font-mono); letter-spacing: .13em; text-transform: uppercase; margin-bottom: 14px; }
.docs-home section { margin: 0 0 44px; }
.docs-home h2 { margin-top: 0; }
.docs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.docs-card { min-height: 168px; display: flex; flex-direction: column; gap: 9px; padding: 20px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(15,18,30,.72); box-shadow: 0 4px 24px rgba(0,0,0,.4); text-decoration: none; transition: transform .2s, border-color .2s, background .2s; }
.docs-card:hover { transform: translateY(-2px); border-color: rgba(0,229,160,.3); background: rgba(20,24,40,.8); text-decoration: none; }
.docs-card span { color: var(--accent); font: .72rem var(--font-mono); }
.docs-card strong { color: var(--text); font-size: 1rem; font-weight: 500; }
.docs-card small { color: var(--text-muted); font-size: .8rem; line-height: 1.55; }
.docs-search-shell { margin: -12px 0 44px; max-width: 680px; }
.docs-search-shell label { display: block; color: var(--text); font-size: .82rem; font-weight: 500; margin-bottom: 8px; }
.docs-search-shell input { width: 100%; padding: 13px 15px; border: 1px solid var(--border); border-radius: 9px; background: rgba(15,18,30,.78); color: var(--text); font: .9rem var(--font-sans); }
.docs-search-shell input:focus { outline: 2px solid rgba(0,229,160,.55); outline-offset: 2px; border-color: var(--accent); }
.search-results { margin-top: 8px; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: rgba(15,18,30,.96); }
.search-results a { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); text-decoration: none; }
.search-results a:last-child { border-bottom: 0; }.search-results a:hover, .search-results a.keyboard-active { background: rgba(0,229,160,.1); text-decoration: none; }
.search-results strong, .search-results span { display: block; }.search-results strong { color: var(--accent-light); font-size: .84rem; }.search-results span, .search-results p { color: var(--text-muted); font-size: .78rem; line-height: 1.5; margin: 3px 0 0; }
.doc-search-modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: start center; padding: min(14vh, 130px) 20px 20px; background: rgba(3,5,10,.7); backdrop-filter: blur(4px); }.doc-search-modal[hidden] { display: none; }.doc-search-dialog { position: relative; width: min(100%, 680px); padding: 22px; border: 1px solid var(--border); border-radius: 13px; background: #151925; box-shadow: 0 24px 80px rgba(0,0,0,.55); }.doc-search-dialog label { display: block; margin-bottom: 10px; color: var(--text); font-size: .9rem; font-weight: 500; }.doc-search-dialog input { width: 100%; padding: 13px 42px 13px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--code-bg); color: var(--text); font: .9rem var(--font-sans); }.doc-search-dialog input:focus { outline: 2px solid rgba(0,229,160,.55); outline-offset: 2px; border-color: var(--accent); }.doc-search-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }.search-hint { margin: 12px 0 0; color: var(--text-muted); font-size: .7rem; }.search-open { overflow: hidden; }
.page-toc { display: none; }.mobile-toc { display: none; }
.doc-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--border); }.doc-pagination a { min-height: 66px; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: rgba(15,18,30,.72); color: var(--text); text-decoration: none; }.doc-pagination a:hover { border-color: rgba(0,229,160,.35); text-decoration: none; }.doc-pagination small { color: var(--text-muted); font-size: .7rem; }.doc-pagination .next { text-align: right; }
@media (min-width: 1180px) { .main { padding-right: 285px; }.page-toc { position: fixed; display: flex; flex-direction: column; gap: 5px; top: 48px; right: 28px; width: 205px; max-height: calc(100vh - 96px); overflow: auto; padding-left: 16px; border-left: 1px solid var(--border); }.page-toc span { margin-bottom: 6px; color: var(--text); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }.page-toc a { color: var(--text-muted); font-size: .75rem; line-height: 1.35; text-decoration: none; }.page-toc a:hover, .page-toc a.active { color: var(--accent-light); text-decoration: none; } }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-left: 8px;
  vertical-align: middle;
}

.badge.green { background: rgba(52, 211, 153, 0.1); color: var(--green); border-color: rgba(52,211,153,0.3); }
.badge.yellow { background: rgba(251, 191, 36, 0.1); color: var(--yellow); border-color: rgba(251,191,36,0.3); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 16px 0; }
.table-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.table-wrap table { min-width: 580px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr {
  background: var(--surface2);
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}

td:first-child {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-light);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 52px 20px 20px;
  position: relative;
  overflow-x: auto;
  margin: 16px 0;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: #a5b4fc;
}

p code, li code, td code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--accent-light);
}

/* SQL syntax highlight classes */
.kw { color: #c084fc; }   /* keywords */
.fn { color: #67e8f9; }   /* functions */
.st { color: #86efac; }   /* strings */
.cm { color: #4b5563; font-style: italic; } /* comments */
.nb { color: #fbbf24; }   /* numbers */

/* Info boxes */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  border: 1px solid;
}

.callout.info {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

.callout.warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.stat-card .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Schema block */
.schema {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
}

.schema-row {
  display: grid;
  grid-template-columns: 180px 110px 1fr;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.schema-row:last-child { border-bottom: none; }

.schema-row:hover { background: rgba(255,255,255,0.02); }

.schema-col { font-family: var(--font-mono); color: var(--accent-light); }
.schema-type { color: var(--yellow); }
.schema-desc { color: var(--text-muted); font-family: var(--font-sans); }

.schema-header {
  background: var(--surface2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.schema-header .schema-col,
.schema-header .schema-type,
.schema-header .schema-desc {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

/* Query example */
.query-block {
  margin: 24px 0;
}

.query-block .query-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.query-block .query-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

/* Reading tools, added by docs.js */
.doc-menu-toggle {
  display: none;
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 14px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(21,25,37,.94);
  color: var(--text);
  font: 600 12px var(--font-sans);
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.doc-menu-toggle:hover { border-color: var(--accent-light); }
.doc-menu-overlay { display: none; }
.reading-progress { position: fixed; z-index: 40; top: 0; left: 0; width: 100%; height: 3px; background: transparent; }
.reading-progress > span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), #67e8f9); transition: width .08s linear; }
.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--surface2);
  color: var(--text-muted);
  font: 600 11px var(--font-sans);
  cursor: pointer;
}
.copy-code:hover, .copy-code:focus-visible { color: var(--text); border-color: var(--accent-light); }
.sidebar nav a:focus-visible, .sidebar summary:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }

/* Responsive */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .layout { display: block; }
  .sidebar {
    display: block;
    position: fixed;
    z-index: 25;
    inset: 0 auto 0 0;
    width: min(84vw, 320px);
    height: 100dvh;
    padding-top: 72px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 40px rgba(0,0,0,.35);
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar { transform: translateX(0); }
  .doc-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .doc-menu-overlay { position: fixed; z-index: 20; inset: 0; background: rgba(3,5,10,.64); opacity: 0; transition: opacity .22s ease; }
  body.menu-open .doc-menu-overlay { display: block; opacity: 1; clip-path: inset(0 0 0 min(84vw, 320px)); }
  .main { width: 100%; max-width: none; padding: 72px 20px 52px; }
  .page-header { margin-bottom: 34px; padding-bottom: 22px; }
  .page-header .subtitle { font-size: 14px; line-height: 1.65; }
  h2 { margin-top: 34px; }
  h3 { margin-top: 24px; }
  pre { margin-inline: -4px; border-radius: 8px; padding: 16px 48px 16px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .mobile-toc { display: block; margin: -14px 0 30px; border: 1px solid var(--border); border-radius: 8px; background: rgba(15,18,30,.72); }.mobile-toc summary { cursor: pointer; padding: 10px 12px; color: var(--text); font-size: .82rem; font-weight: 500; }.mobile-toc nav { display: grid; gap: 2px; padding: 0 12px 12px; }.mobile-toc a { padding: 5px 0; color: var(--text-muted); font-size: .8rem; text-decoration: none; }.mobile-toc a.active { color: var(--accent-light); }
  .doc-search-trigger { margin-bottom: 18px; }
  .callout { align-items: flex-start; }
  .schema-row { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
