/* ============================================================
   Mentray Documentation — Custom Stylesheet
   Brand: Teal #0d9488 | Purple #7c3aed | Amber #f59e0b
   ============================================================ */

:root {
  --teal:        #0d9488;
  --teal-light:  #14b8a6;
  --teal-dark:   #0f766e;
  --purple:      #7c3aed;
  --purple-light:#a78bfa;
  --amber:       #f59e0b;
  --amber-light: #fcd34d;
  --bg:          #f1f5f9;
  --sidebar-bg:  #0f172a;
  --sidebar-w:   288px;
  --text:        #1e293b;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --code-bg:     #1e293b;
  --radius:      12px;
  --shadow:      0 2px 12px rgba(0,0,0,.06);
  --shadow-md:   0 6px 28px rgba(0,0,0,.10);
  --content-pad: 52px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #1e293b;
  display: flex; align-items: center; gap: 12px;
}

.logo-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-text span:first-child {
  font-size: 18px; font-weight: 800; color: #f1f5f9;
  letter-spacing: -.3px;
}
.logo-text span:last-child {
  font-size: 10px; color: #64748b; text-transform: uppercase;
  letter-spacing: 1.2px;
}

.sidebar-search {
  padding: 12px 16px;
  position: sticky; top: 0;
  background: var(--sidebar-bg);
  border-bottom: 1px solid #1e293b;
}

