/* ============================================================
   LLMMonitor Docs — Style System
   Dark/light via CSS custom properties. Datadog-inspired.
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Light theme (default) */
  --bg:           #f8f9fb;
  --bg-surface:   #ffffff;
  --bg-raised:    #ffffff;
  --bg-sidebar:   #f1f3f7;
  --bg-code:      #1e1e2e;
  --bg-code-inline: #e8ecf1;
  --bg-callout-note:    #eff6ff;
  --bg-callout-warning: #fffbeb;
  --bg-callout-tip:     #f0fdf4;
  --bg-callout-danger:  #fef2f2;
  --border-callout-note:    #93c5fd;
  --border-callout-warning: #fcd34d;
  --border-callout-tip:     #86efac;
  --border-callout-danger:  #fca5a5;
  --border:       #e2e5ea;
  --border-light: #eef0f4;
  --text:         #1a1d23;
  --text-muted:   #6b7280;
  --text-heading: #0f1117;
  --text-sidebar: #374151;
  --text-sidebar-active: #1d4ed8;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  #dbeafe;
  --accent-text:  #ffffff;
  --success:      #059669;
  --warning:      #d97706;
  --danger:       #dc2626;
  --sidebar-width: 260px;
  --navbar-height: 56px;
  --content-max:  760px;
  --toc-width:    200px;
  --radius:       6px;
  --radius-lg:    10px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.06);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.08);
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  color-scheme:   light;
}

[data-theme="dark"] {
  --bg:           #0d1117;
  --bg-surface:   #161b22;
  --bg-raised:    #1c2129;
  --bg-sidebar:   #0f1419;
  --bg-code:      #0d1117;
  --bg-code-inline: #21262d;
  --bg-callout-note:    #0f1d33;
  --bg-callout-warning: #1f1808;
  --bg-callout-tip:     #081f15;
  --bg-callout-danger:  #1f0d0d;
  --border-callout-note:    #1e5398;
  --border-callout-warning: #8b6914;
  --border-callout-tip:     #1a7544;
  --border-callout-danger:  #8b1a1a;
  --border:       #21262d;
  --border-light: #1c2129;
  --text:         #c9d1d9;
  --text-muted:   #8b949e;
  --text-heading: #e6edf3;
  --text-sidebar: #8b949e;
  --text-sidebar-active: #58a6ff;
  --accent:       #4493f8;
  --accent-hover: #58a6ff;
  --accent-soft:  #0d2d5e;
  --accent-text:  #ffffff;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.2);
  --shadow-md:    0 4px 12px rgba(0,0,0,.3);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.4);
  color-scheme:   dark;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Layout ----------------------------------------------- */
.page-wrapper { display: flex; min-height: 100vh; }

/* --- Top Navbar ------------------------------------------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--navbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px;
  box-shadow: var(--shadow-sm);
}
.navbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem; color: var(--text-heading);
  text-decoration: none; flex-shrink: 0;
}
.navbar-logo .logo-icon {
  width: 28px; height: 28px; background: linear-gradient(135deg, #E5673D 0%, #FF8F6B 100%); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-text); font-size: 14px; font-weight: 800;
}
.navbar-search {
  flex: 1; max-width: 360px; margin: 0 24px;
  position: relative;
}
.navbar-search input {
  width: 100%; height: 34px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: .85rem; padding: 0 12px 0 36px;
  font-family: var(--font-sans); outline: none; transition: border-color .15s;
}
.navbar-search input:focus { border-color: var(--accent); }
.navbar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.navbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.navbar-right a, .navbar-right button {
  text-decoration: none; color: var(--text-muted); font-size: .85rem;
  padding: 6px 12px; border-radius: var(--radius); transition: all .15s;
  background: none; border: none; cursor: pointer; font-family: var(--font-sans);
  white-space: nowrap;
}
.navbar-right a:hover, .navbar-right button:hover { color: var(--text); background: var(--bg); }
.theme-toggle { font-size: 1.1rem !important; padding: 6px 8px !important; }

/* --- Sidebar ---------------------------------------------- */
.sidebar {
  position: fixed; top: var(--navbar-height); left: 0; bottom: 0;
  width: var(--sidebar-width); background: var(--bg-sidebar);
  border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden;
  padding: 20px 0 40px; z-index: 50;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section { margin-bottom: 4px; }
.sidebar-section-title {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 20px; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); cursor: pointer; user-select: none;
  transition: color .15s;
}
.sidebar-section-title:hover { color: var(--text); }
.sidebar-section-title .chevron {
  font-size: .6rem; transition: transform .2s; margin-left: auto;
}
.sidebar-section.collapsed .sidebar-links { display: none; }
.sidebar-section.collapsed .chevron { transform: rotate(-90deg); }

