/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2535;
  --border:    #2a3248;
  --text:      #d4daf0;
  --text-muted:#7a8ab0;
  --text-dim:  #4a5580;
  --accent:    #4f8ef7;
  --accent2:   #7c5cfa;
  --green:     #34d399;
  --red:       #f87171;
  --yellow:    #fbbf24;

  --csv-color: #34d399;
  --xlsx-color:#34bbd3;
  --xml-color: #f59e0b;
  --json-color:#a78bfa;

  --sidebar-w: 240px;
  --radius:    10px;
  --font:      'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:      'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.logo-icon { font-size: 1.5rem; }
.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.sidebar ul { list-style: none; padding: 0; }
.sidebar > ul > li { margin: 0; }
.sidebar > ul > li > a {
  display: block;
  padding: 0.45rem 1.2rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar > ul > li > a:hover,
.sidebar > ul > li > a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(79,142,247,.07);
}

.sub-nav { list-style: none; padding: 0 0 0 1.2rem; }
.sub-nav a {
  display: block;
  padding: 0.3rem 1rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sub-nav a:hover, .sub-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  margin-left: var(--sidebar-w);
  max-width: 900px;
  padding: 0 3rem 4rem;
  width: 100%;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}
.hero-badge {
  display: inline-block;
  background: rgba(79,142,247,.15);
  color: var(--accent);
  border: 1px solid rgba(79,142,247,.3);
  border-radius: 20px;
  padding: 0.2rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 2rem;
  line-height: 1.7;
}
.hero-formats {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.fmt-pill {
  padding: 0.35rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.fmt-pill.csv  { background: rgba(52,211,153,.15); color: var(--csv-color);  border: 1px solid rgba(52,211,153,.3); }
.fmt-pill.xlsx { background: rgba(52,187,211,.15); color: var(--xlsx-color); border: 1px solid rgba(52,187,211,.3); }
.fmt-pill.xml  { background: rgba(245,158,11,.15); color: var(--xml-color);  border: 1px solid rgba(245,158,11,.3); }
.fmt-pill.json { background: rgba(167,139,250,.15); color: var(--json-color); border: 1px solid rgba(167,139,250,.3); }
.fmt-arrow { color: var(--text-dim); font-size: 1.1rem; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 3rem 0 1rem;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }

.section h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.7rem;
}
.section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.8rem;
}
.section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.2rem 0 0.6rem;
}
.section p { color: var(--text-muted); margin-bottom: 1rem; max-width: 700px; }

/* ============================================================
   CARDS (présentation)
   ============================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent); }
.card-icon { font-size: 1.6rem; margin-bottom: 0.7rem; }
.card h3 { font-size: 0.95rem; font-weight: 600; color: #fff; margin-bottom: 0.4rem; }
.card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; max-width: none; }

/* ============================================================
   PIPELINE
   ============================================================ */
.pipeline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.pipe-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  min-width: 110px;
  text-align: center;
}
.pipe-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.pipe-label { font-size: 0.78rem; color: var(--text-muted); line-height: 1.3; }
.pipe-arrow { color: var(--text-dim); font-size: 1.1rem; }

/* ============================================================
   FORMAT GRID
   ============================================================ */
.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.format-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  border-top-width: 3px;
}
.csv-card  { border-top-color: var(--csv-color);  }
.xlsx-card { border-top-color: var(--xlsx-color); }
.xml-card  { border-top-color: var(--xml-color);  }
.json-card { border-top-color: var(--json-color); }

.format-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.format-badge {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}
.format-badge.csv  { background: rgba(52,211,153,.15); color: var(--csv-color);  }
.format-badge.xlsx { background: rgba(52,187,211,.15); color: var(--xlsx-color); }
.format-badge.xml  { background: rgba(245,158,11,.15); color: var(--xml-color);  }
.format-badge.json { background: rgba(167,139,250,.15); color: var(--json-color); }
.format-dir { font-size: 0.78rem; color: var(--text-dim); }
.format-card p { font-size: 0.85rem; margin-bottom: 0.8rem; max-width: none; }

/* ============================================================
   CODE BLOCKS
   ============================================================ */