.sidebar-search input {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  color: #f1f5f9;
  font-size: 13px;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px;
  background-position: 10px center;
}
.sidebar-search input::placeholder { color: #475569; }
.sidebar-search input:focus { border-color: var(--teal); }

.nav-section { padding: 16px 12px 4px; }
.nav-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  color: #475569; font-weight: 700; padding: 0 8px; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  color: #94a3b8; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: all .2s;
  margin-bottom: 2px;
}
.nav-item:hover { background: #1e293b; color: #e2e8f0; }
.nav-item.active { background: linear-gradient(135deg,rgba(13,148,136,.25),rgba(124,58,237,.15)); color: var(--teal-light); border-left: 3px solid var(--teal); }
.nav-item .icon { font-size: 15px; opacity: .8; }

.sidebar-badge {
  margin-left: auto; font-size: 10px; padding: 2px 7px;
  border-radius: 20px; font-weight: 600;
}
.badge-teal  { background: rgba(13,148,136,.2); color: var(--teal-light); }
.badge-purple{ background: rgba(124,58,237,.2); color: var(--purple-light); }
.badge-amber { background: rgba(245,158,11,.2); color: var(--amber); }

/* ── Main Content ───────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-w));
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.95); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--content-pad);
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.topbar-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.topbar-breadcrumb span { color: var(--text); font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }
.btn-outline {
  padding: 7px 16px; border: 1.5px solid var(--teal); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--teal); cursor: pointer;
  background: transparent; text-decoration: none;
  transition: all .2s;
}
.btn-outline:hover { background: var(--teal); color: #fff; }

.btn-primary {
  padding: 7px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border: none; text-decoration: none;
  transition: opacity .2s;
}
.btn-primary:hover { opacity: .88; }

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  padding: 48px var(--content-pad) 80px;
  width: 100%;
  max-width: 1400px;
}

.doc-section { display: none; }
.doc-section.active { display: block; background: var(--bg); }

/* Hero / Overview ─────────────────────────────────────────── */
.hero {
  background: linear-gradient(140deg,#0c1a2e 0%, #1a0e3a 45%, #0a2440 100%);
  border-radius: 16px;
  padding: 52px 56px;
  margin-bottom: 48px;
  position: relative; overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255,255,255,.06);
}
.hero::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero::after {
  content: '';
  position: absolute; top: -80px; right: -80px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(13,148,136,.18) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  display: flex; gap: 48px; align-items: center; position: relative; z-index: 1;
}
.hero-left { flex: 1; min-width: 0; }
.hero-right { flex-shrink: 0; width: 280px; }

.hero-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.hero-stat {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 16px; text-align: center;
  backdrop-filter: blur(4px);
}
.hs-num { display: block; font-size: 28px; font-weight: 900; background: linear-gradient(135deg,var(--teal-light),var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.1; }
.hs-lbl { display: block; font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(13,148,136,.2); border: 1px solid rgba(13,148,136,.35);
  padding: 5px 14px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; color: var(--teal-light);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 { font-size: 42px; font-weight: 900; line-height: 1.15; margin-bottom: 18px; }
.hero h1 span { background: linear-gradient(135deg,var(--teal-light),var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 16px; color: #94a3b8; max-width: 520px; margin-bottom: 28px; line-height: 1.8; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-pill {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.1); color: #cbd5e1; background: rgba(255,255,255,.04);
  transition: background .15s, border-color .15s;
}
.hero-pill:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }

/* Section Titles ──────────────────────────────────────────── */
.section-header { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.section-tag {
  display: inline-block;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.8px; font-weight: 800;
  color: var(--teal); margin-bottom: 12px;
  background: rgba(13,148,136,.08); padding: 4px 12px; border-radius: 20px;
}
.section-header h2 { font-size: 32px; font-weight: 900; color: var(--text); line-height: 1.2; margin: 0 0 10px; padding: 0; border: none; }
.section-header p { color: var(--muted); font-size: 16px; max-width: 680px; margin: 0; }

/* Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(13,148,136,.25); }

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

.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.card-icon.teal   { background: rgba(13,148,136,.12);  }
.card-icon.purple { background: rgba(124,58,237,.12); }
.card-icon.amber  { background: rgba(245,158,11,.12);  }
.card-icon.blue   { background: rgba(59,130,246,.12);  }
.card-icon.red    { background: rgba(239,68,68,.12);   }
.card-icon.green  { background: rgba(16,185,129,.12);  }

.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.card p  { font-size: 13.5px; color: var(--muted); }

/* Feature list ────────────────────────────────────────────── */
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.feature-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--muted); }
.feature-list li::before { content: '✓'; color: var(--teal); font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* Service Table ───────────────────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; margin-bottom: 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.service-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.service-table thead { background: linear-gradient(135deg, var(--teal-dark), var(--purple)); color: #fff; }
.service-table th { padding: 13px 18px; text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: .6px; white-space: nowrap; }
.service-table td { padding: 13px 18px; font-size: 13.5px; border-bottom: 1px solid var(--border); background: #fff; vertical-align: top; }
.service-table tr:last-child td { border-bottom: none; }
.service-table tbody tr:hover td { background: #f8fafc; }
.port-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  background: rgba(13,148,136,.1); color: var(--teal-dark);
  font-family: monospace;
}

/* Code blocks ─────────────────────────────────────────────── */
.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}
.code-block pre {
  font-family: 'JetBrains Mono','Fira Code','Cascadia Code', monospace;
  font-size: 13px; line-height: 1.8;
  color: #e2e8f0;
  white-space: pre;
}
.code-block .kw  { color: #7c3aed; }
.code-block .str { color: #34d399; }
.code-block .cmt { color: #475569; }
.code-block .url { color: #60a5fa; }
.code-block .num { color: #f59e0b; }
.code-lang {
  position: absolute; top: 10px; right: 16px;
  font-size: 11px; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: 1px;
}
.copy-btn {
  position: absolute; top: 10px; right: 60px;
  background: #334155; color: #94a3b8; border: none;
  padding: 4px 10px; border-radius: 6px; font-size: 11px;
  cursor: pointer; transition: all .2s;
}
.copy-btn:hover { background: var(--teal); color: #fff; }

/* Alert / callout ─────────────────────────────────────────── */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin: 20px 0;
  display: flex; gap: 12px; align-items: flex-start;
}
.callout-info  { background: rgba(13,148,136,.08); border-color: var(--teal); }
.callout-warn  { background: rgba(245,158,11,.08);  border-color: var(--amber); }
.callout-tip   { background: rgba(124,58,237,.08);  border-color: var(--purple); }
.callout-icon  { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.callout-body  { font-size: 14px; }
.callout-body strong { display: block; margin-bottom: 4px; font-size: 15px; }

/* API endpoint badges ─────────────────────────────────────── */
.endpoint { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--border); margin-bottom: 8px; font-family: monospace; font-size: 13px; }
.method { padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.method.get    { background: rgba(16,185,129,.15); color: #059669; }
.method.post   { background: rgba(59,130,246,.15);  color: #2563eb; }
.method.patch  { background: rgba(245,158,11,.15);  color: #d97706; }
.method.delete { background: rgba(239,68,68,.15);   color: #dc2626; }
.endpoint-url  { color: var(--text); flex: 1; }
.endpoint-desc { font-size: 12px; color: var(--muted); margin-left: auto; font-family: 'Inter',sans-serif; }

/* Architecture diagram ────────────────────────────────────── */
.arch-diagram {
  background: #0f172a; border-radius: var(--radius);
  padding: 32px; margin: 24px 0; position: relative; overflow: hidden;
}
.arch-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.arch-box {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 10px; padding: 12px 20px; text-align: center;
  min-width: 120px; position: relative;
}
.arch-box.highlight { border-color: var(--teal); background: rgba(13,148,136,.12); }
.arch-box.ai         { border-color: var(--purple); background: rgba(124,58,237,.12); }
.arch-box.db         { border-color: var(--amber);  background: rgba(245,158,11,.12); }
.arch-box span       { display: block; color: #94a3b8; font-size: 11px; margin-top: 4px; }
.arch-box strong     { font-size: 13px; color: #f1f5f9; }
.arch-arrow {
  width: 100%; text-align: center; color: #334155; font-size: 20px; margin: 4px 0;
  letter-spacing: 40px;
}
.arch-layer-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #475569; margin-bottom: 12px; text-align: center;
}

/* Stats ───────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 16px; margin-bottom: 40px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-number { font-size: 38px; font-weight: 900; background: linear-gradient(135deg,var(--teal),var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.1; }
.stat-card .stat-label  { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-top: 6px; }

/* Tech stack badges ───────────────────────────────────────── */
.tech-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.tech-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: #fff;
  color: var(--text);
}
.tech-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Divider ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* TOC table ───────────────────────────────────────────────── */
h2 { font-size: 22px; font-weight: 800; color: var(--text); margin: 48px 0 18px; padding-bottom: 12px; border-bottom: 2px solid var(--border); display: flex; align-items: center; gap: 10px; }
h3 { font-size: 17px; font-weight: 700; color: var(--text); margin: 32px 0 12px; }
h4 { font-size: 15px; font-weight: 700; color: var(--text); margin: 20px 0 8px; }
p  { margin-bottom: 14px; line-height: 1.75; }
ul, ol { padding-left: 22px; margin-bottom: 14px; }
li { margin-bottom: 6px; font-size: 14.5px; line-height: 1.6; }
strong { font-weight: 700; }
code { background: #f1f5f9; padding: 2px 7px; border-radius: 5px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--purple); border: 1px solid #e2e8f0; }

/* Mobile ──────────────────────────────────────────────────── */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .page-content { padding: 28px 20px 60px; }
  .hamburger { display: flex; align-items: center; }
  .hero { padding: 36px 28px; }
  .hero h1 { font-size: 28px; }
  .hero-inner { flex-direction: column; gap: 32px; }
  .hero-right { width: 100%; }
  .hero-stats-grid { grid-template-columns: repeat(3, 1fr); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; display: none; }
  .sidebar-overlay.visible { display: block; }
}

/* Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Progress bar ────────────────────────────────────────────── */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 999;
  background: linear-gradient(90deg, var(--teal), var(--purple));
  transition: width .1s;
}

/* Footer ──────────────────────────────────────────────────── */
.doc-footer {
  background: #fff; border-top: 1px solid var(--border);
  padding: 24px var(--content-pad); display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted); flex-shrink: 0;
}
.doc-footer a { color: var(--teal); text-decoration: none; }
.doc-footer a:hover { text-decoration: underline; }