.sidebar-links { display: flex; flex-direction: column; }
.sidebar-links a {
  display: block; padding: 5px 20px 5px 32px;
  font-size: .85rem; color: var(--text-sidebar); text-decoration: none;
  border-left: 2px solid transparent; transition: all .12s;
  line-height: 1.5;
}
.sidebar-links a:hover { color: var(--text); background: rgba(0,0,0,.03); }
[data-theme="dark"] .sidebar-links a:hover { background: rgba(255,255,255,.03); }
.sidebar-links a.active {
  color: var(--text-sidebar-active); font-weight: 500;
  border-left-color: var(--accent); background: var(--accent-soft);
}

/* --- Main Content ----------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width); margin-top: var(--navbar-height);
  padding: 40px 48px 80px; max-width: calc(var(--content-max) + 96px);
  width: 100%;
}
.main-content.landing {
  margin-left: 0; max-width: 100%; padding: 0;
}

/* --- Typography ------------------------------------------- */
h1 { font-size: 2rem; font-weight: 700; color: var(--text-heading); margin-bottom: 8px; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; font-weight: 600; color: var(--text-heading); margin-top: 40px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-top: 28px; margin-bottom: 8px; }
h4 { font-size: 1rem; font-weight: 600; color: var(--text-heading); margin-top: 20px; margin-bottom: 6px; }
p { margin-bottom: 14px; color: var(--text); line-height: 1.75; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; color: var(--text-heading); }
.page-subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 28px; line-height: 1.6; }

/* --- Code Blocks ------------------------------------------ */
pre {
  background: var(--bg-code); border-radius: var(--radius-lg);
  padding: 18px 20px; overflow-x: auto; margin: 16px 0;
  font-family: var(--font-mono); font-size: .85rem; line-height: 1.6;
  color: #e6edf3; position: relative; border: 1px solid var(--border);
}
pre code { font-family: var(--font-mono); font-size: inherit; }
:not(pre) > code {
  background: var(--bg-code-inline); color: var(--accent);
  padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono);
  font-size: .88em; border: 1px solid var(--border-light);
}

