/* ============================================================
   MNA Intelligent Systems — Documentation
   Couleurs : Primaire #173DED / Noir #050505
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #173DED;
  --primary-hover: #1232c8;
  --primary-light: #e8ecfd;
  --primary-muted: rgba(23,61,237,0.08);
  --black: #050505;
  --white: #ffffff;
  --bg: #fafbfc;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --surface: #ffffff;
  --surface-hover: #f9fafb;
  --code-bg: #f4f5f7;
  --success: #059669;
  --success-bg: rgba(5,150,105,0.06);
  --warning: #d97706;
  --warning-bg: rgba(217,119,6,0.06);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.06);
  --info-bg: rgba(23,61,237,0.06);
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --primary-light: rgba(23,61,237,0.15);
  --primary-muted: rgba(23,61,237,0.12);
  --bg: #0a0a0a;
  --text: #e5e5e5;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #1f1f1f;
  --border-light: #171717;
  --surface: #111111;
  --surface-hover: #1a1a1a;
  --code-bg: #171717;
  --success-bg: rgba(5,150,105,0.1);
  --warning-bg: rgba(217,119,6,0.1);
  --danger-bg: rgba(220,38,38,0.1);
  --info-bg: rgba(23,61,237,0.1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--black);
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.sidebar-brand span {
  display: block;
  font-size: 11px;
  color: #555;
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
}

.nav-group { margin-bottom: 20px; }

.nav-group-title {
  font-size: 10px;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  padding: 0 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #888;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s ease;
  margin-bottom: 1px;
}

.nav-item:hover {
  color: #ccc;
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
}

.nav-item i[data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active i[data-lucide] { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  letter-spacing: 0.2px;
}

.nav-badge-active { background: rgba(5,150,105,0.15); color: #10b981; }
.nav-badge-setup { background: rgba(217,119,6,0.15); color: #f59e0b; }

/* ===== MAIN LAYOUT ===== */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(250,251,252,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
}

[data-theme="dark"] .topbar { background: rgba(10,10,10,0.92); }

.topbar-left { display: flex; align-items: center; gap: 10px; }

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb strong { color: var(--text); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover { background: var(--surface-hover); color: var(--text); }

.menu-toggle { display: none; }

/* ===== CONTENT ===== */
.content {
  padding: 40px 48px;
  max-width: 960px;
}

/* ===== TYPOGRAPHY ===== */
.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.6px;
  line-height: 1.2;
  margin-bottom: 6px;
}

[data-theme="dark"] .page-title { color: #fff; }

.page-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin: 48px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

h2:first-of-type { margin-top: 0; }

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

h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}

p { margin-bottom: 12px; }

/* ===== HERO (index only, no gradient) ===== */
.hero {
  background: var(--black);
  border-radius: var(--radius);
  padding: 40px 44px;
  margin-bottom: 40px;
  color: #fff;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 15px;
  color: #999;
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }

.hero-stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  display: block;
}

.hero-stat-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
  display: block;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-header h4 { margin: 0; }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

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

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ===== ALERTS ===== */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

.alert i[data-lucide] { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-danger { background: var(--danger-bg); border: 1px solid rgba(220,38,38,0.12); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(217,119,6,0.12); color: var(--warning); }
.alert-info { background: var(--info-bg); border: 1px solid rgba(23,61,237,0.12); color: var(--primary); }
.alert-success { background: var(--success-bg); border: 1px solid rgba(5,150,105,0.12); color: var(--success); }

[data-theme="dark"] .alert-danger { color: #f87171; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }
[data-theme="dark"] .alert-info { color: #818cf8; }
[data-theme="dark"] .alert-success { color: #34d399; }

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

thead th {
  background: var(--code-bg);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* ===== CODE ===== */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.7;
}

pre code { background: none; padding: 0; color: var(--text); }

/* ===== TEMPLATE BOX ===== */
.tpl {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.tpl-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tpl .v {
  background: rgba(217,119,6,0.1);
  color: #b45309;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 12.5px;
}

[data-theme="dark"] .tpl .v { color: #fbbf24; }

/* ===== TAGS ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.tag-blue { background: var(--primary-muted); color: var(--primary); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-amber { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--danger-bg); color: var(--danger); }
.tag-purple { background: rgba(124,58,237,0.06); color: #7c3aed; }

/* ===== TIMELINE ===== */
.timeline {
  position: relative;
  padding-left: 28px;
  margin-bottom: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 1.5px;
  background: var(--border);
}

.tl-item {
  position: relative;
  margin-bottom: 24px;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
}

.tl-day {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.tl-item h4 { margin: 0 0 3px; font-size: 14px; }
.tl-item p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ===== STEPS ===== */
.steps { counter-reset: step; margin-bottom: 24px; }

.step {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  counter-increment: step;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-body h4 { margin: 0 0 2px; font-size: 14px; }
.step-body p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ===== COLLAPSIBLE ===== */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--surface);
}

summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s;
  flex-shrink: 0;
}

details[open] summary::before { transform: rotate(90deg); }
summary::-webkit-details-marker { display: none; }
details > .details-body { padding: 0 16px 16px; }

/* ===== SCREENSHOTS ===== */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.ss-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.ss-card:hover { border-color: var(--primary); }

.ss-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

.ss-caption {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
}

.ss-caption small {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11.5px;
  margin-top: 1px;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 6px; }

/* ===== WORKFLOW DIAGRAM ===== */
.wf-diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.wf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

.wf-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
}

.wf-trigger { background: rgba(124,58,237,0.06); border-color: rgba(124,58,237,0.2); color: #7c3aed; }
.wf-process { background: var(--primary-muted); border-color: rgba(23,61,237,0.2); color: var(--primary); }
.wf-output { background: var(--success-bg); border-color: rgba(5,150,105,0.2); color: var(--success); }
.wf-ai { background: var(--warning-bg); border-color: rgba(217,119,6,0.2); color: var(--warning); }

.wf-arrow { color: var(--text-muted); font-size: 14px; }

/* ===== LISTS ===== */
ul, ol { margin-bottom: 14px; padding-left: 20px; }
li { margin-bottom: 5px; font-size: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 24px 20px; }
  .menu-toggle { display: flex; }
  .hero { padding: 28px; }
  .card-grid, .stat-grid { grid-template-columns: 1fr; }
}

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 20px; }
}

/* ===== PAGE NAV (bottom) ===== */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.page-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.page-nav a:hover { color: var(--primary); border-color: var(--primary); }
.page-nav a i[data-lucide] { width: 14px; height: 14px; }

/* ===== TABS ===== */
.tabs {
  margin-bottom: 32px;
}

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn i[data-lucide] {
  width: 15px;
  height: 15px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== CONFIG STEP (full-width with screenshot) ===== */
.config-step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 20px;
  overflow: hidden;
}

.config-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.config-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.config-step-header h4 {
  margin: 0;
  font-size: 15px;
}

.config-step-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.config-step-body {
  padding: 20px;
}

.config-step-body p {
  font-size: 14px;
  line-height: 1.7;
}

.config-step-body img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.config-step-body img:hover {
  opacity: 0.92;
}

/* ===== CONNECTION DIAGRAM ===== */
.conn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.conn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conn-icon i[data-lucide] { width: 18px; height: 18px; }

.conn-card h4 { margin: 0 0 4px; font-size: 14px; }
.conn-card p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

@media (max-width: 1024px) {
  .tab-nav { overflow-x: auto; }
  .tab-btn { padding: 10px 14px; font-size: 12.5px; }
}