.code-block {
  background: #0a0d14;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0.8rem 0;
  font-size: 0.82rem;
}
.code-block.wide { font-size: 0.83rem; }
.code-lang {
  background: var(--bg3);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.9rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.code-block pre {
  font-family: var(--mono);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  white-space: pre;
  color: #c9d1e8;
  line-height: 1.6;
}

/* Inline code */
code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(79,142,247,.12);
  color: #93bcf7;
  padding: 0.1em 0.4em;
  border-radius: 4px;
}
.code-block pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* Syntax highlights inside pre */
.kw  { color: #7c5cfa; }
.cm  { color: #4a5a7a; font-style: italic; }

/* ============================================================
   PARAM TABLE
   ============================================================ */
.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.8rem 0;
}
.param-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  background: var(--bg3);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.param-table td {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(42,50,72,.6);
  color: var(--text-muted);
  vertical-align: top;
}
.param-table tr:last-child td { border-bottom: none; }
.param-table.compact td:first-child, .param-table.compact th:first-child { white-space: nowrap; }

/* ============================================================
   REF GRID (srcAttr syntax)
   ============================================================ */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.ref-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.ref-format {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.ref-format.csv  { background: rgba(52,211,153,.15); color: var(--csv-color);  }
.ref-format.xml  { background: rgba(245,158,11,.15); color: var(--xml-color);  }
.ref-format.json { background: rgba(167,139,250,.15); color: var(--json-color); }
.ref-syntax {
  display: block;
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--accent);
  background: none;
  padding: 0;
  margin-bottom: 0.4rem;
}
.ref-card p { font-size: 0.82rem; margin-bottom: 0.5rem; }

/* ============================================================
   FUNCTION BLOCKS
   ============================================================ */
.func-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.func-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.func-badge {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 6px;
}
.func-badge.sync   { background: rgba(79,142,247,.15); color: var(--accent);  border: 1px solid rgba(79,142,247,.3); }
.func-badge.group  { background: rgba(52,211,153,.15); color: var(--green);   border: 1px solid rgba(52,211,153,.3); }
.func-badge.search { background: rgba(251,191,36,.15); color: var(--yellow);  border: 1px solid rgba(251,191,36,.3); }
.func-desc { color: var(--text-muted); font-size: 0.9rem; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1rem 0;
}
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* Search diagram */
.search-diagram {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.82rem;
}
.sd-row { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.sd-row:last-child { border-bottom: none; }
.sd-header { background: var(--bg3); color: var(--text-muted); font-weight: 600; }
.sd-match { color: var(--yellow); }
.sd-result { color: var(--green); }
.sd-type { color: var(--text-dim); font-size: 0.78rem; }

/* ============================================================
   TIP BOX
   ============================================================ */
.tip {
  background: rgba(79,142,247,.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
  font-size: 0.87rem;
  color: var(--text-muted);
}
.tip strong { color: var(--accent); }

/* ============================================================
   SUBSTITUTION GRID
   ============================================================ */
.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.sub-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.sub-type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.sub-card p { font-size: 0.82rem; margin: 0.5rem 0 0; }

/* ============================================================
   QUALITY CARDS
   ============================================================ */
.quality-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (max-width: 700px) { .quality-cards { grid-template-columns: 1fr; } }
.qcard {
  border-radius: var(--radius);
  padding: 1.3rem;
  border: 1px solid var(--border);
}
.qcard.in  { background: rgba(52,211,153,.05); border-color: rgba(52,211,153,.25); }
.qcard.out { background: rgba(248,113,113,.05); border-color: rgba(248,113,113,.25); }
.qcard-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.qbadge {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 5px;
}
.qin  { background: rgba(52,211,153,.15); color: var(--green); }
.qout { background: rgba(248,113,113,.15); color: var(--red); }
.qtag { font-size: 0.78rem; color: var(--text-dim); }
.qcard p { font-size: 0.85rem; max-width: none; }

/* ============================================================
   LOG EXAMPLES
   ============================================================ */
.log-examples { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.log-line {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: #0a0d14;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}
.log-line.ok    { border-left: 3px solid var(--green); }
.log-line.ko    { border-left: 3px solid var(--red); }
.log-line.neutral { border-left: 3px solid var(--text-dim); }
.log-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-top: 0.05rem;
}
.log-ok { background: rgba(52,211,153,.2); color: var(--green); }
.log-ko { background: rgba(248,113,113,.2); color: var(--red); }
.log-line code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* ============================================================
   PROXY DIAGRAM
   ============================================================ */
.proxy-diagram {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.pd-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1.1rem;
  text-align: center;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  min-width: 90px;
}
.pd-box.connectid { border-color: var(--accent); background: rgba(79,142,247,.08); }
.pd-box.api    { border-color: var(--yellow); }
.pd-box.client { border-color: var(--green); }
.pd-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--accent);
  margin-top: 0.2rem;
}
.pd-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.pd-arrow-line { font-size: 1.2rem; line-height: 1; }

/* ============================================================
   USAGE CARDS
   ============================================================ */
.usage-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (max-width: 700px) { .usage-cards { grid-template-columns: 1fr; } }
.usage-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.usage-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  font-size: 1rem;
}
.usage-icon { font-size: 1.3rem; }
.usage-card p { font-size: 0.85rem; margin-bottom: 0.8rem; max-width: none; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 2.5rem 0 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 0 1.2rem 3rem; }
  .format-grid { grid-template-columns: 1fr; }
}