.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7); border-radius: var(--radius);
  padding: 4px 10px; font-size: .75rem; cursor: pointer;
  font-family: var(--font-sans); transition: all .15s; opacity: 0;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.copy-btn.copied { background: var(--success); border-color: var(--success); color: #fff; }

/* Language tabs */
.lang-tabs {
  display: flex; gap: 2px; margin-bottom: -1px;
}
.lang-tab {
  padding: 6px 16px; font-size: .8rem; font-weight: 500;
  background: var(--bg); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; cursor: pointer;
  color: var(--text-muted); transition: all .15s; font-family: var(--font-sans);
}
.lang-tab:hover { color: var(--text); }
.lang-tab.active { background: var(--bg-code); color: var(--accent); border-color: var(--border); }
.lang-panel { display: none; }
.lang-panel.active { display: block; }
.lang-panel pre { margin-top: 0; border-top-left-radius: 0; }

/* --- Callout Boxes ---------------------------------------- */
.callout {
  border-left: 4px solid; border-radius: var(--radius);
  padding: 14px 18px; margin: 18px 0; font-size: .92rem;
  line-height: 1.65;
}
.callout.note    { background: var(--bg-callout-note);    border-color: var(--border-callout-note); }
.callout.warning { background: var(--bg-callout-warning); border-color: var(--border-callout-warning); }
.callout.tip     { background: var(--bg-callout-tip);     border-color: var(--border-callout-tip); }
.callout.danger  { background: var(--bg-callout-danger);  border-color: var(--border-callout-danger); }
.callout strong { display: block; margin-bottom: 4px; font-size: .88rem; }

/* --- Tables ----------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead { background: var(--bg); }
th {
  text-align: left; padding: 10px 14px; font-weight: 600;
  color: var(--text-muted); font-size: .8rem; text-transform: uppercase;
  letter-spacing: .03em; border-bottom: 2px solid var(--border);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0,0,0,.01); }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.01); }

/* --- Feature Cards (landing page) ------------------------- */
.hero {
  text-align: center; padding: 100px 24px 80px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 2.8rem; margin-bottom: 16px; }
.hero .hero-subtitle {
  font-size: 1.2rem; color: var(--text-muted); max-width: 620px;
  margin: 0 auto 32px; line-height: 1.6;
}
.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: var(--radius); font-weight: 600;
  font-size: .9rem; cursor: pointer; text-decoration: none; border: none;
  transition: all .15s; font-family: var(--font-sans);
}
.btn-primary { background: linear-gradient(135deg, #E5673D 0%, #FF8F6B 100%); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-secondary {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); text-decoration: none; }

.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px; padding: 60px 40px; max-width: 1100px; margin: 0 auto;
}
.feature-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px;
  transition: all .2s; text-decoration: none; color: var(--text);
}
.feature-card:hover {
  box-shadow: var(--shadow-md); border-color: var(--accent);
  transform: translateY(-1px); text-decoration: none;
}
.feature-card .feature-icon {
  width: 42px; height: 42px; background: var(--accent-soft);
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; margin-bottom: 14px;
  color: var(--accent);
}
.feature-card h3 { margin-top: 0; font-size: 1.05rem; border: none; padding: 0; }
.feature-card p { color: var(--text-muted); font-size: .9rem; margin: 0; }

/* --- Right TOC (wide screens) ----------------------------- */
.toc-container {
  display: none; position: fixed; right: 24px;
  top: calc(var(--navbar-height) + 40px); width: var(--toc-width);
  max-height: calc(100vh - var(--navbar-height) - 80px);
  overflow-y: auto; font-size: .8rem;
}
@media (min-width: 1400px) { .toc-container { display: block; } }
.toc-title { font-weight: 600; color: var(--text-muted); margin-bottom: 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.toc-container a {
  display: block; padding: 3px 0; color: var(--text-muted);
  text-decoration: none; border-left: 2px solid transparent;
  padding-left: 10px; transition: all .12s;
}
.toc-container a:hover, .toc-container a.active { color: var(--accent); border-left-color: var(--accent); }

/* --- Landing Page Sections -------------------------------- */
.section { padding: 64px 24px; border-bottom: 1px solid var(--border-light); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section h2 { text-align: center; border: none; font-size: 1.8rem; margin-bottom: 8px; padding: 0; }
.section .section-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 48px; font-size: 1.05rem; }

/* Quick links strip */
.quick-links {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  padding: 32px 24px; border-bottom: 1px solid var(--border);
}
.quick-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  text-decoration: none; font-size: .9rem; font-weight: 500;
  transition: all .15s; background: var(--bg-surface);
}
.quick-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.quick-link .ql-icon { font-size: 1.1rem; }

/* Footer */
footer {
  text-align: center; padding: 32px; color: var(--text-muted);
  font-size: .85rem; border-top: 1px solid var(--border);
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--text); }

/* --- Responsive ------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; z-index: 90; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 32px 20px 60px; }
  .main-content.landing { margin-left: 0; }
}

.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; color: var(--text); font-size: 1.3rem;
}
@media (max-width: 1024px) { .hamburger { display: flex; } .navbar-search { display: none; } }

/* Sidebar overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 89;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .hero { padding: 60px 20px 48px; }
  .hero h1 { font-size: 2rem; }
  .hero .hero-subtitle { font-size: 1rem; }
  .features-grid { grid-template-columns: 1fr; padding: 40px 20px; }
  .section { padding: 48px 20px; }
  .main-content { padding: 24px 16px 48px; }
}

/* --- Print ------------------------------------------------- */
@media print {
  .sidebar, .navbar, .toc-container, .copy-btn { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
}
