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

:root {
  --primary:       #1a6b3c;
  --primary-dark:  #134f2d;
  --primary-light: #e8f5ee;
  --accent:        #2d9e5f;
  --accent-hover:  #227a49;
  --warn:          #e07b00;
  --danger:        #c0392b;
  --info:          #2471a3;
  --bg:            #f4f6f8;
  --surface:       #ffffff;
  --border:        #dde3e9;
  --text:          #1c2529;
  --text-muted:    #6b7c89;
  --code-bg:       #1e2a35;
  --code-text:     #c9e8c9;
  --radius:        8px;
  --shadow:        0 2px 10px rgba(0,0,0,.08);
  --shadow-md:     0 4px 20px rgba(0,0,0,.12);
  --font-sans:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

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

/* ===== TOPBAR ===== */
.topbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
  color: #fff;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}
.topbar-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  white-space: nowrap;
}
.topbar-logo span { opacity: .7; font-weight: 400; font-size: 13px; margin-left: 8px; }
.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.topbar-nav a {
  color: rgba(255,255,255,.8);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.topbar-nav a:hover, .topbar-nav a.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(160deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 56px 32px 48px;
  text-align: center;
}
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.hero p  { font-size: 17px; opacity: .88; max-width: 640px; margin: 0 auto 24px; }
.hero-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.badge svg { width: 14px; height: 14px; }

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== SECTION WRAPPERS ===== */
.section {
  padding: 48px 32px;
}
.section + .section { border-top: 1px solid var(--border); }
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 28px;
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== TABS ===== */
.tabs-wrapper { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 20px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-btn .tab-icon { font-size: 16px; }

/* Sub-tabs */
.subtabs-wrapper {
  background: var(--primary-light);
  border-bottom: 1px solid #c5dece;
}
.subtabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
}
.subtab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.subtab-btn:hover { background: rgba(45,158,95,.1); }
.subtab-btn.active {
  border-bottom-color: var(--accent);
  font-weight: 600;
  background: rgba(45,158,95,.12);
}

/* Tab panes */
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.subtab-pane { display: none; }
.subtab-pane.active { display: block; }

/* ===== PARAMS TABLE ===== */
.params-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.params-table th {
  background: #f0f4f7;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.params-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: top;
}
.params-table tr:last-child td { border-bottom: none; }
.params-table tr:hover td { background: #fafbfc; }
.params-table .field-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--primary-dark);
  font-weight: 600;
}
.params-table .field-type {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--info);
}
.params-table .field-desc { color: var(--text); line-height: 1.5; }

/* Required / Optional pills */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  line-height: 1.5;
}
.pill-required    { background: #fde8e8; color: var(--danger); }
.pill-optional    { background: #e8f2fd; color: var(--info); }
.pill-create      { background: #fff3cd; color: #856404; }
.pill-conditional { background: #e8f5e9; color: #2e7d32; }

/* ===== CODE BLOCK ===== */
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}
.code-block .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.7);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.code-block .copy-btn.copied { color: #7defa7; border-color: #7defa7; }

/* JSON syntax highlighting */
.json-key    { color: #9dd4f8; }
.json-str    { color: #ce9178; }
.json-num    { color: #b5cea8; }
.json-bool   { color: #569cd6; }
.json-null   { color: #569cd6; }
.json-never  { color: #9dd4f8; opacity: .4; text-decoration: line-through; text-decoration-color: #e06c75; }
.json-comment { color: #6a9153; font-style: italic; }

/* ===== HOW-TO SECTION ===== */
.how-to-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.how-to-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.how-to-card h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.how-to-card p, .how-to-card li {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.how-to-card ul { padding-left: 18px; }
.how-to-card li { margin-bottom: 4px; }

/* Step badges */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== FLOW DIAGRAM ===== */
.flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 20px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
}
.flow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  padding: 8px 14px;
  background: var(--primary-light);
  border: 1px solid #c5dece;
  border-radius: 6px;
}
.flow-step .step-icon { font-size: 16px; }
.flow-arrow {
  color: var(--text-muted);
  font-size: 20px;
  padding: 0 6px;
}

/* ===== ALERT BOXES ===== */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 13.5px;
  line-height: 1.55;
  margin: 16px 0;
}
.alert-info    { background: #eaf4fc; border-color: var(--info);  color: #1a4a6e; }
.alert-warn    { background: #fff8e6; border-color: var(--warn);  color: #7a4800; }
.alert-success { background: var(--primary-light); border-color: var(--accent); color: var(--primary-dark); }
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ===== FOOTER ===== */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 28px 20px;
  font-size: 13px;
}
.footer a { color: rgba(255,255,255,.75); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb { background: #bcc5cf; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9aa6b2; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .topbar-nav { display: none; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .tab-btn { padding: 12px 14px 10px; font-size: 13px; }
  .section { padding: 32px 16px; }
}
