/* Coolpie.ai Documentation – shared stylesheet */
:root {
  --brand:       #1890ff;   /* Coolpie primary blue */
  --brand-dk:    #096dd9;   /* darker blue for hover */
  --sidebar-bg:  #474554;   /* dark sidebar (matches platform) */
  --header-bg:   #1f6299;   /* top header blue */
  --text:        #1a1a1a;
  --muted:       #6b7280;
  --border:      #e5e7eb;
  --bg:          #f9fafb;
  --white:       #ffffff;
  --nav-w:       260px;
  --radius:      8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--nav-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-decoration: none;
  background: var(--header-bg);
}
.sidebar-logo img {
  height: 32px;
  display: block;
  /* invert to ensure white logo on dark background */
  filter: brightness(0) invert(1);
}
.sidebar-logo span {
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
}
.sidebar-docs-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar nav { padding: 12px 0; flex: 1; }

.nav-section-label {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 6px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}
.sidebar a.active {
  background: var(--brand);
  color: var(--white);
  border-left-color: transparent;
  font-weight: 600;
}
.sidebar a .icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-sub { padding-left: 0; }
.sidebar-sub a {
  font-size: 13px;
  padding: 6px 16px 6px 44px;
  color: rgba(255, 255, 255, 0.55);
}
.sidebar-sub a:hover { color: rgba(255, 255, 255, 0.9); background: rgba(255,255,255,0.06); }
.sidebar-sub a.active { background: var(--brand); color: var(--white); font-weight: 600; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}
.sidebar-footer a { color: rgba(255, 255, 255, 0.65); text-decoration: none; }
.sidebar-footer a:hover { color: var(--white); text-decoration: underline; }

/* ── Main content ─────────────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 960px;
}

/* ── Top breadcrumb ───────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span { margin: 0 6px; }

/* ── Page title ───────────────────────────────────────── */
h1.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}
.page-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 32px;
}

/* ── Section headings ─────────────────────────────────── */
h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 36px 0 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
h2:first-of-type { border-top: none; }
h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 22px 0 8px;
}
h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 6px;
  color: var(--text);
}

p { margin-bottom: 14px; }

a { color: var(--brand); }
a:hover { color: var(--brand-dk); }

/* ── Callouts ─────────────────────────────────────────── */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border-left: 4px solid;
  font-size: 14px;
}
.callout.info  { background: #e6f7ff; border-color: var(--brand); color: #003a8c; }
.callout.tip   { background: #f6ffed; border-color: #52c41a;      color: #135200; }
.callout.warn  { background: #fffbe6; border-color: #faad14;      color: #613400; }

/* ── Stat cards (dashboard overview) ─────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0 28px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--brand); }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 24px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  background: var(--bg);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:hover td { background: #fafafa; }
td code, th code { font-size: 12px; background: var(--bg); padding: 2px 5px; border-radius: 4px; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green  { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.badge-orange { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }
.badge-blue   { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.badge-gray   { background: #fafafa; color: #595959; border: 1px solid #d9d9d9; }

/* ── Steps ────────────────────────────────────────────── */
.steps { counter-reset: step; list-style: none; margin: 16px 0 24px; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}
.steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--brand);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

/* ── Screenshots ──────────────────────────────────────── */
.screenshot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.screenshot img { display: block; width: 100%; }
.screenshot figcaption {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* ── Field reference cards ────────────────────────────── */
.field-list { list-style: none; margin: 0 0 24px; }
.field-list li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.field-list li:last-child { border-bottom: none; }
.field-list .field-name { font-weight: 600; color: var(--text); }
.field-list .field-desc { color: var(--muted); }

/* ── Feature grid on index ────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.feature-card:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 12px rgba(24, 144, 255, .15);
}
.feature-card .fc-icon { font-size: 28px; margin-bottom: 10px; }
.feature-card .fc-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.feature-card .fc-desc  { font-size: 13px; color: var(--muted); }

/* ── Keyboard shortcut ────────────────────────────────── */
kbd {
  display: inline-block;
  padding: 2px 7px;
  font-size: 12px;
  font-family: monospace;
  background: #f5f5f5;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: static; width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,.1); }
  body { flex-direction: column; }
  .main { margin-left: 0; padding: 24px 20px 60px; }
  .field-list li { grid-template-columns: 1fr; }
}
